Output not updated enough

I was showing the new students how programming works on the robot with c++ and I downloaded the simple robot template to the robot and rebooted it. After it was rebooted, I enabled the autonomous on the driverstation which would drive for about 2 seconds but nothing happened, the victors and jags were still blinking. Even when I enabled the Tele-op mode the same thing happened. I did get an error on the driverstation


ERROR: A timeout has been exceeded: RobotDrive... Output not
updated often enough. ...in Check() in C:/WindRiver/workspace/
WPILib/MotorSafetyHelper.cpp at line 123

any one knows how to fix this?

Thanks in advance!

The RobotDrive class implements a feature called MotorSafety. What happens is that if you don’t continue to supply values to the motors (or the RobotDrive object) it assumes that your program has crashed and shuts down the motors.

Can you check if you removed the myRobot.SetSafetyEnabled(false) line? It would disable the safety feature and allow the robot to continue running over the Sleep(2.0); Without disabling MotorSafety the motors will stop soon after you first started them going in an attempt to keep your robot from running with a broken program.

Brad

I added the line “myRobot.SetSafetyEnabled(false);” in the code and still the same error. I also set it to true and the same error popped up. I switched the code from C++ to Java and I would get the same error “output not updated often enough” in the deploy/run window on netbeans. Even when SetSafetyEnabled is set to true or false. I even took it completely out of the code still the same error, is there somethinig here that I am doing wrong?
here’s the 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 com.sun.squawk.Driver;
import edu.wpi.first.wpilibj.SimpleRobot;
import edu.wpi.first.wpilibj.RobotDrive;
import edu.wpi.first.wpilibj.Joystick;
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 {
    RobotDrive Drive = new RobotDrive(1, 2);
    Joystick stick = new Joystick(1);
    

    
    /**robot work
     * This function is called once each time the robot enters autonomous mode.
     */
    public void autonomous() {
        
    }

    /**
     * This function is called once each time the robot enters operator control.
     */
    public void operatorControl() {
        while(isEnabled() && isAutonomous()){
            Drive.setSafetyEnabled(true);
            Drive.arcadeDrive(stick);
            Timer.delay(0.0004);
        }

    }
}

Your code isn’t getting called. Your isAutonomous should be isOperatorControl.

Your delay is also very short, only 400 microseconds. The motors will only be updated at 5 ms, so use a delay of at least 0.005. You only get new joystick data every 20ms, so if you’re only doing operator control, you can have a delay of 0.02

It works, I forgot about that. I used auto complete and did not check what was put there, Thank you!

how would I figure out how long I get back data from a HID or sensor?, is there a way to find out?
I added something else to the code now, and I am still getting the same error, I tried increasing and decreasing the delay and the same error still, I even enabled the Safety and disabled.


/*----------------------------------------------------------------------------*/
/* 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.*;
/**
 * 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 {
    RobotDrive Drive = new RobotDrive(1, 2);
    Joystick stick = new Joystick(1);
    Victor m_shooter1 = new Victor(3);
    Victor m_shooter2 = new Victor(3);
    /**
     * This function is called once each time the robot enters autonomous mode.
     */
    public void autonomous() {
        
    }

    /**
     * This function is called once each time the robot enters operator control.
     */
    public void operatorControl() {
        while(isOperatorControl()){
            Drive.arcadeDrive(stick);
            Timer.delay(0.001);
            m_shooter1.set((stick.getThrottle()/2)-0.5);
            m_shooter1.set(((stick.getThrottle()/2)-0.5)*-1);
        }
    }
}