Go to Post Seats are seats, we're all watching the same thing. - katiyeh07 [more]
Home
Go Back   Chief Delphi > Technical > Programming > WindRiver C++
CD-Events   CD-Media   CD-Spy   FRC-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 03-13-2012, 01:04 PM
Nathan Powell's Avatar
Nathan Powell Nathan Powell is offline
Head Programmer
FRC #2582 (PantherBots)
Team Role: Programmer
 
Join Date: Jan 2012
Rookie Year: 2012
Location: Lufkin, TX
Posts: 32
Nathan Powell is an unknown quantity at this point
Exclamation Mecanum Code weird bug need help

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...
Attached Files
File Type: txt code.txt (1.1 KB, 24 views)
Reply With Quote
  #2   Spotlight this post!  
Unread 03-13-2012, 01:07 PM
BigJ BigJ is offline
Registered User
AKA: Josh P.
FRC #1675 (Ultimate Protection Squad)
Team Role: Engineer
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Milwaukee, WI
Posts: 780
BigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond repute
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
Reply With Quote
  #3   Spotlight this post!  
Unread 03-13-2012, 01:12 PM
rsegrest's Avatar
rsegrest rsegrest is offline
@ least I'm OVER the rock THIS time
FRC #2582 (PantherBots)
Team Role: Coach
 
Join Date: Jan 2008
Rookie Year: 2008
Location: Lufkin, TX
Posts: 341
rsegrest is a splendid one to beholdrsegrest is a splendid one to beholdrsegrest is a splendid one to beholdrsegrest is a splendid one to beholdrsegrest is a splendid one to beholdrsegrest is a splendid one to beholdrsegrest is a splendid one to behold
Re: Mecanum Code weird bug need help

I am their coach...rollers are in X pattern
__________________
Impossible is just a big word for small men who find it easier to live in the world they've been given than to explore the power they have to change it. Impossible is not a fact. It's an opinion. Impossible is not a declaration. It's a dare Impossible is potential. Impossible is temporary. Impossible is nothing.
~ Unknown
Reply With Quote
  #4   Spotlight this post!  
Unread 03-13-2012, 01:17 PM
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 5,875
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 Code weird bug need help

Quote:
Originally Posted by rsegrest View Post
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.


Reply With Quote
  #5   Spotlight this post!  
Unread 03-13-2012, 01:27 PM
rsegrest's Avatar
rsegrest rsegrest is offline
@ least I'm OVER the rock THIS time
FRC #2582 (PantherBots)
Team Role: Coach
 
Join Date: Jan 2008
Rookie Year: 2008
Location: Lufkin, TX
Posts: 341
rsegrest is a splendid one to beholdrsegrest is a splendid one to beholdrsegrest is a splendid one to beholdrsegrest is a splendid one to beholdrsegrest is a splendid one to beholdrsegrest is a splendid one to beholdrsegrest is a splendid one to behold
Re: Mecanum Code weird bug need help

Quote:
Originally Posted by Ether View Post
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...
__________________
Impossible is just a big word for small men who find it easier to live in the world they've been given than to explore the power they have to change it. Impossible is not a fact. It's an opinion. Impossible is not a declaration. It's a dare Impossible is potential. Impossible is temporary. Impossible is nothing.
~ Unknown

Last edited by rsegrest : 03-13-2012 at 01:40 PM.
Reply With Quote
  #6   Spotlight this post!  
Unread 03-13-2012, 01:39 PM
rsegrest's Avatar
rsegrest rsegrest is offline
@ least I'm OVER the rock THIS time
FRC #2582 (PantherBots)
Team Role: Coach
 
Join Date: Jan 2008
Rookie Year: 2008
Location: Lufkin, TX
Posts: 341
rsegrest is a splendid one to beholdrsegrest is a splendid one to beholdrsegrest is a splendid one to beholdrsegrest is a splendid one to beholdrsegrest is a splendid one to beholdrsegrest is a splendid one to beholdrsegrest is a splendid one to behold
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...
__________________
Impossible is just a big word for small men who find it easier to live in the world they've been given than to explore the power they have to change it. Impossible is not a fact. It's an opinion. Impossible is not a declaration. It's a dare Impossible is potential. Impossible is temporary. Impossible is nothing.
~ Unknown
Reply With Quote
  #7   Spotlight this post!  
Unread 03-13-2012, 01:50 PM
omalleyj omalleyj is offline
Registered User
AKA: Jim O'Malley
FRC #1279 (Cold Fusion)
Team Role: Mentor
 
Join Date: Jan 2008
Rookie Year: 2008
Location: New Jersey
Posts: 127
omalleyj is a splendid one to beholdomalleyj is a splendid one to beholdomalleyj is a splendid one to beholdomalleyj is a splendid one to beholdomalleyj is a splendid one to beholdomalleyj is a splendid one to beholdomalleyj is a splendid one to beholdomalleyj is a splendid one to behold
Re: Mecanum Code weird bug need help

Quote:
Originally Posted by rsegrest View Post
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.
Reply With Quote
  #8   Spotlight this post!  
Unread 03-13-2012, 01:56 PM
rsegrest's Avatar
rsegrest rsegrest is offline
@ least I'm OVER the rock THIS time
FRC #2582 (PantherBots)
Team Role: Coach
 
