View unanswered posts | View active topics It is currently Mon Sep 22, 2014 10:39 pm






Reply to topic  [ 4 posts ] 
Omni dtrectional drive system 
Author Message
Rookie

Joined: Fri Sep 25, 2009 11:31 pm
Posts: 2
Post Omni dtrectional drive system
We are a new team and are excited about the build and comeratery that is present in this group.

We are looking at using a 4 wheel omni drive system on our robot. We are looking for help or a sample code that can be used to start us out on this large but interesting task.

Any help or information will be greatly appriciated.


Fri Sep 25, 2009 11:44 pm
Profile
Moderator
Moderator
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3223
Location: Rotterdam, The Netherlands
Post Re: Omni dtrectional drive system
Gwinter,

It is really important you understand the underlying math of an omniwheeled system. It's not terribly complex but it really makes things easier. I have a somewhat working omniwheeled robot that I am working on at the moment. It uses 3 wheels instead of the 4 you want.

This is the code I have:
Code:
#define MAXMOTORSPEED 50

const float sqrt3div2 = 0.866025;

int round(float f)
{
  return (f>0)?(int)(f+0.5):(int)(f - 0.5);
}

void getMotorSpeeds(int &motorSpeedA, int &motorSpeedB, int &motorSpeedC, int angle, int Vb) {
  float Vw1, Vw2, Vw3, norm_factor;

  Vw1 = Vb*cosDegrees(angle);
  Vw2 = Vb*(-0.5*cosDegrees(angle) + sqrt3div2*sinDegrees(angle));
  Vw3 = Vb*(-0.5*cosDegrees(angle) - sqrt3div2*sinDegrees(angle));

  norm_factor = 1.0;

  if (Vw1 > MAXMOTORSPEED) {
    norm_factor = MAXMOTORSPEED / Vw1;
  } else if (Vw2 > MAXMOTORSPEED) {
    norm_factor = MAXMOTORSPEED / Vw2;
  } else if (Vw3 > MAXMOTORSPEED) {
    norm_factor = MAXMOTORSPEED / Vw3;
  }

  motorSpeedA = round(Vw1 * norm_factor);
  motorSpeedB = round(Vw2 * norm_factor);
  motorSpeedC = round(Vw3 * norm_factor);
}


For any given wheel, the speed it needs to turn at is :
Vw = Vb (cos Aw * cos At + sin Aw * sin At)

Vw = speed of the wheel
Vb = speed of the robot's body
Aw = the angle of the wheel on the body
At = the angle at which the body is travelling

So for a robot with 3 wheels (at 0, 120 and 240 degrees around the body), like my example, you get the following formulae:
Code:
Vw1 = Vb (cos   0 * cos At + sin   0 * sin At)
Vw2 = Vb (cos 120 * cos At + sin 120 * sin At)
Vw3 = Vb (cos 240 * cos At + sin 240 * sin At)


Sometimes a term will disappear from the calculations because it's 0, sometimes it's simplified because it's 1. You need to figure out what angles your wheels are at and create the formulae for your Vw1, Vw2, Vw3 and Vw4.

I am not going to give you the answers, you have all the information here for a robot with 3 and a generic formula.

You need to figure out why I have the following code:
Code:
  if (Vw1 > MAXMOTORSPEED) {
    norm_factor = MAXMOTORSPEED / Vw1;
  } else if (Vw2 > MAXMOTORSPEED) {
    norm_factor = MAXMOTORSPEED / Vw2;
  } else if (Vw3 > MAXMOTORSPEED) {
    norm_factor = MAXMOTORSPEED / Vw3;
  }


Good luck, if you have more questions, don't hesitate to ask, but don't ask me to write out the formulae for the 4 wheels, you should be able to do that yourself.

Regards,
Xander

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Sat Sep 26, 2009 2:03 am
Profile WWW
Rookie

Joined: Fri Sep 25, 2009 11:31 pm
Posts: 2
Post Re: Omni dtrectional drive system
I have figured out all the codes and the 4 wheel coding and alot of the formulas drop out with the use of the wheel angles. So it is simple. I am confused where the Vb and the Angle the body is traveling (At) comes from.

Are you using a gyro for input.

I have developed an array to draw the sine and cosine vales from vice using the nxt to calculate them each time. This should speed up the process.

I have also written a code for using joysticks to directly control the motors will this work in direct control modes.

gwinter


Wed Sep 30, 2009 10:38 am
Profile
Moderator
Moderator
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3223
Location: Rotterdam, The Netherlands
Post Re: Omni dtrectional drive system
gwinter wrote:
I have figured out all the codes and the 4 wheel coding and alot of the formulas drop out with the use of the wheel angles. So it is simple. I am confused where the Vb and the Angle the body is traveling (At) comes from.

Vb is the velocity of the body. A four wheeled omniwheel robot is much more efficient when it comes to translating the motor's movement to that of the body. At is the angle at which the body is travelling. You should check out http://nxtasy.org/2006/12/27/omni-teaches-physics/ for more info on the physics of this. Also be sure to read up on this http://technicbricks.blogspot.com/2008/ ... ns_29.html

Quote:
Are you using a gyro for input.

Nope, math is all I am using for now. I am planning to make it remote controllable (as well as autonomous) using the new HiTechnic IRReceiver sensor.

Regards,
Xander

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Wed Sep 30, 2009 12:08 pm
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 4 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.