Help with TrajectoryLib


Based on Team 254’s TrajectoryLib, can somebody explain how I can find the kTurn, kA, and kV values? Additionally, what do these values represent and control?

Thank you,

See the presentation that 254 gave at the 2015 Championships Conference (relevant part)

Could you explain how to find kTurn and what it represents and controls. I could not find kTurn in 254’s presentation.

Thank you for your help,

kTurn is multiplied by the heading error (difference between current heading and desired heading of the trajectory segment) and added/subtracted to the left and right outputs, respectively. This helps the robot stay facing the right heading while it follows the trajectory. Another way to think about it is the P constant of a PID controller for the heading with I=0, D=0.

This the code that implements this behavior.

kTurn was the P gain for a controller which tried to keep the robot’s heading (measured by a gyro) on course with where it currently was in a pre computed 2d trajectory. I’d tune this by writing some code that tries to get your robot to turn 45 degrees in place and picking a gain that gets close the robot to the target with minimal overshoot. If you run the full controller and bot starts to wander off course and can’t make harder turns, increase the gain. If you see oscillation, decrease the gain. If your drivetrain is relatively well balanced efficiency wise, you just need to be in the right ballpark.

Do you need 2d trajectories for your task?

Thank you for your help. We do require 2d trajectories for our task.

Not that I’m using 2D trajectories, but in what cases would you use them? When did you guys use them?

We are using them to drive in autonomous - we initially did not have vision tracking and used them to drive up to the batter and shoot in autonomous. Well, in theory we did. We didn’t have much time to test it and were never confident enough to run it in a real match.

We also just thought it was interesting and it was definitely a fun exercise to try and understand TrajectoryLib.