Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   C/C++ (http://www.chiefdelphi.com/forums/forumdisplay.php?f=183)
-   -   Mecanum Code weird bug need help (http://www.chiefdelphi.com/forums/showthread.php?t=104575)

Nathan Powell 13-03-2012 14:04

Mecanum Code weird bug need help
 
1 Attachment(s)
Using Windriver C++
4 wheel drive mecanum
Jaguars motor controllers (calibrated manually)
PWM
Logitech Extreme 3D Joystick

All electrical has been checked and while there is no such thing as an absolute appears to be wired accurately
We have reimaged the cRio to ensure we do not have garbage code randomly running

Using the mecanum base code provided by FIRST
Behavior we are seeing:

forward works as expected
reverse works as expected
strafe works as expected
Turning either direction (left or right) wheels do not spin in proper directions and fight each other

If anyone has time and is willing could you please help us find our error? I have attached all code and we would appreciate your help as this is interefering with our drive practice and we don't want to upload broken code on our bot at competiton
Thank you...

BigJ 13-03-2012 14:07

Re: Mecanum Code weird bug need help
 
I haven't looked at the code, but could you describe how the wheels are mounted on the robot? do the rollers on the wheels make a diamond or an X on the ground?

i.e.

/\
\/ diamond

\/
/\ X

rsegrest 13-03-2012 14:12

Re: Mecanum Code weird bug need help
 
I am their coach...rollers are in X pattern

Ether 13-03-2012 14:15

Re: Mecanum Code weird bug need help
 
Quote:

Originally Posted by Nathan Powell (Post 1143632)
Turning either direction (left or right) wheels do not spin in proper directions and fight each other

Put it up on blocks and tell us which way the wheels are spinning.

It is possible the wheels are spinning the correct way, but you have the wheels mounted with the roller orientation incorrect.

For pure clockwise rotation, the left wheels should be spinning forward and the right wheels backward.



Ether 13-03-2012 14:17

Re: Mecanum Code weird bug need help
 
Quote:

Originally Posted by rsegrest (Post 1143635)
I am their coach...rollers are in Xpattern

As viewed from above or below?

Viewed from above should be X

Viewed from below should be diamond.

Put vehicle up on blocks and command a turn and tell us what each of the 4 wheels is doing.



rsegrest 13-03-2012 14:27

Re: Mecanum Code weird bug need help
 
Quote:

Originally Posted by Ether (Post 1143637)
As viewed from above or below?

Viewed from above should be X

Viewed from below should be diamond.

Put vehicle up on blocks and command a turn and tell us what each of the 4 wheels is doing.



X from top and diamond from bottom is current setup. Testing now will post results in a few...minutes that is...

rsegrest 13-03-2012 14:39

Re: Mecanum Code weird bug need help
 
When joystick is twisted left:
'front' wheels spin backwards (both)
'back' wheels spin forward (both)

When joystick is twisted right:
'front' wheels spin forward (both)
'back' wheels spin backwards (both)

According to the programmer if he changes the code to make turning work properly then it will break strafing...?? Something is not sounding right to me on this...

Alan Anderson 13-03-2012 14:41

Re: Mecanum Code weird bug need help
 
Quote:

Originally Posted by Nathan Powell (Post 1143632)
forward works as expected
reverse works as expected
strafe works as expected
Turning either direction (left or right) wheels do not spin in proper directions and fight each other

That strongly suggests that the wheels themselves are installed wrong.

Quote:

Originally Posted by rsegrest (Post 1143635)
I am their coach...rollers are in X pattern

That's not how they should be. To confirm the problem, try spinning the robot by hand with the power off. If it turns relatively easily, the wheels definitely need to be swapped.

omalleyj 13-03-2012 14:50

Re: Mecanum Code weird bug need help
 
Quote:

Originally Posted by rsegrest (Post 1143646)
When joystick is twisted left:
'front' wheels spin backwards (both)
'back' wheels spin forward (both)

When joystick is twisted right:
'front' wheels spin forward (both)
'back' wheels spin backwards (both)

According to the programmer if he changes the code to make turning work properly then it will break strafing...?? Something is not sounding right to me on this...

Are the motors inverted in code or physically?
If lefts and rights were set as fronts and backs, and not inverted it would be consistent with what you describe.

rsegrest 13-03-2012 14:52

Re: Mecanum Code weird bug need help
 
Quote:

Originally Posted by Alan Anderson (Post 1143647)
That strongly suggests that the wheels themselves are installed wrong.



That's not how they should be. To confirm the problem, try spinning the robot by hand with the power off. If it turns relatively easily, the wheels definitely need to be swapped.

According to our understanding the rollers should form an X when viewed from top and diamond from bottom

http://www.google.com/imgres?start=2...w=1486&bih=723

Is this not correct? According to the instructions we recieved with the wheels this is correct...

rsegrest 13-03-2012 14:56

Re: Mecanum Code weird bug need help
 
Quote:

Originally Posted by omalleyj (Post 1143650)
Are the motors inverted in code or physically?
If lefts and rights were set as fronts and backs, and not inverted it would be consistent with what you describe.

Inverted physically.

omalleyj 13-03-2012 15:11

Re: Mecanum Code weird bug need help
 
Quote:

Originally Posted by rsegrest (Post 1143654)
Inverted physically.

I withdraw the 'and not inverted' part.
If Left are in front and Rights in the back (or vice versa):
stick forward all turn forward, ditto back
stick to the side and left and right counter rotate so you still strafe (if the front-rear of the two sides are also swapped relatively)
but if you try to turn in place fronts and backs go opposite

Sorry if that isn't terribly clear, but I would check the order your controllers are in the constructor really match physical L-R/F-R

Ether 13-03-2012 15:29

Re: Mecanum Code weird bug need help
 
Quote:

Originally Posted by rsegrest (Post 1143651)
According to our understanding the rollers should form an X when viewed from top and diamond from bottom

That is correct.



mikets 13-03-2012 15:56

Re: Mecanum Code weird bug need help
 
Assuming the wheels are installed correctly (X pattern viewing from the top), it could be a software issue. The way we software calibrated our mecanum drive train is as the following:
  • Make sure you put the PWM channels (or CAN IDs) in the correct sequence when instantiating RobotDrive(frontLeft, rearLeft, frontRight, rearRight).
  • Put the robot on some 2x4's so the wheels can be freely turning without the robot running away.
  • In code, execute MecanumDrive_Cartesian(0.0, 0.5, 0.0) and make sure all the wheels are going forward.
  • If not, note the wheels that are turning backward and add the following line for each wheel that needs correction (need to change kFrontLeftMotor to the corresponding motors):
    SetInvertedMotor(kFrontLeftMotor, true);
  • Now, write the teleop code that uses the joystick(s) to drive the robot.
  • If tank drive, pushing the left joystick forward should turn the left wheels forward. If not add a minus in front of the joystickLeft.GetY().
  • Do the same for the tank drive right joystick.
  • If arcade drive, push the joystick forward should turn all four wheels forward. If they are reversed, put a minus in front of joystick.GetY().
  • For arcade drive, push the joystick to the right and the robot should turn right (left wheels forward and right wheels reverse). If not, put a minus in front of the joystick.GetX().
  • Similarly, for strafe, correct the corresponding joystick sign if it is not going the direction you want.

rsegrest 21-03-2012 18:03

Re: Mecanum Code weird bug need help
 
how exactly would we write that if wanted to invert the motors for 1 and 3


All times are GMT -5. The time now is 12:34.

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