Join Date: Jan 2008
Rookie Year: 2008
Location: Lufkin, TX
Posts: 341
rsegrest is a splendid one to beholdrsegrest is a splendid one to beholdrsegrest is a splendid one to beholdrsegrest is a splendid one to beholdrsegrest is a splendid one to beholdrsegrest is a splendid one to beholdrsegrest is a splendid one to behold
Re: Mecanum Code weird bug need help

Quote:
Originally Posted by omalleyj View Post
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.
__________________
Impossible is just a big word for small men who find it easier to live in the world they've been given than to explore the power they have to change it. Impossible is not a fact. It's an opinion. Impossible is not a declaration. It's a dare Impossible is potential. Impossible is temporary. Impossible is nothing.
~ Unknown
Reply With Quote
  #9   Spotlight this post!  
Unread 03-13-2012, 02:11 PM
omalleyj omalleyj is offline
Registered User
AKA: Jim O'Malley
FRC #1279 (Cold Fusion)
Team Role: Mentor
 
Join Date: Jan 2008
Rookie Year: 2008
Location: New Jersey
Posts: 127
omalleyj is a splendid one to beholdomalleyj is a splendid one to beholdomalleyj is a splendid one to beholdomalleyj is a splendid one to beholdomalleyj is a splendid one to beholdomalleyj is a splendid one to beholdomalleyj is a splendid one to beholdomalleyj is a splendid one to behold
Re: Mecanum Code weird bug need help

Quote:
Originally Posted by rsegrest View Post
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
Reply With Quote
  #10   Spotlight this post!  
Unread 03-13-2012, 01:41 PM
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: 7,734
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
Send a message via AIM to Alan Anderson
Re: Mecanum Code weird bug need help

Quote:
Originally Posted by Nathan Powell View Post
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 View Post
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.
Reply With Quote
  #11   Spotlight this post!  
Unread 03-13-2012, 01:52 PM
rsegrest's Avatar
rsegrest rsegrest is offline
@ least I'm OVER the rock THIS time
FRC #2582 (PantherBots)
Team Role: Coach
 
Join Date: Jan 2008
Rookie Year: 2008
Location: Lufkin, TX
Posts: 341
rsegrest is a splendid one to beholdrsegrest is a splendid one to beholdrsegrest is a splendid one to beholdrsegrest is a splendid one to beholdrsegrest is a splendid one to beholdrsegrest is a splendid one to beholdrsegrest is a splendid one to behold
Re: Mecanum Code weird bug need help

Quote:
Originally Posted by Alan Anderson View Post
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...
__________________
Impossible is just a big word for small men who find it easier to live in the world they've been given than to explore the power they have to change it. Impossible is not a fact. It's an opinion. Impossible is not a declaration. It's a dare Impossible is potential. Impossible is temporary. Impossible is nothing.
~ Unknown
Reply With Quote
  #12   Spotlight this post!  
Unread 03-13-2012, 02:29 PM
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 5,875
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 Code weird bug need help

Quote:
Originally Posted by rsegrest View Post
According to our understanding the rollers should form an X when viewed from top and diamond from bottom
That is correct.


Reply With Quote
  #13   Spotlight this post!  
Unread 03-13-2012, 02:56 PM
mikets's Avatar
mikets mikets is offline
Software Engineer
FRC #0492 (Titan Robotics)
Team Role: Mentor
 
Join Date: Jan 2010
Rookie Year: 2008
Location: Bellevue, WA
Posts: 596
mikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of light
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.
__________________

Last edited by mikets : 03-13-2012 at 03:07 PM.
Reply With Quote
  #14   Spotlight this post!  
Unread 03-21-2012, 05:03 PM
rsegrest's Avatar
rsegrest rsegrest is offline
@ least I'm OVER the rock THIS time
FRC #2582 (PantherBots)
Team Role: Coach
 
Join Date: Jan 2008
Rookie Year: 2008
Location: Lufkin, TX
Posts: 341
rsegrest is a splendid one to beholdrsegrest is a splendid one to beholdrsegrest is a splendid one to beholdrsegrest is a splendid one to beholdrsegrest is a splendid one to beholdrsegrest is a splendid one to beholdrsegrest is a splendid one to behold
Re: Mecanum Code weird bug need help

how exactly would we write that if wanted to invert the motors for 1 and 3
__________________
Impossible is just a big word for small men who find it easier to live in the world they've been given than to explore the power they have to change it. Impossible is not a fact. It's an opinion. Impossible is not a declaration. It's a dare Impossible is potential. Impossible is temporary. Impossible is nothing.
~ Unknown
Reply With Quote
  #15   Spotlight this post!  
Unread 03-21-2012, 05:07 PM
mikets's Avatar
mikets mikets is offline
Software Engineer
FRC #0492 (Titan Robotics)
Team Role: Mentor
 
Join Date: Jan 2010
Rookie Year: 2008
Location: Bellevue, WA
Posts: 596
mikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of light
Re: Mecanum Code weird bug need help

Quote:
Originally Posted by rsegrest View Post
how exactly would we write that if wanted to invert the motors for 1 and 3
Let's say if motor 1 is the front left motor and motor 3 is the rear left motor.
Code:
SetInvertedMotor(kFrontLeftMotor, true);
SetInvertedMotor(kRearLeftMotor, true);
__________________
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:46 AM.

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


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