Lab 4B: Programming a stepper-driven rover to drive around an obstacle and knock over a target. (prelim. version. Nov 2006: currently the Music computer only is available for the one rover we have running 10/16)

Background:  Here you will modify your Lab4Pre code to navigate an actual stepper-driven rover to drive around an obstacle and knock over a target. Your rover will have sensors for detecting walls on the left or right front sides of the vehicle.

The test track will be the area between the whiteboard and the food fridge in 095. The recycling bin for cans will be placed near the middle of the area and to the west of the bin will be a plastic bottle of sunscreen. Flanking the sunscreen will be two large, lightweight plastic trucks. Your rover must start behind the second linoleum line on the east end of the track, near the "coatroom" door. It is up to you to decide on the "initial condition" of the rover: its position and orientation behind the starting line.

Requirement: When you move the "V-switch" on the back of the rover to the middle position the rover can start moving. We want to verify that if the V-switch is bumped to the left or right positions during its travel, it will turn itself off. The rover has 40 seconds to knock over the block. The rover must turn off in less than 45 seconds. If the rover knocks over the block and turns itself off in less than 15 seconds, no FTQ.

How to move the rover from the charging/programming position to the track:
1. Push the output switch on the E3631A Power Supply to OFF. (don't turn the whole thing off...)
2. Turn the rover power unit switch (white toggle) to OFF.
3. Disconnect the blue male banana +14v from the rover, disconnect the green ground wire, and disconnect the blue banana from the E3631A itself.
4. Plug the blue male banana dangling on the rover into female banana on the rover power unit. Make sure the red +5v and the purple +12v lines are plugged in, too.
5. Switch the rover from CHARGE to DRIVE.

5b. Make sure the V-switch is NOT in the middle position.
6. Carry the rover to the track, set it down in its initial position.
7. Turn ON the white rover power unit switch: The power and clock lights should come on on the stepper drivers.
8. When ready, flip the V-switch to the middle and we will start our timer.

REVERSE STEPS 7-1 ABOVE TO PLACE THE ROVER BACK ON THE CHARGING STATION. You should see about 100-300 mA being sent into the batteries from the E3531A power supply set to +14v.

In any event, be careful lifting the rover...one hand on the tail and the other on the front shoulder... be careful not to bump any signal wires while moving the programming cable or the charging wires.

We the referees will place the recycle bin, the sunscreen, and flanking trucks down before you set your initial condition. We may add additional weights to the cooler.

After you have placed the rover in its "inital condition" behind the second linoleum line tell the referee you are ready. When you reach down and flip the V-switch a timer will start.

YOU HAVE TWO CHANCES PER DAY TO KNOCK OVER THE TARGET.

Modifying code to download to the rover.
Using what you learned in Lab4pre about modifying, rebuilding and debugging code, change whatever you like in your program version of the default code, but hit Rebuild often to make sure you have no typos resulting in errors. You can use your LabVIEW simulator from Lab4Pre to debug the logic of your code.

The MSP430 computer demo board on the rover will need +5v- for power independent of the download cable; you should make sure the red banana +5 supply is plugged in to the white breadboard and makes connection with the MSP430 board (and ground!). If the on-board supply is hooked up but not putting out 5v- the download can fail in mysterious ways.

The default source code is Lab4B06.c and is in the EN123 IP folder. You should copy and rename the source code for your own use, in your own IAR workspace and project... Download your modified and rebuilt code directly into the MSP430F123(2) on the rover, using the Debug command. If you are not going to Single Step or Go To Cursor, then just hit Debug Go and Stop to make sure your msp430 is running its infinite loop. Pull the download cable off the board. The board on the rover is powered through an on-board 5v through a 10 Ohm resistor (not the 3.3v recommended in the MSP430 data sheet...) Make sure the red banana is plugged in and routed to breadboard power for that job...

Likely you will need to mount the rover up near the computer if you want to "debug." Have the rover "up on blocks" so you can watch the wheels rotate without the bot driving itself off a cliff.

If you do modify code on the rover, let us know so we can reset to distribution code after...

You do not have to modify distribution code to succeed with Lab4B. You can experiment with the "initial condition" code Lab4B06.c. Built into the code is an "artibrary" turn time of 750 msec for either CW or CCW turning. There is a 3 second period at the beginning when the code ignores collisions with the walls. The default code looks for the V-switch to be moved from the side to the center position; the center position is RUN. Make sure you flick the V-switch back to the side when you turn the rover on, or it will keep running and running and not turn off automatically after 20 seconds or so.

Free advice: Decide if you want to snap #105 rubber bands on the wheels for better friction. Should you run Broomba over the track to clear away grit? Think about disabling the wall switches for the first 3-4 seconds, so your rover can push the recycle bin back. Build in a random walk after 10 seconds.

Possible FTQ: What will happen, if anything, after a change is made to a line of code? (your code or the default code, if you use that)?