CS 363: Assignment #2

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).


Magellan Information

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 usr@hasufel.cs

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_15IR readings (mm)
STATE_SONAR_O to STATE_SONAR_15 sonar readings (mm)
STATE_BUMPERBumper readings as first 16 bits
STATE_XX location (mm)
STATE_YY location (mm)
STATE_TOrientation (mrad)

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.


Tasks

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.

  1. 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.
  2. 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.
  3. 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.
  4. 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.
  5. 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.

Extensions


Writeup

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.

  1. Title of the project, your name, and your partner's name
  2. An abstract describing what you did in 200 words or less.
  3. A brief description of code you wrote and experiments you ran.
  4. Results. Videos would be good here.
  5. A brief description of what you learned.

Handin

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:

cs363s13project2

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.