For this assignment you'll implement some simple programs to move the robot smoothly to a location, and to control the position or orientation of the robot in response to its sensors.
You should probably develop these algorithms using the simulator, then move them over to the robot. If you want to start working with one of the Magellans, that's fine. You'll probably want to write your code using some #if statements so you can easily switch from the simulator to the Magellan platform. For example, when connecting to the robot, you could use a statement like the following.
#if NOMAD connect_robot( 1, MODEL_SCOUT2, "/dev/ttyUSB0", 38400 ); #else long State[NUM_STATE]; connectRobot( State, MAGE_MODEL_MAGELLAN, (char *)"/dev/ttyUSB0"); #endif
There are a few other differences.
- You'll need to include "Mage.h" instead of "Nclient.h".
- The Magellans use millimeters and milliradians for describing velocities and sonar/ir sensor readings. The Nomads use tenths of inches and tenths of degrees to describe velocities and inches for the sonar readings.
- vm( tv, rv ) - on the Magellans, the vm function takes in the translational velocity and rotational velocity directly. It is the same as scout_vm(t, r) on the Nomad.
- sonarOn(), irOn() - turn on the sonars and IR sensors on the Magellan. They replace conf_sonar on the Nomad.
- On the Magellans, it is not necesary to use gs(). Instead, you want to put a usleep(100000) call inside your main loop to keep it from running too fast. You'll need to #include >unistd.h< to get the usleep function.
Compiling for the Magellan is slightly different. You'll need to check out the Mage directory from the CVS repository on balin, compile Mage, and then use g++ to compile your code and link in the Mage library. Then just run your program.
$ cvs -d firstname.lastname@example.org:/export/cvsroot checkout Mage $ cd Mage $ make $ cd .. $ g++ -o myprog -IMage/include myprog.c -LMage/lib -lMage -lpthread -lm $
When you are using the Magellans, it is useful to create a set of virtual sensors that combine the readings from each sonar/IR pair. Don't just take the minimum reading, because the maximum IR reading is farther out than the minimum useful sonar reading.
Do each of these tasks with a partner.
- Have the robot orient itself so the three front sonars have the minimum average distance of any three adjacent sonars. The kind of behavior it should exhibit is to turn towards a flat panel held up near the robot.
Have the robot maintain a distance of 1m from whatever is directly in
front of it. You probably want to make some use of the two sensors to
the side, such as using their value if they are closer than the front
Since the robot is moving around in this task, you need to incorporate general obstacle detection. Have the robot come to a stop if it cannot maintain the distance from the object in front because of an obstacle in the rear or to the side.
- Combine the above two capabilities so the robot tracks a flat object and maintains a specific distance from it. The robot should follow you around the lobby if you are holding a flat piece of whiteboard, or even a large book. Once the robot has tracked on to an object in front of it, try to keep it from being distracted by other objects that may come close on the side or back.
- Write a program that enables the robot to follow a wall (pick right or left). You can assume it is just a straight wall with no corners. If the wall disappears, or an obstacle appears in front of it, the robot should stop and the program terminate.
- Add more complex wall following capabilities.
- Have the robot find a wall in the first place, then track along it.
- Implement the algorithm in the textbook for smoothly achieving a point.
- Find a paper on robot navigation/goal achievement and develop some code for the robot. How does the algorithm relate to what you did on the first task?
The writeup for each project should be a brief summary of what you did along with some code examples, terminal output, or screen shots, depending upon the assignment. Please organize the writeup as follows.
- Title of the project and your name
- An abstract describing what you did in 200 words or less.
- A brief description of code you wrote and experiments you ran.
- A brief description of what you learned.
Make your writeup for the project a wiki page in your personal space. If you have questions about making a wiki page, stop by my office or ask in class.
Once you have written up your assignment, give the page the label:
You can give any page a label when you're editing it using the label field at the bottom of the page.
Do not put code on your writeup page or anywhere it can be publicly accessed. To hand in code, attach it to an email and send it to the prof.