Robot Motion Strategies
For this assignment you'll implement some simple reactive programs on the real robot. The programs will let the robot do some basic tasks like wandering around and not running into anything (it is hoped).
The two netbooks on top of the robots are what you will use to write and test your programs. The netbook hasufel.cs is on Frodo, and arod.cs is on Sam. Please do not mix them up. You can ssh into them from another computer using the following.
ssh -Y email@example.com
In the usr account on each netbook is a directory called cs363-S13. Create a subdirectory in there that you will use with your partner. Please respect one another's code.
Also in the cs363-S13 directory is a subdirectory called examples. In there you can find an example called move.c and a makefile. Use these files as templates for your own code. The file is an implementation of the second task, but without any mechanism for stopping if there is an obstacle.
Just like with the nomads, there is an array of integers that you access in order to get sonar/IR and configuration information. However, the State variable is not a global variable. In the move.c example, it is an array declared in the main function. Passing the State array into the connectRobot command links the array to the Mage process that communicates with the robot hardware.
The macros for accessing the State variable on the Magellans are slightly different. Look in the file /usr/local/include/Mage.h to see what the macros are. You will need to include Mage.h in your programs and link the Mage library to your executable in order to connect to the robots. Use the example makefile as a template. The most important macros are listed here.
|STATE_IR_O to STATE_IR_15||IR readings (mm)|
|STATE_SONAR_O to STATE_SONAR_15||sonar readings (mm)|
|STATE_BUMPER||Bumper readings as first 16 bits|
|STATE_X||X location (mm)|
|STATE_Y||Y location (mm)|
The API for the Magellans is very simple.
|vm( long t, long s )||sets the translation and steeering velocities (mm/s, mrad/s)|
|sonarOn(void)||turn sonars on|
|sonarOff(void)||turn sonars off|
|irOn(void)||turn IRs on|
|irOff(void)||turn IRs off|
There is no simulator for the Magellans, simply run your program and be prepared to hit the stop button, if necessary. As noted in the lab, putting the robots on top of a small trash can while testing can save both you and the robot a lot of wear and tear.
The basic idea is to take the tasks you implemented on the Simulator and demonstrate them on the real robot. We will use the two Magellans, and can pull out the third, if necessary.
Do each of these tasks with a partner and produce a single writeup.
- Write a program that takes in a command line argument that is the number of degrees to turn. Positive is a left turn, negative is a right turn. Have the robot turn that number of degrees in a smooth fashion. Remember the Magellans work in millimeters and milliradians, so adjust your programs accordingly.
- Write a program that takes in a command line argument that is the distance the robot should move forward. Positive is forward, negative is backward. Have the robot move that distance in a smooth fashion, stopping if it is about to run into any obstacles.
- Write a program that takes in a position on the plane relative to the robot's current position and has the robot move smoothly to that position. The robot's starting location when your program begins is always (x, y, r) = (0, 0, 0), where x is forward, y is left, and r is orientation relative to a global direction axis. A simple strategy is to aim the robot at the desired point and then go forward.
- Write a program that lets the robot wander around without bumping into things. Use the sonar and IR sensors to identify obstacles in the robot's path. It is often beneficial to group each IR/sonar pair into a single virtual sensor by taking the minimum reading from the two, if the IR is reporting a value less than a certain cutoff. It may also be beneficial to group sets of virtual sensors together to smooth out the noise caused by reflections.
- Write a program that keeps the robot a fixed distance (e.g. 1m) away from whatever is in front of it. Make sure the robot pays attention to it's rear sonar as well so it does not run into anything while trying to get away from whatever is in front.
- Write a program that lets your robot follow a single wall, similar to the cockroach robot, only with sonars instead of antennae (hard).
- Add the capability for the robot to track the obstacle in front of it if the obstacle rotates around the robot.
- Find a paper on robot navigation/goal achievement and develop some code for the robot.
- Ask how to get the laser working and integrate it into your tasks.
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, your name, and your partner's name
- An abstract describing what you did in 200 words or less.
- A brief description of code you wrote and experiments you ran.
- Results. Videos would be good here.
- 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.