CS 363: Assignment #4

Introduction to the Nav Module

The Nav module provides an interface to the robot's sensors, basic motion functionality, and a safety mechanism for slowing the robot near obstacles.


You'll need to work on the Magellans from here on out. The Nav module will take care of talking to the robot from now on, so you just need to make sure you're working in the right units (mm and mrads). You'll either be working on code within the Nav module, or writing code that talks to the Nav module via IPC.

When working with the Magellans, the most important thing to watch is the battery power level, which you can read on the LCD display. If it drops below 24V, please put the robot on the charger for at least an hour. Likewise, be aware of the power levels of the laptops and have them on a charger whenever possible to maximize battery life.

The Magellans have an electronic brake, which you have to turn off in order for them to move. You can do this via the LCD display and the control button, which turns to select different options and pushes down like a mouse click. Starting up the Magellan or hitting the big red button turns the electronic brake on. When shutting down a Magellan, you do not need to shutdown the PC first, since we are no longer using the onboard PCs. Just select Kill Power.

Create a project folder for your group. You will use the same project folder for the rest of the semester. Make it separate from what you have used up until now. Then check out the following packages from CVS into your project folder.

You can check out all of the above packages in a single command.

cvs -d usr@balin.cs:/export/cvsroot checkout Mage gcm-devel nav-devel svm-artk svm

Make the packages in the the order they are listed above. For each one, go to the top level and type make. The packages are dependent upon one another and expect to all be in the same working directory. Overall, your working directory should probably follow the structure given below.

|      |          |          |         |    |
Mage   gcm-devel  nav-devel  svm-artk  svm  control  

The control directory is where you will put the code for your control module.

Whenever you need to run the nav module (snmd) or the vision module (svm), you will first have to make sure central is running. central is the IPC message server, and the nav module and svm depend on it being active before they will start properly. To start the IPC server, just open a terminal and type central. Make sure another server is not already running at the time. You can leave the server running; there isn't much reason to turn it off.


  1. Take a look at the file in the nav-devel/src directory called snmd-control.c. This file is an example of a simple, text-menu interface that lets you control the robot. You can make the robot achieve a point (open loop), rotate (open loop), or wander. Look at the C file and identify the majors parts of the program: initialization, connection with IPC, the menu section, how to send the nav module a message given the user's selection, and termination.
  2. Start central, start snmd (nav module), then start snmd-control and test out the various functions. These include rotate, achieve, and wander. The code that implements these functions is in nav-devel/src/comp.c. Look at the implementation of rotation (comp_angAchieve). NAV_ORIENTP is defiend in navLib.h. Try modifying it to see the effect of increasing or decreasing its values. Where in the control regime does a proportional constant of 0.5 place the robot?

    Note that none of the functions like comp_angAchieve actually send a command to the robot. The task of these functions is to consider the robot's current state, by looking at the State vector, and then calculate appropriate translational and rotational velocities, which are placed in snmd->transv and snmd->rotv. These functions should be fast, should not send any commands to the robot, and should try to return as quickly as possible. If the robot is in the angle achieve state, then it will call comp_angAchieve until the goal is reached, at which point the comp_angAchieve functions sets the variable snmd->curr_comp to NAV_COMP_IDLE, which means the robot will idle until it receives another command.

  3. Note that the comp_wallFollow and comp_spaceFollow functions are not implemented (they do nothing but set the rotv and transv values to 0). Pick one and implement it.

    The base functionality of the wall following should just be for the robot to orient itself to the nearest object and then attempt to wall follow so long as the wall exists and there are no obstacles in front of it. If the wall disappears or an obstacle comes up, then the function should set snmd->curr_comp to NAV_COMP_IDLE and send a GCM_ACK_COMPLETE message, similar to the comp_angAchieve function.

    The base functionality of the space following function should be for the robot to select the most open path available to it and follow it as long as it can. It should have some hysteresis (a tendency to continue in the direction it chose) so that it doesn't oscillate back and forth between directions in a hallway, for example. Think of it as pursuing empty space rather than avoiding obstacles. You probably want to take the minimum value of readings over the last three cycles to get more stable and robust values.

    Once you have implemented one of these, edit snmd-control.c so that it can send a message to turn the capability on. Look at the wander case as an example. Wall following and space following will both use the mode GCM_NAV_AUTO, and the cdata field needs to be set to wallFollow or freeSpaceFollow.

  4. Using snmd-control.c as a template for inialization and termination, in your control directory start a new control module. Call it control1.c When it starts up, Control1 should tell the nav module to go into wander mode, wait one minute as the robot wanders, then tell the nav module to stop, and terminate. Have Control1 print out status updates as it runs.



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 and your 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.
  5. 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.