View Single Post
  #23   Spotlight this post!  
Unread 29-09-2016, 11:51
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,077
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: Tuning PID Constants Over a Range

Quote:
Originally Posted by Andrew Schreiber View Post
So run a traditional PID control loop with the Gyro as the input and a fake output that sends a target velocity to the velocity PID on the talons?
Yeah, use one controller with gyro angle as the process variable to track a desired heading profile. The output of this loop is a desired angular velocity. You can then use an inverse kinematics equation* to map angular velocity to drive motor velocities, and use these as velocity setpoints for the Talon SRX.

* For differentially steered robots, this equation looks something like:
Code:
drive_wheel_linear_velocity = wheelbase_width_meters * desired_turning_rate_rads_per_second / 2
left_motor_desired_linear_velocity = -drive_wheel_linear_velocity
right_motor_desired_linear_velocity = +drive_wheel_linear_velocity
(you can also multiply the right side of the equation above by a corrective factor that you tune to account for losses due to skidding; ours was ~2 with 8 low pressure pneumatic wheels this year. You don't have to be super precise on this, as the gyro PID controller will correct for error, but better to be more accurate than not)

To tune this, start with the Talon SRX velocity loop and work backwards. Make sure you can accurately track a variety of speeds (both fast and slow) in straight line, turn in place, and arcing motions. We were able to find that one set of gains did a good job in all of these cases, but YMMV. Once you can accurately track your velocity commands, tune your kinematics by adjusting the equation's corrective factor while turning in place (ex. command each side of the drive to go +/- a couple feet per second and measure the actual turning rate with the gyro...repeat and find the best fit for your model). Finally, you can then tune the gyro PID loop (which will be really easy, likely P-only, because of the fast velocity loop underneath).

Last edited by Jared Russell : 29-09-2016 at 11:58.
Reply With Quote