|
Re: Kiwi Drive and Integrating PID Loops
For your first question, here's what my team's programmer wrote as the general form for calculating wheel speed in a holonomic drive. We used this last year on our robot. The actual code we used can be found here.
Quote:
I have an equation that should work to make a drivetrain move and turn about any centre of rotation with n wheels. It’s very long, but only needs xc, yc, vxc, vyc, ωc, xw, yw, and Θw, which can all be given or constant. c is the centre of rotation and w is the wheel.
pseudocode for each wheel:
double vtan = sqrt(pow((xc-x), 2)+pow((yc-y), 2))*ωc
double Θr = arctan((y-yc)/(x-xc))
double vwp = sqrt(pow(vtan*cos(Θr) + vxc, 2) + pow(vtan*sin(Θr) + vyc, 2))
double speed = vwp*cos(Θr - Θ)
|
Edit: also see Jared's more detailed description below.
For your second question, integration can be done in discrete timesteps (since the PID controller updates at some interval) and can be implemented without needing to know calculus:
Code:
At each iteration:
I += error/(time since last iteration)
Please let me know if you have further questions or don't understand something I wrote.
__________________
2012 Utah Regional Rookie All-Star
2013 Phoenix Regional Judge's Award for "design process and prototyping"
2014 Hub City Regional Quality Award, Arizona Regional Excellence in Engineering Award
2015 Arizona East Regional Creativity Award, Winner
2016 Arizona North Regional Finalist, Arizona West Excellence in Engineering Award, Finalist
Last edited by z_beeblebrox : 10-31-2015 at 05:55 PM.
|