View Full Version : How to get the robot to stop...

01-20-2005, 01:58 PM
Does anyone know how to get the robot to stop in autonomous mode with out using script?

Ryan M.
01-20-2005, 02:04 PM
I'm not sure if you're trying to stop the robot using software (as in, if we run into something stop) or if you mean that you want to be able to kill the robot in mid-stride because you can tell it's just about to rip its arm off. :D

For the first thing, you just have to set the variables pwmXX and pwmXX to 127 in your code, where the two XX is where your motors are hooked up.

For the other option, which only works when you're on your practice field, you build a dongle, which is basically just a few stiches which connect/disconnect a few pins on the competition port on the operator interface. I'm not sure right now exactly where those are, but there is lots about them here. Do a search. :)

01-20-2005, 02:57 PM
Works every time! :D

01-20-2005, 03:27 PM
Shift to the left, shift to the right!
Pop up, push down, byte, byte, byte!
Love it!
Ok, anyways, back to the making the robot stop. In autonomous mode, what I find that works best is at the end of the loop, use
pwmXX = 127;
pwmXX = 127;
where XX is your PWM number. Now, you can create a little snippet like this:
#define pwm_neutral 127
What that will do is let you use pwm_neutral and it will equal 127. If you don't like working with numbers, that is. I also do a
#define pwm_max 254
#define pwm_min 0
for max and min speeds.

01-20-2005, 04:33 PM
Last year my team (S.P.A.M. #180) ran into a serious problem during autonomous. If we ran into something and the robot didn't fix itself, we would continue driving forward and start to burn holes into the carpet. If you have some sort of motion sensor (be it an accelerometer or something equivalent) have a counter going that adds 1 every loop. Each time the sensor returns data, have it zero the counter. So if the sensor doesn't return anything (I.E. you're not moving) then the counter will count to whatever you have set as the max. When it reaches the max, set the motors to neutral (127). This bit of code kept us from being disqualified for field damage for at least five matches during one regional.

That may not be exactly what you're asking for, but its good none-the-less.