![]() |
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? |
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)?
|
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. |
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.
|
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. |
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. |
Re: Mecanum drive cartesian problems
Quote:
|
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.
|
Re: Mecanum drive cartesian problems
Quote:
X when viewed from top. |
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.
|
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.
|
Re: Mecanum drive cartesian problems
Quote:
|
Re: Mecanum drive cartesian problems
Quote:
|
Re: Mecanum drive cartesian problems
I would like to set up field-oriented control.
|
Re: Mecanum drive cartesian problems
Quote:
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. |
Re: Mecanum drive cartesian problems
I am using the wpilib library and robotdrive. I believe that I have to reset the gyro and use getangle.
|
Re: Mecanum drive cartesian problems
Quote:
|
Re: Mecanum drive cartesian problems
Quote:
Is there a purpose to Polar/Cartesian switch? Isn't calling cartesian with gyro-angle==0 equivalent to to calling Polar? Perhaps it is meant to switch between field-centric and robot-centric? Not sure the CommandBase class will work in this year's lib so it may not just be load/go. Also, I think atan2 is on Math now, not MathUtils because we have proper java this year, so those are the obvious tweaks I see that will be necessary |
Re: Mecanum drive cartesian problems
I am having trouble finding the java code mentioned by GeeTwo.
|
Re: Mecanum drive cartesian problems
Quote:
https://github.com/frc3946/MecanumDr...libj/templates |
Re: Mecanum drive cartesian problems
Thank you. That helps.
|
| All times are GMT -5. The time now is 12:17. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi