Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Holonomic Control System (http://www.chiefdelphi.com/forums/showthread.php?t=89198)

Ether 16-01-2011 12:18

Re: Holonomic Control System
 
Quote:

Originally Posted by SudoSammich (Post 1001009)
I didn't set out to re-invent the wheel, but it came to that after a small series of events. Basically, our cRio is stuck on last year's bot, so we're using the '07 robot controller and player station mounted to a piece of plywood. As such, I'm writing in C, not LabVIEW (our normal programming language at this point is Java anyway, but I assume there's a class for that as well). And I'm sure it's capable of two dimensional movement while spinning, I just haven't put forth the energy into performing those calculations yet. Good to know that there's a class waiting for me when we transition to this year's real bot though.

Hey, if you'd mentioned that earlier, I would have posted this for you:

Code:

// 3-axis joystick interface to an omni drive
// with robot-centric driver interface


// first define your driver interface,
// in this case a 3-axis joystick:


forward = -Y;  // push joystick forward to go forward
right = X;      // push joystick to the right to strafe right
clockwise = Z;  // twist joystick clockwise turn clockwise


// here is where you would put any special shaping of the joystick
// response curve, such as deadband or gain adjustment


// now apply the inverse kinematic tranformation
// to convert your vehicle motion command
// to 4 wheel speed commands:

front_left = forward + clockwise + right;
front_right = forward - clockwise - right;
rear_left = forward + clockwise - right;
rear_right = forward - clockwise + right;


// finally, normalize the wheel speed commands
// so that no wheel speed command exceeds magnitude of 1:

max = abs(front_left);
if (abs(front_right)>max) max = abs(front_right);
if (abs(rear_left)>max) max=abs(rear_left);
if (abs(rear_right)>max) max=abs(rear_right);

if (max>1)
  {front_left/=max; front_right/=max; rear_left/=max; rear_right/=max;}


// you're done. send these four wheel commands to their respective wheels

... it's C code for fully holonomic operation of your omni bot.


If you want to add the gyro angle for field-centric control, it only adds a small amount of complexity:

Code:

// 3-axis joystick interface to an omni drive
// with gyro (field-centric driver interface)


// first define your driver interface,
// in this case a 3-axis joystick:


forward = -Y;  // push joystick forward to go forward
right = X;      // push joystick to the right to strafe right
clockwise = Z;  // twist joystick clockwise turn clockwise


// here is where you would put any special shaping of the joystick
// response curve, such as deadband or gain adjustment


// use the gyro angle for field-centric control
// "theta" is the gyro angle, measured CCW from the zero reference

forward' = forward*cos(theta) - right*sin(theta);

right' = forward*sin(theta) + right*cos(theta);


// now apply the inverse kinematic tranformation
// to convert your vehicle motion command
// to 4 wheel speed commands:

front_left = forward' + clockwise + right';
front_right = forward' - clockwise - right';
rear_left = forward' + clockwise - right';
rear_right = forward' - clockwise + right';


// finally, normalize the wheel speed commands
// so that no wheel speed command exceeds magnitude of 1:

max = abs(front_left);
if (abs(front_right)>max) max = abs(front_right);
if (abs(rear_left)>max) max=abs(rear_left);
if (abs(rear_right)>max) max=abs(rear_right);

if (max>1)
  {front_left/=max; front_right/=max; rear_left/=max; rear_right/=max;}


// you're done. send these four wheel commands to their respective wheels



Chris_Elston 16-01-2011 13:42

Re: Holonomic Control System
 
Last year we did a kiwi drive. In order to understand the MATH behind the drive system, we did some research first, and found this whitepaper.

http://www.frcsoft.com/forums/index....ads&showcat=29

Hopefully, you'll see some value to this as well as we did. We also upload and share all of our robot code on frcsoft.com as well.

Good luck this season.
Chris


All times are GMT -5. The time now is 23:38.

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