Found an issue with the Phenoix follower. When using PercentOutput on the SRX, the Spark MAX follows fine. However, as soon as we change to a different control mode (we tested Motion Magic and Position control), the Spark MAX no longer follows properly, despite the SRX giving the correct output. We observed that although the SRX would stop the motor once the mechanism reached the Motion magic setpoint, the NEO would continue running at a constant speed.
As such, instead of using the REV follower commands, we did the following:
- Set Spark MAX voltage compensation to 12
- Pull output voltage from SRX and divide by 12 to make the output range go on a scale of -1 to 1
- Use the .set method to set the Spark MAX to output the adjusted SRX voltage output
- Put the above code in a notifier running at 10ms (main runs at 20ms)
The above method also works for getMotorOutputPercent instead of getMotorOutputVoltage if you want to go that path. The important thin gis to put the code in a notifier or there will be noticable lag when running the SRX in closed loop.
For the above code, run once it once in init to start the notifier thread.