Quote:
Originally Posted by Alan Anderson
Your programmer has probably written the "extend elevator" code as a loop waiting for the elevator to get to the desired location. A loop like that "stalls" the rest of the code. I'm surprised your robot isn't shutting down due to a communication watchdog timeout.
What you'll need to have instead is to start the motor and do a one-time computation of a global variable defining how long to run the motor when the button is first pressed, then a quick test in the teleop code to see if the time has elapsed and stop the motor if it has. Teleop is already called repeatedly from inside a loop.
|
I disabled the watchdog, and the time I have is determined by the distance divided by the inches per second and the inches per second is a const static double which is declared in public. The arm gets the height right on the dime, perfectly but the only thing is that our driver cannot control the robot while its doing that.