View Single Post
  #1   Spotlight this post!  
Unread 05-04-2016, 04:45 PM
rlounds's Avatar
rlounds rlounds is offline
Registered Usr
AKA: Ryan Lounds
FRC #0865 (Warp7)
Team Role: Operator
 
Join Date: Jan 2016
Rookie Year: 2015
Location: Toronto
Posts: 14
rlounds is a splendid one to beholdrlounds is a splendid one to beholdrlounds is a splendid one to beholdrlounds is a splendid one to beholdrlounds is a splendid one to beholdrlounds is a splendid one to beholdrlounds is a splendid one to behold
Question Mecanum Java Code

Hi, so on my teams demo robot we're using mecanum wheels, a 4 slot cRIO and some victor 884s and we cant seem to get it working right. I don't know that much about code so it'd be great if I could get some help.

The code can be found below, any suggestions/correction are very much appreciated.
Code:
package edu.wpi.first.wpilibj.templates;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.RobotDrive;
import edu.wpi.first.wpilibj.SimpleRobot;
import edu.wpi.first.wpilibj.Timer;
import edu.wpi.first.wpilibj.Victor;

public class RobotTemplate extends SimpleRobot {

    RobotDrive myDrive;
    Joystick driveStick;
    
    public void robotInit() {
        driveStick = new Joystick(1);
        Victor frontLeft = new Victor(1);
        Victor frontRight = new Victor(2);
        Victor rearLeft = new Victor(3);
        Victor rearRight = new Victor(4);
        myDrive = new RobotDrive(frontLeft, rearLeft, frontRight, rearRight);
        System.out.println("Sample Text");
    }
    
    public void autonomous() {
        
    }

    public void operatorControl() {
        while (isOperatorControl() && isEnabled()) {
            myDrive.mecanumDrive_Cartesian(driveStick.getX(), driveStick.getY(), driveStick.getTwist(), 0);
            Timer.delay(0.01);
      
        }
    }
    
    public void test() {
    
    }
}
Reply With Quote