![]() |
Programming Mecanum?
Our team decided to use mecanum wheels this year and we've used java last year. I'm a bit familiar with java but I can't seem to find a way to approach programming mecanum. I checked out the library but I can't seem to understand. Does anyone have a simple or pseudo program for mecanum they can share?
|
Re: Programming Mecanum?
Quote:
|
Re: Programming Mecanum?
Under public class RobotMain extends IterativeRobot,
RobotDrive m_drive; Under public void RobotInit m_drive = new RobotDrive(m_frontLeft, m_rearLeft, m_frontRight, m_rearRight); // those reference the motors declared in another section of the code Under public void TeleoperatedPeriodic m_drive.mecanumDrive_Cartesian(-1 * m_rstick.getX(),-1 * m_rstick.getY(), -1 * m_lstick.getX(), 0); //m_rstick and m_lstick are just joysticks That's the code we're using right now. Cartesian is much simpler than Polar, because then you don't have to deal with the annoying trigonometry with polar coordinates. m_rstick and m_lstick are just joysticks. So, based on what we get for input from our joysticks, we can control forward/backward, strafe left/right, and turn clock/counter-clockwise. The rest of the code has been done by the WPI. Sorry if this doesn't help. |
Re: Programming Mecanum?
You COULD do this:
Code:
/* Simulated tank drive controls for mecanum wheels */You SHOULD do this: Code:
magnitude = leftStick.getMagnitude(); |
Re: Programming Mecanum?
I have the same question, execpt for Labview. i can't figure how to put the motors in the Begin.vi and how to incoorpoate it into Telop. This is my first time changing our robot to mecanum
|
Re: Programming Mecanum?
Our team is simply using arcade drive, since we've been having trouble with both the Polar and Cartesian driving. We have a toggle button that inverts the motors to strafe.
@General25: You'd probably get better answers in the Labview section, since this is Java. |
Re: Programming Mecanum?
@General25:
You'd probably get better answers in the Labview section, since this is Java.[/quote] sorry, just searched for mecanum and programing |
Re: Programming Mecanum?
I've had a little problem programming the mecanum wheels myself. In my post before I said I had inverted the motors to strafe. Well, turns out that makes a nasty ugly strafe. Anyone have tips regarding how to actually program a strafe with arcade drive?
Thanks. here's our current code: Code:
if(joystickL.getTrigger() && state == 0) { |
Re: Programming Mecanum?
Quote:
|
Re: Programming Mecanum?
Quote:
Could you please explain how I'm supposed to use forward/backward/clockwise in the drive train programming? |
Re: Programming Mecanum?
Quote:
Code:
front_left = forward + clockwise + right;If that's not what you were asking, please clarify your question and I'll try again. |
Re: Programming Mecanum?
Quote:
Code:
RobotDrive driveTrain = new RobotDrive(front_left, rear_left, front_right, rear_right); |
Re: Programming Mecanum?
Quote:
I can tell you this: If your motors are wired so that when you give them a +1 command they go in the "forward" direction, then no inverting is required. I recommend that you put the robot up on blocks and push the joystick(s) straight forward. If all four wheels spin in the "forward" direction, you're good to go. If not, then invert any motor that is spinning backwards. |
Re: Programming Mecanum?
Quote:
|
Re: Programming Mecanum?
Sorry for the late reply.
So far this is what I currently have done and understand well. Code:
import edu.wpi.first.wpilibj.SimpleRobot;Once I figure out how Cartisian works, I'll update the code. Now to figure out the gyro and encoder. |
| All times are GMT -5. The time now is 09:44. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi