Go to Post I think that this clearly indicates that 2017 will be the year we finally see 3.63 robots per alliance. - Caleb Sykes [more]
Home
Go Back   Chief Delphi > Technical > Programming > NI LabVIEW
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rating: Thread Rating: 3 votes, 5.00 average. Display Modes
  #1   Spotlight this post!  
Unread 25-06-2015, 00:25
tdbroun tdbroun is offline
Registered User
AKA: Tim Brounscheidel
FRC #1507 (Warlocks)
Team Role: Mentor
 
Join Date: May 2013
Rookie Year: 2013
Location: Lockport NY
Posts: 16
tdbroun is an unknown quantity at this point
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]
Reply With Quote
  #2   Spotlight this post!  
Unread 25-06-2015, 10:25
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,100
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
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.


Reply With Quote
  #3   Spotlight this post!  
Unread 25-06-2015, 10:27
GeeTwo's Avatar
GeeTwo GeeTwo is offline
Technical Director
AKA: Gus Michel II
FRC #3946 (Tiger Robotics)
Team Role: Mentor
 
Join Date: Jan 2014
Rookie Year: 2013
Location: Slidell, LA
Posts: 3,659
GeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond repute
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.
__________________

If you can't find time to do it right, how are you going to find time to do it over?
If you don't pass it on, it never happened.
Robots are great, but inspiration is the reason we're here.
Friends don't let friends use master links.
Reply With Quote
  #4   Spotlight this post!  
Unread 25-06-2015, 10:35
GeeTwo's Avatar
GeeTwo GeeTwo is offline
Technical Director
AKA: Gus Michel II
FRC #3946 (Tiger Robotics)
Team Role: Mentor
 
Join Date: Jan 2014
Rookie Year: 2013
Location: Slidell, LA
Posts: 3,659
GeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond repute
Re: Using PID on Talon SRX with Gyro for feedback

(Emphasis mine)
Quote:
Originally Posted by tdbroun View Post
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).
Quote:
Originally Posted by Ether View Post
.. separate left/right closed-loop distance controllers.
.. 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.
Ether, I think you missed the word "internal", unless you were thinking about four separate talons and four separate motors and "summing" the results in a couple of gearboxes.
__________________

If you can't find time to do it right, how are you going to find time to do it over?
If you don't pass it on, it never happened.
Robots are great, but inspiration is the reason we're here.
Friends don't let friends use master links.
Reply With Quote
  #5   Spotlight this post!  
Unread 25-06-2015, 11:21
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,100
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Using PID on Talon SRX with Gyro for feedback

Quote:
Originally Posted by GeeTwo View Post
Ether, I think you missed the word "internal"
I should have been clearer. I was suggesting an approach different from what the OP was considering. Thanks for the clarification.


Reply With Quote
  #6   Spotlight this post!  
Unread 25-06-2015, 11:24
Jared Russell's Avatar
Jared Russell Jared Russell is offline
Taking a year (mostly) off
FRC #0254 (The Cheesy Poofs), FRC #0341 (Miss Daisy)
Team Role: Engineer
 
Join Date: Nov 2002
Rookie Year: 2001
Location: San Francisco, CA
Posts: 3,078
Jared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond repute
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.
Reply With Quote
  #7   Spotlight this post!  
Unread 25-06-2015, 11:26
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,100
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Using PID on Talon SRX with Gyro for feedback

Quote:
Originally Posted by GeeTwo View Post
gyroscopes don't give you an output of what direction you're heading, but what your rate of rotation is.
True, but the WPILib Gyro class uses the FPGA to integrate the gyro's rate to give the robot's angular orientation... which is used by many teams for field-centric control and driving straight.

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.
 */
Reply With Quote
  #8   Spotlight this post!  
Unread 25-06-2015, 12:41
GeeTwo's Avatar
GeeTwo GeeTwo is offline
Technical Director
AKA: Gus Michel II
FRC #3946 (Tiger Robotics)
Team Role: Mentor
 
Join Date: Jan 2014
Rookie Year: 2013
Location: Slidell, LA
Posts: 3,659
GeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond repute
Re: Using PID on Talon SRX with Gyro for feedback

Quote:
Originally Posted by Ether View Post
True, but the WPILib Gyro class uses the FPGA to integrate the gyro's rate to give the robot's angular orientation... which is used by many teams for field-centric control and driving straight.
I was focusing on the feasibility of using the internal SRX controls (or rather lack thereof).

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.
__________________

If you can't find time to do it right, how are you going to find time to do it over?
If you don't pass it on, it never happened.
Robots are great, but inspiration is the reason we're here.
Friends don't let friends use master links.
Reply With Quote
  #9   Spotlight this post!  
Unread 25-06-2015, 14:56
tdbroun tdbroun is offline
Registered User
AKA: Tim Brounscheidel
FRC #1507 (Warlocks)
Team Role: Mentor
 
Join Date: May 2013
Rookie Year: 2013
Location: Lockport NY
Posts: 16
tdbroun is an unknown quantity at this point
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...
Reply With Quote
  #10   Spotlight this post!  
Unread 25-06-2015, 15:20
GeeTwo's Avatar
GeeTwo GeeTwo is offline
Technical Director
AKA: Gus Michel II
FRC #3946 (Tiger Robotics)
Team Role: Mentor
 
Join Date: Jan 2014
Rookie Year: 2013
Location: Slidell, LA
Posts: 3,659
GeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond repute
Re: Using PID on Talon SRX with Gyro for feedback

Quote:
Originally Posted by tdbroun View Post
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...
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.
__________________

If you can't find time to do it right, how are you going to find time to do it over?
If you don't pass it on, it never happened.
Robots are great, but inspiration is the reason we're here.
Friends don't let friends use master links.
Reply With Quote
  #11   Spotlight this post!  
Unread 25-06-2015, 15:53
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,100
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Using PID on Talon SRX with Gyro for feedback

Quote:
Originally Posted by GeeTwo View Post
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.
Or better yet, you could create a sinusoidal accel profile and do this for each side.


Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 21:32.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi