Talon FX Intermittent Functionality in Python

Thought I would do an FYI post for those trying to get things done and working early.

Over the weekend I spent an entire day trying to get some basic code running with a drivetrain of TalonFX controlled falcons and a couple of 775 driven by Talon SRX controllers.

The results of the weekend were that the Talon SRX motors wouldn’t spin at all, and the Talon FX controlled motors would sort of work.

I did some differential testing and figured out it had nothing to do with the Command framework, which was good news.

The Talon SRX problems were fixed with upgrading the robotpy-ctre version as recommended here yesterday.

The Talon FX and Phoenix 6 problems persisted though, until I realized something that was different from the simulator and the robot I was testing on. The code I deployed was written for our normal/future chassis which is a 4-motor drivetrain.

The robot I was testing on only has 1 motor on each gearbox side. So the two talonfx set for follower modes were not present on the CAN bus,. There were no errors, or anything output that would suggest a problem however those silent errors seem to be the source of the inconsistent motor actuation.

In Phoenix 5 and in years past, this type of configuration would still function without problems, it would just spew CAN frame too stale errors to the console. In this setup, there were no errors, but it definitely will not work. So, teams can just do a better job of conditionally wrapping motor instantiation and configuration, or just don’t do what I did which has non-existent motors set as followers.

What did the code look like? Did you just create the objects with invalid CAN ID and didn’t get an error?

Drivetrain.py file in our repo.

self._left_leader = TalonFX(constants.DT_LEFT_LEADER)
        self._left_follower = TalonFX(constants.DT_LEFT_FOLLOWER)
        self._right_leader = TalonFX(constants.DT_RIGHT_LEADER)
        self._right_follower = TalonFX(constants.DT_LEFT_FOLLOWER)
....

        self._left_follower.set_control(Follower(self._left_leader.device_id, False))
        self._right_follower.set_control(Follower(self._right_leader.device_id, False))

Setting them as a non-strict follower (or whatever the CTRE docs call them) and letting them be. No other configuration on the status signals or anything.

Edit to add:
Specifically, we use CAN IDs 1, 2, 3, 4 for the drivetrain. On the physical robot, there is only CAN IDs 1 and 2 (for left and right respectively); 3 and 4 don’t exist as actual devices on the CAN bus.