View Single Post
  #6   Spotlight this post!  
Unread 30-01-2014, 13:39
Team 4939 Team 4939 is offline
Registered User
AKA: Anshul Shah
FRC #4939 (All spark 9)
Team Role: Programmer
 
Join Date: Jan 2014
Rookie Year: 2014
Location: Brampton
Posts: 52
Team 4939 is an unknown quantity at this point
Re: [cRIO] Robot Drive... Output not updated often enough.

Here is the new code:

Code:
package edu.wpi.first.wpilibj.templates;
import edu.wpi.first.wpilibj.RobotDrive;
import edu.wpi.first.wpilibj.SimpleRobot;
import edu.wpi.first.wpilibj.Timer;
import edu.wpi.first.wpilibj.Joystick;
public class RobotTemplate extends SimpleRobot
{
 private RobotDrive drivetrain;
 private Joystick mainStick;
 public RobotTemplate()
 {
 drivetrain = new RobotDrive(1, 2); // create RobotDrive
 mainStick = new Joystick(1); // and joysticks
 }
 public void autonomous() {
 for (int i = 0; i < 4; i++) {
 drivetrain.drive(0.5, 0.0); // drive 50% forward with 0% turn
 Timer.delay(2.0); // wait 2 seconds
 drivetrain.drive(0.0, 0.75); // drive 0% forward and 75% turn
 }
 drivetrain.drive(0.0, 0.0); // drive 0% forward, 0% turn (stop)
 }
 public void OperatorControl()
 {
 while (true && isOperatorControl() && isEnabled())
 {
 drivetrain.arcadeDrive(mainStick);// drive w/joysticks
 Timer.delay(0.02);
 }
 }
}
Reply With Quote