Auto Mode Help

ok so this year we have a complicated arm.

is there some kind of code or program that records what a driver does in telop mode that we can play back in auto mode.

example:

the driver drives the robot up to the pegs and score a tube in telop mode while he/she is doing this we are recording the code. we then take that code and play it back into auto mode

is this possible?

At the moment, i can’t think of any way to do this specifically, but something that we’ve done in the past is to send autonomous signals based on time. For example, raise shoulder at .6 speed for 1 sec, then raise elbow at .3 speed for 2 seconds. With some tweaking, you should be able to get a pretty smooth motion, however position won’t be exact.

If you have some sort of positional feedback on the arm (potentiometers, encoders…) you could find what the positions of the arm are after the driver gets it to a spot that they want it. Then set the arm to move to those predefined positions. In this case, the arm will go to the same spot every time.

then how to i drive the victor in auto mode?

Autonomous driving is all about sensors. First, you have to decide what sensors you want to use to guide your driving. For this year’s game, I have heard the following strategies:

  • Line following using light sensors.
  • Distance and turn driving using encoders and gyros
  • Vision driving: using camera to recognize the pegs and driving towards it.
    *]No sensors, use pure timing (e.g. drive motor x with power y for z seconds). If you are trying to play a recorded route, this is probably one way to do it.
    There may be some other strategies, but these are the ones I am aware of. Once you decided which sensors to use, then you write the code to read the sensors, calculate the power to each driving motors accordingly and program the PWMs. If you decide on doing line following, FIRST has provided sample code on how to do that. If you decide to use encoders and gyros, you can use PID control algorithm which are also supported in WPI library and there are many sample programs you can look at. And so is vision driving. There are a lot of sample code from the last couple years (Lunacy and Breakaway).

That helps but how do I drive a specific motor like a victor in auto mode because that is the type of motor that we are using for our arm

For your arm motor, do you have any sensor on it to tell you the position of the arm? For us, we have an elevator and we mounted an encoder on the motor path to tell us the height. If you don’t have any sensors, then your arm can only be driven blind. Depending on your design, you may want to add some sensors to it.

We have sensors to make sure it dosent go to far and fall over

So I assume you have limit switches on a digital input channel then? If so, you can just program the victor with:


if (limitSwitch->Get() == 0)
{
    armMotor->Set(0.5);
}
else
{
    armMotor->Set(0.0);
}