Talon SRX Auto PID Issues

Hello CD,

This is a question from one of our students:

We are attempting to use Phoenix PID to control a six-wheel Talon SRX tank drive during Autonomous, and then use those same Talon SRXs as part of an open-loop drive during Teleop.

In Begin, we are opening our two master Talons and two follower Talons for each of those. We are initializing our drive using the Open2MotorDrive (Existing Motors) VI and setting the Refnum.


In Teleop, we are creating a directory of controller inputs connected to global variables, which we will reference in Periodic Tasks to control the majority of our robot functionality during the Teleop period. The wires are broken due to the snippet.


In Autonomous, the method we are currently experimenting with is using Phoenix Position Closed-Loop control to drive to setpoints. The first two while loops are clearing encoders and gyros.

​https://i.imgur.com/LaeulgE.png

The problem we are running into is that, during Auto, the Talons will constantly switch between positive throttle (due to the PID control) and neutral throttle. I believe this is because the Talons are simultaneously receiving commands from the Autonomous PID control and the RobotDrive which was initialized in Begin (which is receiving no inputs, causing the neutral throttle). We can diagram disable the RobotDrive initialization in Begin, causing the Auto to work without error. However, this will obviously ruin our Teleop code as we can no longer drive the robot.

The solutions we are currently exploring include:

-Switching from Phoenix PID to built-in Labview PID, using the Labview PID output to control the RobotDrive instead of individual Talons (I am hesitant to use this, as we would be putting a larger processing strain on our RIO and wasting the Talons’ capabilities. Is there any way to control the RobotDrive using the on-board Talon PID processing?).

-Switching the Talon neutral mode to coast so that the motors will be able to successfully drive to their position despite the stuttering (although this is pretty effective, it is also avoiding the problem).

-Initializing the RobotDrive in Teleop instead of Begin, so that the Talons will not be able to receive the neutral RobotDrive commands during Auto.

-Finding some way to run individual Talons after the RobotDrive has been initialized without the two commands conflicting.

So, the big question here is: How do we use a Talon SRX’s PID control features in AUTO while it is tied to a Robot Drive in teleop?

We know that there has got be a way for this to work, but we are not seeing it right now. Can anyone provide any assistance on how we should set up these commands in LabView so that our system will work correctly?

You did not show your periodic tasks, but you need to wrap the drive command stuff in a conditional that does not use those globals if you are in autonomous.

Yep, it seems as if you are calling the Talons in two places at once-Periodic Tasks & Autonomous.

The advantage of calling drive code in only Autonomous or Teleop is that they never run at the same time to conflict with one another.