Go to Post In Israel we've got the president supporting FIRST and speaking at events, so it's time for you guys to catch up =] - Tottanka [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
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 20-01-2015, 19:17
broswen broswen is offline
Programmer
FRC #4239 (Warpspeed)
Team Role: Programmer
 
Join Date: Jan 2015
Rookie Year: 2013
Location: Minnesota
Posts: 5
broswen is an unknown quantity at this point
Mecanum drive cartesian problems

We are trying to use the mecanum drive cartesian method provided by wpilib. We are having a problem with the axis in the controllers not working properly.
We are using an xbox controller with 2 joysticks instead of a flight stick with a rotational axis. We are using the x and y axis on the left stick for the x and y variables called in the method and the x axis on the right stick for the rotation.

What is supposed to happen:
The left stick controls forward/backward and strafe left/right.
The right stick controls rotation.

The problem:
For example, when I push forward on the left stick the robot turns, and when I push left on the right stick it strafes.
When i push the left stick left/right the robot spins wheels but its not the right direction and doesnt move.

Has anyone successfully used the wpilib mecanum drive methods, and could you give us some tips?

We do not have a gyroscope set up currently and that variable is set as 0. Would that affect anything?
Reply With Quote
  #2   Spotlight this post!  
Unread 20-01-2015, 19:29
Ben Wolsieffer Ben Wolsieffer is offline
Dartmouth 2020
AKA: lopsided98
FRC #2084 (Robots by the C)
Team Role: Alumni
 
Join Date: Jan 2011
Rookie Year: 2011
Location: Manchester, MA (Hanover, NH)
Posts: 520
Ben Wolsieffer has much to be proud ofBen Wolsieffer has much to be proud ofBen Wolsieffer has much to be proud ofBen Wolsieffer has much to be proud ofBen Wolsieffer has much to be proud ofBen Wolsieffer has much to be proud ofBen Wolsieffer has much to be proud ofBen Wolsieffer has much to be proud of
Re: Mecanum drive cartesian problems

I would check to make sure the motors are inverted correctly. Are you able to drive normally (arcade or tank)?
__________________



2016 North Shore District - Semifinalists and Excellence in Engineering Award
2015 Northeastern University District - Semifinalists and Creativity Award
2014 Granite State District - Semifinalists and Innovation in Control Award
2012 Boston Regional - Finalists
Reply With Quote
  #3   Spotlight this post!  
Unread 20-01-2015, 19:35
jtrv's Avatar
jtrv jtrv is offline
github.com/jhtervay
AKA: Justin
FRC #2791 (Shaker Robotics)
Team Role: College Student
 
Join Date: Jan 2013
Rookie Year: 2012
Location: Latham, NY
Posts: 144
jtrv is a name known to alljtrv is a name known to alljtrv is a name known to alljtrv is a name known to alljtrv is a name known to alljtrv is a name known to all
Re: Mecanum drive cartesian problems

Sounds like your joystick axes are switched in the code. The rotation should be [-1,1], I'm not sure if positive goes clockwise since I don't have a drive base to test it with yet, but...

Cartesian is mostly used with gyro. I would recommend just trying polar for now, until you have a gyro set up.

With cartesian and gyro set to 0, the robot constantly thinks it has yet to rotate at all. So as a result, things might get wonky.
__________________
2791 (2012-2017)
Reply With Quote
  #4   Spotlight this post!  
Unread 20-01-2015, 19:44
Ben Wolsieffer Ben Wolsieffer is offline
Dartmouth 2020
AKA: lopsided98
FRC #2084 (Robots by the C)
Team Role: Alumni
 
Join Date: Jan 2011
Rookie Year: 2011
Location: Manchester, MA (Hanover, NH)
Posts: 520
Ben Wolsieffer has much to be proud ofBen Wolsieffer has much to be proud ofBen Wolsieffer has much to be proud ofBen Wolsieffer has much to be proud ofBen Wolsieffer has much to be proud ofBen Wolsieffer has much to be proud ofBen Wolsieffer has much to be proud ofBen Wolsieffer has much to be proud of
Re: Mecanum drive cartesian problems

AFAIK, you should be able to use the cartesian methods without a gyro just fine. Internally the movement vector is just rotated by the gyro angle. Without a gyro, strafing will always be relative to the robot, so if you turn while strafing you will move in an arc.
__________________



2016 North Shore District - Semifinalists and Excellence in Engineering Award
2015 Northeastern University District - Semifinalists and Creativity Award
2014 Granite State District - Semifinalists and Innovation in Control Award
2012 Boston Regional - Finalists
Reply With Quote
  #5   Spotlight this post!  
Unread 20-01-2015, 19:54
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,025
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 drive cartesian problems


Mecanum cartesian can be used without gyro. You don't need to use polar.

Put the bot up on blocks. Issue a pure forward command and note the direction each of the 4 wheels is spinning. Do the same for pure strafe right, and rotate clockwise.

Post your results here.


Reply With Quote
  #6   Spotlight this post!  
Unread 20-01-2015, 20:21
broswen broswen is offline
Programmer
FRC #4239 (Warpspeed)
Team Role: Programmer
 
Join Date: Jan 2015
Rookie Year: 2013
Location: Minnesota
Posts: 5
broswen is an unknown quantity at this point
Re: Mecanum drive cartesian problems

We have fixed our robot, sort of.
We inverted one side of our robot and that fixed most of the problem.
The joysticks were opposite so we inverted those also.
now our robot works perfectly, except that our front is now our back and our back is our front. Other than that it is perfect. This is just a test chassis so direction isn't a problem.
Reply With Quote
  #7   Spotlight this post!  
Unread 20-01-2015, 20:51
Ben Wolsieffer Ben Wolsieffer is offline
Dartmouth 2020
AKA: lopsided98
FRC #2084 (Robots by the C)
Team Role: Alumni
 
Join Date: Jan 2011
Rookie Year: 2011
Location: Manchester, MA (Hanover, NH)
Posts: 520
Ben Wolsieffer has much to be proud ofBen Wolsieffer has much to be proud ofBen Wolsieffer has much to be proud ofBen Wolsieffer has much to be proud ofBen Wolsieffer has much to be proud ofBen Wolsieffer has much to be proud ofBen Wolsieffer has much to be proud ofBen Wolsieffer has much to be proud of
Re: Mecanum drive cartesian problems

Quote:
Originally Posted by broswen View Post
We have fixed our robot, sort of.
We inverted one side of our robot and that fixed most of the problem.
The joysticks were opposite so we inverted those also.
now our robot works perfectly, except that our front is now our back and our back is our front. Other than that it is perfect. This is just a test chassis so direction isn't a problem.
That can be fixed with some more inversions. Before I cleaned it up, our mecanum code used to invert inputs three or four times before they finally reached the motors.
__________________



2016 North Shore District - Semifinalists and Excellence in Engineering Award
2015 Northeastern University District - Semifinalists and Creativity Award
2014 Granite State District - Semifinalists and Innovation in Control Award
2012 Boston Regional - Finalists
Reply With Quote
  #8   Spotlight this post!  
Unread 20-01-2015, 21:58
SuperBK's Avatar
SuperBK SuperBK is offline
Registered User
AKA: BrianK
FRC #1225 (Amperage Robotics)
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 2006
Location: Henersonville, NC
Posts: 357
SuperBK is just really niceSuperBK is just really niceSuperBK is just really niceSuperBK is just really nice
Re: Mecanum drive cartesian problems

Did you verify that the wheels are installed in the correct orientation? Rollers on diagonal wheels should point in the same direction, with opposite directions on each diagonal.
__________________
Brian K
Team 1225 Robotics Mentor
Reply With Quote
  #9   Spotlight this post!  
Unread 20-01-2015, 22:42
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,025
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 drive cartesian problems

Quote:
Originally Posted by SuperBK View Post
Did you verify that the wheels are installed in the correct orientation? Rollers on diagonal wheels should point in the same direction, with opposite directions on each diagonal.
That's necessary, but not sufficient.

X when viewed from top.


Reply With Quote
  #10   Spotlight this post!  
Unread 22-01-2015, 01:14
jwalker0 jwalker0 is offline
Registered User
FRC #3673
 
Join Date: Jan 2015
Location: Seaside, OR
Posts: 1
jwalker0 is an unknown quantity at this point
Re: Mecanum drive cartesian problems

If it's moving opposite to what you expect after inverting the motors on one side, then you inverted the wrong side. We needed to invert the right-side motors to get ours working properly.
Reply With Quote
  #11   Spotlight this post!  
Unread 06-02-2015, 08:33
jls667 jls667 is offline
Registered User
None #2579
 
Join Date: Feb 2014
Location: ny
Posts: 25
jls667 is an unknown quantity at this point
Re: Mecanum drive cartesian problems

Could someone post code for using mecanum wheels and a gyro? I have the mecanum wheels working great without the gyro. I am using Java.
Reply With Quote
  #12   Spotlight this post!  
Unread 06-02-2015, 08:59
broswen broswen is offline
Programmer
FRC #4239 (Warpspeed)
Team Role: Programmer
 
Join Date: Jan 2015
Rookie Year: 2013
Location: Minnesota
Posts: 5
broswen is an unknown quantity at this point
Re: Mecanum drive cartesian problems

Quote:
Originally Posted by jls667 View Post
Could someone post code for using mecanum wheels and a gyro? I have the mecanum wheels working great without the gyro. I am using Java.
We haven't used mecanum wheels with a gyroscope at all. I would guess you have to create a gyroscope in the code and add it to the mecanum drive function.
Reply With Quote
  #13   Spotlight this post!  
Unread 06-02-2015, 09:12
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,025
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 drive cartesian problems

Quote:
Originally Posted by jls667 View Post
Could someone post code for using mecanum wheels and a gyro? I have the mecanum wheels working great without the gyro. I am using Java.
You have to tell us what you want to use the gyro for. For field-oriented control? To correct minor drift when trying to drive straight? Both? Neither?


Reply With Quote
  #14   Spotlight this post!  
Unread 06-02-2015, 10:26
jls667 jls667 is offline
Registered User
None #2579
 
Join Date: Feb 2014
Location: ny
Posts: 25
jls667 is an unknown quantity at this point
Re: Mecanum drive cartesian problems

I would like to set up field-oriented control.
Reply With Quote
  #15   Spotlight this post!  
Unread 06-02-2015, 10:33
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,025
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 drive cartesian problems

Quote:
Originally Posted by jls667 View Post
I would like to set up field-oriented control.
Are you using home-brew mec code, or WPILib robotdrive.java?

If the latter, mec cartesian has an input parameter for gyro. That gives you field-oriented control.

If the former, just grab the rotateVector code from WPIlib.


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 08:37.

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