Go to Post What is it about inefficient design and operation that either pushes the envelope or deserves to be awarded? - Madison [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rating: Thread Rating: 4 votes, 4.75 average. Display Modes
Prev Previous Post   Next Post Next
  #4   Spotlight this post!  
Unread 01-10-2011, 08:33 PM
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,002
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Mechanum wheel programming in C++

Quote:
Originally Posted by johncap100 View Post
my understand is that we need to specify each motor/wheel assembly , ie all four individually as each wheel is connected indepedently to a single motor.

so then do we use the above statements for each motor/wheel assembly?

thanks

have you actually written some code just to move the bot with mechanum wheels?

You take the commands from the joysticks and you process them (it's called inverse kinematics) to create the 4 wheel speeds.

The drive interface could be a single 3-axis joystick, or two 2-axis joysticks, or any other input device(s).

Mecanum has three completely independent degrees of freedom:

fore/aft
strafe (right/left)
rotate (turn, yaw)

A mecanum vehicle can perform all three of these motions simultaneously.


Here's some reference C code for you:

Code:
// 3-axis joystick interface to a mecanum drive

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

forward = -Y;
right = X;
clockwise = Z;

// put any drivability adjustments here for forward, right, and clockwise,
// for example gain, deadband, etc:

// if rotate gain is too hot, tweak it down:

clockwise /= 2;  

// add deadband so you don't get strafe when you don't want it:

if ((right>-0.1)&&(right<0.1)) right = 0; 


// now apply the inverse kinematic tranformation:

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


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

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

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
Questions? Fire away.


Reply With Quote
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 10:20 AM.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


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