|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools |
Rating:
|
Display Modes |
|
|
|
#1
|
||||
|
||||
|
Re: Using PID on Talon SRX with Gyro for feedback
Quote:
Code:
/** * Use a rate gyro to return the robots heading relative to a starting position. * The Gyro class tracks the robots heading based on the starting position. As * the robot rotates the new heading is computed by integrating the rate of * rotation returned by the sensor. When the class is instantiated, it does a * short calibration routine where it samples the gyro while at rest to * determine the default offset. This is subtracted from each sample to * determine the heading. */ |
|
#2
|
|||||
|
|||||
|
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. |
|
#3
|
|||
|
|||
|
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...
|
|
#4
|
|||||
|
|||||
|
Re: Using PID on Talon SRX with Gyro for feedback
If you're looking for an autonomous solution (that is, a few seconds worth), the SRX internals can be the solution, just not with a gyroscope. Put encoders on both gearboxes, and give them controls to drive at the same speed for the same duration, or to both drive to the same position (that is, the same number of encoder clicks). The first might result in you not pointing the correct direction at the end, and the second might result in a curvature that's corrected at the end. You could probably combine the two (start out with speed, and switch to position when you're about 3/4 of the way there) to get the best of both. If you calculate how many "excess clicks" correspond to a turn of a given angle, you can even use this to follow a more complex path.
|
|
#5
|
||||
|
||||
|
Re: Using PID on Talon SRX with Gyro for feedback
Quote:
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|