Go to Post Tom didn't need the t-shirt to tell us [that he is a NERD] :D - Peter Matteson [more]
Home
Go Back   Chief Delphi > Technical > Programming > NI LabVIEW
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 15-01-2011, 12:47
captainking's Avatar
captainking captainking is offline
Level 85 Programmer
FRC #0168 (MIB)
Team Role: Programmer
 
Join Date: Dec 2007
Rookie Year: 2007
Location: North Miami Beach
Posts: 41
captainking is an unknown quantity at this point
Mecanum Problems

Hey guys, we're trying to program mecanum this year using the polar form but we're having some troubles.

For magnitude we are taking the x and y values of the joystick and using the pythagorean theorem

For direction we are taking the y value and dividing by the x value, taking the arctangent, and then multiplying by 180/pi in order to get the answer in degrees.

for rotation we are using the rotation axis off of our 3 axis controller.



For some reason, when we enable the robot, the motors all recieve full forward PWM values without us touching the controller.

We've checked the wiring and it's fine, and the only thing affecting the motors is the holonomic drive function.

Any ideas?
__________________
Integrity first
Service before self
Excellence in all we do
Reply With Quote
  #2   Spotlight this post!  
Unread 15-01-2011, 13:03
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,065
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: Mecanum Problems

Quote:
Originally Posted by captainking View Post
Hey guys, we're trying to program mecanum this year using the polar form but we're having some troubles.

For magnitude we are taking the x and y values of the joystick and using the pythagorean theorem

For direction we are taking the y value and dividing by the x value, taking the arctangent, and then multiplying by 180/pi in order to get the answer in degrees.

for rotation we are using the rotation axis off of our 3 axis controller.



For some reason, when we enable the robot, the motors all recieve full forward PWM values without us touching the controller.

We've checked the wiring and it's fine, and the only thing affecting the motors is the holonomic drive function.

Any ideas?
When X is zero, are you dividing by zero? This may not be the cause of the problem you described, but you should look into it.

Dividing Y by X and taking the arctangent isn't going to give the right answer in all quadrants. Try it in an Excel spreadsheet and see what I mean.

Why are you using the polar form? If you are using a 3-axis joystick and LabVIEW, just feed the 3 axis values directly into the cartesian form. No math required.

If you want to code it yourself in a text language, here's some reference code:

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


// 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



Reply With Quote
  #3   Spotlight this post!  
Unread 15-01-2011, 13:06
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,065
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: Mecanum Problems

Quote:
Originally Posted by captainking View Post
For some reason, when we enable the robot, the motors all recieve full forward PWM values without us touching the controller.

We've checked the wiring and it's fine, and the only thing affecting the motors is the holonomic drive function.

Any ideas?
Yes. First check the hardware to make sure it is working properly.

Load the default 4-motor tank drive code that came with the Framework, and test your robot with that, with the robot on blocks so you can observe the wheels.

Once you've got that working properly, THEN load your mecanum code and debug it (see my previous post).


Reply With Quote
  #4   Spotlight this post!  
Unread 15-01-2011, 13:11
captainking's Avatar
captainking captainking is offline
Level 85 Programmer
FRC #0168 (MIB)
Team Role: Programmer
 
Join Date: Dec 2007
Rookie Year: 2007
Location: North Miami Beach
Posts: 41
captainking is an unknown quantity at this point
Re: Mecanum Problems

As for why we are using polar: we had to reset the gyro whenever we wanted to reorient the robot

As for the robot moving by itself: in tank mode it works fine, it's only with holonomic polar that it's moving on it's own
__________________
Integrity first
Service before self
Excellence in all we do
Reply With Quote
  #5   Spotlight this post!  
Unread 15-01-2011, 13:20
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,065
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: Mecanum Problems

Quote:
Originally Posted by captainking View Post
As for why we are using polar: we had to reset the gyro whenever we wanted to reorient the robot
I think you are making this harder than it has to be.

What language are you using?

In LabVIEW, you don't have to use the polar form to use the gyro. You can use the gyro with the Cartesian form too. See attachment.


Attached Thumbnails
Click image for larger version

Name:	mec cartesian.png
Views:	79
Size:	39.9 KB
ID:	9692  
Reply With Quote
  #6   Spotlight this post!  
Unread 15-01-2011, 13:22
captainking's Avatar
captainking captainking is offline
Level 85 Programmer
FRC #0168 (MIB)
Team Role: Programmer
 
Join Date: Dec 2007
Rookie Year: 2007
Location: North Miami Beach
Posts: 41
captainking is an unknown quantity at this point
Re: Mecanum Problems

I know, we used cartesian last year but we had to keep zeroing the gyro

I want to use polar so we don't have to deal with the gyro
__________________
Integrity first
Service before self
Excellence in all we do
Reply With Quote
  #7   Spotlight this post!  
Unread 15-01-2011, 13:36
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,065
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: Mecanum Problems

Quote:
Originally Posted by captainking View Post
I know, we used cartesian last year but we had to keep zeroing the gyro
What I hear you saying is this:

1) last year, you had a mecanum drive

2) you used the LabVIEW holonomic Cartesian vi

3) you used a 3-axis joystick

4) you connected (Y, X, Z, and gyro) to (Y, X, rotate, and gyro) on the Cartesion vi

5) the gyro kept losing calibration

6) you think that switching to the polar form of the vi will solve your problem.


Is the above accurate?



Reply With Quote
  #8   Spotlight this post!  
Unread 15-01-2011, 14:45
captainking's Avatar
captainking captainking is offline
Level 85 Programmer
FRC #0168 (MIB)
Team Role: Programmer
 
Join Date: Dec 2007
Rookie Year: 2007
Location: North Miami Beach
Posts: 41
captainking is an unknown quantity at this point
Re: Mecanum Problems

yes
__________________
Integrity first
Service before self
Excellence in all we do
Reply With Quote
  #9   Spotlight this post!  
Unread 16-01-2011, 20:26
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,112
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Mecanum Problems

Quote:
Originally Posted by captainking View Post
I want to use polar so we don't have to deal with the gyro
I don't understand what you mean. Do you want to use a gyro and "just have it work", or do you not want to use a gyro at all? There's no connection I can think of between using a gyro and the choice of polar vs. cartesian mecanum drive control.
Reply With Quote
  #10   Spotlight this post!  
Unread 17-01-2011, 00:11
RoboMaster's Avatar
RoboMaster RoboMaster is offline
Alum, former programmer&co-captain
FRC #2472 (The Centurions)
Team Role: Mentor
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Minnesota, Twin Cities
Posts: 268
RoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant future
Re: Mecanum Problems

If you don't want to use the gyro at all, you can wire (LabVIEW) a zero constant to gyro on the holonomic VI. It will then drive normally without any respect to the gyro/field orientation, just like simple tank/arcade/etc. drive. I found this by looking at the help page for that VI.
__________________
My engineering blog: noeticbrainwaves.blogspot.com

I'm not slacking, my code's compiling
...and I'm using LabVIEW
Reply With Quote
Reply


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:14.

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