You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Example that would generate only relevant Feedforward but invalid Feedback constants
SysIdRoutine
private final SysIdRoutine m_sysIdRoutine =
new SysIdRoutine(
// Empty config defaults to 1 volt/second ramp rate and 7 volt step voltage.
new SysIdRoutine.Config(Volts.per(Second).of(ElevatorConstants.kElevatorRampRate),
Volts.of(9),
Seconds.of(10)),
new SysIdRoutine.Mechanism(
// Tell SysId how to plumb the driving voltage to the motor(s).
m_motor::setVoltage,
// Tell SysId how to record a frame of data for each motor on the mechanism being
// characterized.
log -> {
// Record a frame for the shooter motor.
log.motor("elevator")
.voltage(
m_appliedVoltage.mut_replace(
m_motor.getAppliedOutput() * RobotController.getBatteryVoltage(), Volts))
.linearPosition(m_distance.mut_replace(getHeight()))
.linearVelocity(m_velocity.mut_replace(getVelocity()));
},
this));
// getHeight() returns Meters
// getVelocity() returns Meters Per Minute
Controller setpoint for Spark
m_controller.setReference(Elevator.convertDistanceToSensorUnits(Meters.of(goal)).in(Rotations), // Problem here
ControlType.kMAXMotionPositionControl,
ClosedLoopSlot.kSlot0,
m_feedforward.calculate(getVelocity().in(Meters.per(Minute))));
// getVelocity() returns the MetersPerMinute
The unit dropdown is only for labeling the gains, and units should align with the units that the sensor/controller in the robot code uses.
The text was updated successfully, but these errors were encountered: