![]() |
Using PID on Talon SRX with Gyro for feedback
We are looking at off season activities and wanted to explore using the Talon SRX controller's internal PID capabilities on our drive system to drive both to a fixed distance (using a quadrature encoder) and in a straight line (using a gyro).
I'm not sure if this is possible; I'm looking for a sanity check on the concept. We have a tank drive six wheel drop center drive system. The thought was to wire the encoder to the left side Talon SRX, and use positional PID to control this side. We'd tune our PID with the right Talon slaved to the left. After tuning, the right Talon SRX would get attached to the Gyro, using the analog connection, just like wiring a potentiometer. We would read the current setting of the gyro before moving, and send that as the positional PID target for the right side. The thought is that as the left side starts to move, the right side will detect a direction change and speed up to correct. I know that this will require a great deal of tuning to get correct. What I don't know is if it is technically possible. Also, I know that in Labview there are a number of VI's that are used to get data from and to control the gyro. I believe that these expect the gyro to be attached to an analog port on the roborio. If the gyro is attached to the Talon SRX, I would assume that I can no longer use these VI's to get an angle, pitch, or yawl, or reset the angle to zero. That would be a major drawback to this approach, as we would no longer be able to say, turn 90 degrees in place. I suppose an alternative might be to put another gyro on an analog roborio port and use percent Vbus mode on the talons to turn that way. Has anyone done this type of control? or see reasons why it just plain won't work? We have code to do this without PID using victors or the old talons, but want to take advantage of the processing power in the new controllers. We used the PID capabilities of the Talon SRX on this past years robot, so we are familiar with CAN, the break out board, etc...[/size] |
Re: Using PID on Talon SRX with Gyro for feedback
Put an encoder on each side (left and right). Average the left and right encoder counts and use that as the process variable for separate left/right closed-loop distance controllers. Use your gyro reading to keep the vehicle driving straight. Use the gyro reading as the process variable for separate left/right closed-loop orientation controllers. Sum the left (and right) distance and orientation controller outputs and use that sum as the command for the left (and right) wheels. |
Re: Using PID on Talon SRX with Gyro for feedback
Using a gyroscope to drive straight inherently requires driving two motors differently based on a single input. The SRX controls seem to be aimed at controlling a single motor - or a second motor the same way using slaving.
Also, gyroscopes don't give you an output of what direction you're heading, but what your rate of rotation is. If you tried something like driving the left wheel to some specified number of RPM, and driving your right wheel until the gyroscope rotation rate was zero, you would probably end up on something pretty close to a straight line, but it wouldn't be any particular line; I expect that your heading would have changed significantly as you came up to speed. |
Re: Using PID on Talon SRX with Gyro for feedback
(Emphasis mine)
Quote:
Quote:
|
Re: Using PID on Talon SRX with Gyro for feedback
Quote:
|
Re: Using PID on Talon SRX with Gyro for feedback
For single-input, single-output control, I think the Talon SRX is a good candidate to do all of the work for you.
For multi-input, multi-output control, you are better off having a high level controller running on the RoboRIO that sends lower level commands to the Talons. |
Re: Using PID on Talon SRX with Gyro for feedback
Quote:
Code:
/** |
Re: Using PID on Talon SRX with Gyro for feedback
Quote:
I absolutely agree that once you bring the roboRIO or other external processor and a programming library into the mix, it becomes much more straightforward. Once we installed a working gyroscope, we were able to get our 2014 mecanum robot smoothly driving in field coordinates in a couple of hours. Driving a tank in a straight line should be about the same level of difficulty. |
Re: Using PID on Talon SRX with Gyro for feedback
Thank you for your replies. I didn't know that the gyro signal was not a directional heading. Without that, I don't see how what I proposed could be feasible. We'll continue with our tried and true code to drive straight for a specific distance...
|
Re: Using PID on Talon SRX with Gyro for feedback
Quote:
|
Re: Using PID on Talon SRX with Gyro for feedback
Quote:
|
| All times are GMT -5. The time now is 10:29. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi