View Single Post
  #4   Spotlight this post!  
Unread 20-12-2013, 12:49
BlackUnicorns BlackUnicorns is offline
Registered User
FRC #5135
 
Join Date: Dec 2013
Location: Israel
Posts: 3
BlackUnicorns is an unknown quantity at this point
Re: Just began using Java

Thank you!
We tried to make an arcade drive program (before, we used LabView to drive our robot), and we have a little problem.. this is our code:
Code:
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2008. All Rights Reserved.                             */
/* Open Source Software - may be modified and shared by FRC teams. The code   */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project.                                                               */
/*----------------------------------------------------------------------------*/

package edu.wpi.first.wpilibj.templates;


import edu.wpi.first.wpilibj.Jaguar;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.RobotDrive;
import edu.wpi.first.wpilibj.SimpleRobot;
import edu.wpi.first.wpilibj.Timer;

/**
 * The VM is configured to automatically run this class, and to call the
 * functions corresponding to each mode, as described in the SimpleRobot
 * documentation. If you change the name of this class or the package after
 * creating this project, you must also update the manifest file in the resource
 * directory.
 */
public class RobotTemplate extends SimpleRobot {
    /**
     * This function is called once each time the robot enters autonomous mode.
     */
    Joystick driveStick = new Joystick(1);
    RobotDrive  myDrive = new RobotDrive(1, 2);
    public void autonomous() {
        
    }

    /**
     * This function is called once each time the robot enters operator control.
     */
    public void operatorControl() {
        while (isOperatorControl() && isEnabled()){
            myDrive.arcadeDrive(driveStick);
            Timer.delay(0.01);
        }
    }
}
Forword and backwords works fine, but the problem was with left and right..
when you turn right it turns left, and left turns right..
Can you tell us what we did wrong?

We really appreciate your help, thank you very much (:
Reply With Quote