Archive for November, 2010


FRC Autonomous mode

I have 2 goals for teams, especially rookie teams, and the 2 goals are for every team to be on the field and ready to go for every regular match and for every team to move in autonomous. Hopefully, when you build the kit, you will have a movable robot.
There are two ways to move in autonomous. The first is to do action after action after action as shown below.
Sequential operations
The problem with this is if anything interferes with the sequence, there is no change in behavior. If the robot hits a wall or another robot knocks it off course, it will keep trying to move forward. It will try to turn against the wall which it may or may not be able to do. And move forward again. This could be a problem. Also, it only goes on for as long as make steps to move.
Another way to handle it with a little more programming and more flexibility is a state machine. I’ve written some about state machines but I’m not sure I’ve emphasized the importance of state machines. A state machine is a basic software engineering paradigm. National Instruments has a state machine tutorial for LabVIEW. It’s a for LabVIEW only, no robots involved but it demonstrates the principle.
The program starts in a state. The program will watch for one or more actions to occur. Actions like a touch sensor activating, a sonar sensor senses something, or something comes within a specified distance. Based on the action detected, the program moves to another state. Then other actions are waited for.
State Diagram Sample
This over-simplified state machine demonstrates some operations based on a state machine. This says to go straight and watch the touch sensor. If the touch sensor is hit the state moves to the go back 1 foot state. If the distance is reached then it moves to the turn right 90 deg. state. Coming from the move back 1 foot state, once the distance of 1 ft is reached it changes states to the turn right 90 deg. state. Once the turn 90 degrees have been reached the state changes back to the initial move forward 10 ft state and everything starts over. The robot will go around in a square but if it hits something it tries to avoid it.
For the FRC robot, the state machine is perfect for autonomous mode. In autonomous mode you want to do something, like drive until something happens, like a certain distance is achieved or something is hit.


FRC Touch Sensor

Sensor’s come in handy in Robots. Sensors can be used when the robot is autonomous or when the driver needs some help. In the breakaway game, to help the driver we used the camera to see the ball on the far end of the field and to line up on the target from the middle area. Touch sensors could have been used to sense when the ball was in place and ready to be kicked or distance sensors on each side to help go through the tunnel. And I’ve already talked about encoders to move specific distances.
For next year’s FRC game who knows what sensors can be used. So you need to be ready and understand how sensors work and how you get information from them.
I’ve put in these links before but they are important learning about sensors. National Instruments has some good papers on sensors and their effective use. They have some basic sensor information and their basic paradigm is ”Sense Think Act”.
Digital I/O (DIO) is one of the simplest Sensor inputs. This can be used for touch sensor to tell when you’re against a wall or when something is in place. To get to the Digital IO go to the WPI Robotics Library >> IO >> Digital IO >> DigitalInput pallet.
> IO >> DIO” />
In the DIO example it show’s on the blue digital sidecar that there’s a signal diagram showing three connections, a positive, power, and a signal. For a simple touch sensor, electronics store have some touch sensor switches. Or a simple switch for touch can be built with some stiff wire going through a loop as shown below.

The resistor should be a 2.5 Kohm. The 5Volts will make the value hi when the wire through the loop is not touching. When the ground wire touches the loop it will ground the signal to a 0.

The LabVIEW code from the example is shown below.

The block diagram shows the Digital IO is opened according to the slot the DIO module is in and the DIO line. This example will simply show the value coming in from the digital IO line on the front panel. However, this can be used to sense when something is being touched, a wall, a ball is in the right place, or you’re in contact with a tower. It’s simple but very useful.
More about sensor’s next week.