|
[cRIO] Robot Drive... Output not updated often enough.
I got this error. According to another question on here this means that something caused the program to stop running.
No errors in code, no idea why it is happening.
The code I tested (Deleted all comments, hope it is readable.)
package edu.wpi.first.wpilibj.templates;
//import edu.wpi.first.wpilibj.Compressor;
//import edu.wpi.first.wpilibj.DigitalInput;
import edu.wpi.first.wpilibj.SimpleRobot;
import edu.wpi.first.wpilibj.RobotDrive;
import edu.wpi.first.wpilibj.Timer;
import edu.wpi.first.wpilibj.Joystick;
//import edu.wpi.first.wpilibj.Solenoid;
//import edu.wpi.first.wpilibj.Talon;
//import edu.wpi.first.wpilibj.Watchdog;
public class team4692robot extends SimpleRobot
{
RobotDrive drive = new RobotDrive(1, 2);
Joystick left = new Joystick(1);
Joystick right = new Joystick(2);
public void autonomous()
{
int autotimer=0;
while(true && isAutonomous() && isEnabled())
{
if(autotimer<100)
{
drive.tankDrive(.4, -.4);
}
else
{
drive.tankDrive(0, 0);
}
autotimer++;
Timer.delay(.005);
}
}
/**
* This function is called once each time the robot enters operator control.
*/
public void operatorControl()
{
while(true && isOperatorControl() && isEnabled())
{
double leftpow=left.getY(); double rightpow=right.getY();
double powermod=.25;
if(left.getTrigger())
{
powermod+=.25;
}
if(right.getTrigger())
{
powermod+=.5;
}
leftpow*=powermod; rightpow*=powermod;
drive.tankDrive(leftpow, rightpow);
Timer.delay(.005);
}
}
public void test()
{
}
}
|