|
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.
|