Pigeon/differential drive plus motion-magic/motion-profile(arc) documentation
ozrien opened this issue · 1 comments
Teams seem to have trouble connecting the relevant documentation in the software reference manual to the source examples covering the aux-closed-loop/Pigeon-integration features for differential drive-trains.
Overall
The general goal is to servo robot heading concurrently with robot distance/velocity.
This is generally done by...
- Select a sensor source for PID[0] that measures the robot distance traveled.
- Select a sensor source for PID[1] for robot heading.
- Turn on the aux PID[1] in a single (right-side) Talon.
- Setup the "other-side" Talon as the aux follower (not percent output follower).
Robot distance traveled is generally best measured as the sum/average of the left and right side encoder. The firmware features "remote sensor" and "sensor sum" features can be used to accomplish this automatically.
The robot heading can be measured via a Pigeon-IMU or the sensor-difference of right-minus-left. Both can be accomplished with the firmware features "remote sensor" and possibly "sensor-difference".
With these two sensor sources selected, a master (right) Talon can calculate PIDF[0] + PIDF[1] for the right side and PIDF[0] - PIDF[1] for the left side. This is done automatically if auxiliary closed-loop is enabled. The left Talon would then be setup as an auxiliary follower, which applies the latter expression.
Additional MCs on CAN bus can be setup as simple percent output followers.
For differential drive-trains that use Pigeon-IMU or right-encoder-minus-left-encoder for heading measurement, the following Talon SRX/Victor SPX features are relevant for heading-controlled movement...
Remote Sensor
Setting up a Talon/Victor to measure a sensor value from a Pigeon or another CTRE CAN motor controller.
This is covered in section 9.8 of the Talon SRX / Victor SPX Software reference manual.
Sensor Sum/Sensor Difference
Setting up a Talon/Victor to calculate the sum or difference to derive robot-position/robot-heading where applicable.
This is covered in section 9.9 of the Talon SRX / Victor SPX Software reference manual.
Auxiliary closed-loop
This allows for simultaneous closed-looping of distance/heading using...
- Percent output + Auxiliary Closed-Loop (with heading being closed-loop to maintain heading)
- Position Closed-Loop + Auxiliary Closed-Loop (robot distance + heading)
- Velocity Closed-Loop + Auxiliary Closed-Loop (robot velocity + heading)
- Motion Magic + Auxiliary Closed-Loop (trapezoidal-profiled robot position + heading)
- Motion Profile Arc (Same as Motion Profile + PID[1] is typically used for heading)
This is covered in section 9.10 of the Talon SRX / Victor SPX Software reference manual.
Examples
Examples for everything above is under the Remote Closed Loop examples...
Typical differential drivetrain setup
Talon SRX / Victor SPX Software Reference
Talon SRX / Victor SPX Software Reference can be found on documentation repos and product web-page.
Closing as this is now documented in this repo.
https://phoenix-documentation.readthedocs.io/en/latest/ch14a_BringUpRemoteSensors.html
https://phoenix-documentation.readthedocs.io/en/latest/ch14b_BringUpDifferentialSensors.html
https://phoenix-documentation.readthedocs.io/en/latest/ch16_ClosedLoop.html#auxiliary-closed-loop-pid-1-walkthrough
https://phoenix-documentation.readthedocs.io/en/latest/ch16_ClosedLoop.html#motion-profiling-closed-loop
https://phoenix-documentation.readthedocs.io/en/latest/ch16_ClosedLoop.html#motion-profiling-arc-closed-loop