Magic Motion with aux gyro not driving motors

Has anyone successfully run the CTRE magic motion mode with an auxiliary PID using a gyro to maintain heading?

I was able to successfully run Magic Motion without the auxiliary PID, but when I add the aux PID I get no motor response. I used getClosedLoopError() and getClosedLoopTarget() to check the target value and error. The target value is correct, but the error is always zero even when the encoder readings clearly show the error is not zero.

I went back to the CTRE example code
and ran their MotionMagic_AuxStraightPigeon example. I got the same results - no motor response.

However, when I make the following change to the CTRE code:

_rightMaster.set(ControlMode.MotionMagic, target_sensorUnits, DemandType.AuxPID, target_turn);
_leftMaster.follow(_rightMaster, FollowerType.AuxOutput1);


_rightMaster.set(ControlMode.MotionMagic, target_sensorUnits);

then I get the expected Magic Motion response from the motors.

There are only 2 differences difference between the CTRE version on GIthub and my code . I have the pigeon plugged into the Talon via ribbon cable. I confirmed I am getting a valid angle reading from the gyro. It is defines as follows:
PigeonIMU _pidgey = new PigeonIMU(_rightMaster);

Also, there is a second following motor on each side:

TalonSRX fl = new TalonSRX(1);
TalonSRX fr = new TalonSRX(3);


Does anyone have any suggestions?

A commonly missed item with the motion magic aux example is the Remote Sensor Source.
There are two sets of sources for Pigeon, Pigeon over Ribbon Cable and Pigeon over CAN.
The example uses Pigeon over CAN, seen here, so I suspect your main issue is that you’re using the incorrect source.

If you take a self-test snapshot of the Talon while enabled, I would expect the Remote LOS (Loss of Sensor) fault to be tripped, indicating the Talon doesn’t detect its remote sensor. This is a good debugging tool if a Phoenix Tuner capable device isn’t doing what you expect it to.

If you’re still having issues, post the snapshot while the Talon is misbehaving and that will help with diagnosing the issue.

That was the problem - thank you !!!

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.