Yet Another Mechanism System
// Create your motor controller config
SmartMotorControllerConfig motorConfig = new SmartMotorControllerConfig(this)
.withClosedLoopController(4, 0, 0, DegreesPerSecond.of(180), DegreesPerSecondPerSecond.of(90))
.withSoftLimit(Degrees.of(-30), Degrees.of(100))
.withGearing(new MechanismGearing(GearBox.fromReductionStages(3, 4)))
.withIdleMode(MotorMode.BRAKE)
.withTelemetry("ArmMotor", TelemetryVerbosity.HIGH)
.withStatorCurrentLimit(Amps.of(40))
.withMotorInverted(false)
.withClosedLoopRampRate(Seconds.of(0.25))
.withOpenLoopRampRate(Seconds.of(0.25))
.withFeedforward(new ArmFeedforward(0, 0, 0, 0))
.withControlMode(ControlMode.CLOSED_LOOP);
// Create your motor
TalonFXS armMotor = new TalonFXS(1);
SmartMotorController motor = new TalonFXSWrapper(armMotor, DCMotor.getNEO(1), motorConfig);
// Create your mechanism config
ArmConfig config = new ArmConfig(motor)
.withLength(Meters.of(0.135))
.withHardLimit(Degrees.of(-100), Degrees.of(200))
.withTelemetry("ArmExample", TelemetryVerbosity.HIGH)
.withMass(Pounds.of(1))
.withStartingPosition(Degrees.of(0))
.withHorizontalZero(Degrees.of(0));
// Create the Arm!
Arm arm = new Arm(config);
Join a community of over 400 teams!

Last updated