View Single Post
  #9   Spotlight this post!  
Unread 24-11-2011, 22:06
Djur's Avatar
Djur Djur is offline
WPILib
AKA: Sam Carlberg
no team
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2009
Location: Massachusetts
Posts: 182
Djur will become famous soon enough
Re: help with mecanum drive code

This is our team's custom mecanum code:

Code:
jaguarDrive((jX+jY)/2, (jY-jX)/2, -(jY-jX)/2, -(jX+jY)/2);
jX and jY are just the X and Y coordinates our joysticks read (-1 through 1).

And the jaguarDrive method:

Code:
public void jaguarDrive(double FL, double RL, double FR, double RR)
    {
        m_frontLeftMotor.set(FL);
        m_rearLeftMotor.set(RL);
        m_frontRightMotor.set(FR);
        m_rearRightMotor.set(RR);
    }
This is by far the simplest solution I've seen.
__________________
WPILib dev (RobotBuilder, SmartDashboard, GRIP)
Reply With Quote