Could you provide an example showing MAXMotion position control using the primary encoder with a non-default positionConversionFactor?
I'm trying to use MAXMotion for a turret with a 17.77:1 gear ratio and would like to work in degrees rather than motor rotations. I've set:
motorConfig.encoder
.positionConversionFactor(360.0 / 17.77) // degrees
.velocityConversionFactor(360.0 / 17.77 / 60.0); // deg/sec
motorConfig.closedLoop
.feedbackSensor(FeedbackSensor.kPrimaryEncoder)
.p(0.4)
.outputRange(-1, 1);
motorConfig.closedLoop.maxMotion
.cruiseVelocity(1000)
.maxAcceleration(1000)
.allowedProfileError(1);
I'm getting oscillation at the setpoint. The same setup works fine with:
positionConversionFactor = 1 (default)
kPosition control instead of kMAXMotionPositionControl
I couldn't find any examples in REVLib-Examples or the 2025-REV-ION-FRC-Starter-Bot that use a custom positionConversionFactor with MAXMotion on the primary encoder.
What values should cruiseVelocity, maxAcceleration, allowedProfileError, and kP be when using a conversion factor like this?
Could you provide an example showing MAXMotion position control using the primary encoder with a non-default positionConversionFactor?
I'm trying to use MAXMotion for a turret with a 17.77:1 gear ratio and would like to work in degrees rather than motor rotations. I've set:
motorConfig.encoder
.positionConversionFactor(360.0 / 17.77) // degrees
.velocityConversionFactor(360.0 / 17.77 / 60.0); // deg/sec
motorConfig.closedLoop
.feedbackSensor(FeedbackSensor.kPrimaryEncoder)
.p(0.4)
.outputRange(-1, 1);
motorConfig.closedLoop.maxMotion
.cruiseVelocity(1000)
.maxAcceleration(1000)
.allowedProfileError(1);
I'm getting oscillation at the setpoint. The same setup works fine with:
positionConversionFactor = 1 (default)
kPosition control instead of kMAXMotionPositionControl
I couldn't find any examples in REVLib-Examples or the 2025-REV-ION-FRC-Starter-Bot that use a custom positionConversionFactor with MAXMotion on the primary encoder.
What values should cruiseVelocity, maxAcceleration, allowedProfileError, and kP be when using a conversion factor like this?