|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
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? |
|
#2
|
||||
|
||||
|
Re: Mecanum Problems
Quote:
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
|
|
#3
|
||||
|
||||
|
Re: Mecanum Problems
Quote:
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). |
|
#4
|
||||
|
||||
|
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 |
|
#5
|
||||
|
||||
|
Re: Mecanum Problems
Quote:
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. |
|
#6
|
||||
|
||||
|
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 |
|
#7
|
||||
|
||||
|
Re: Mecanum Problems
Quote:
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? |
|
#8
|
||||
|
||||
|
Re: Mecanum Problems
yes
|
|
#9
|
|||||
|
|||||
|
Re: Mecanum Problems
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.
|
|
#10
|
||||
|
||||
|
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.
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|