Thread: Possessed robot
View Single Post
  #6   Spotlight this post!  
Unread 22-02-2011, 10:50
krudeboy51's Avatar
krudeboy51 krudeboy51 is offline
Only Programmer
AKA: kory
FRC #0369 (369)
Team Role: Programmer
 
Join Date: Mar 2010
Rookie Year: 2010
Location: brooklyn
Posts: 151
krudeboy51 is a glorious beacon of lightkrudeboy51 is a glorious beacon of lightkrudeboy51 is a glorious beacon of lightkrudeboy51 is a glorious beacon of lightkrudeboy51 is a glorious beacon of light
Send a message via AIM to krudeboy51
Re: Possessed robot

Quote:
Originally Posted by Alan Anderson View Post
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.
Reply With Quote