Getting Started | Lesson 1 | Lesson 2 | Lesson 3 | Lesson 4 | Lesson 5 | Hardware

Lesson 3 - RobotCmdGUI

RobotCmdGUI is a java application included in contrib/cotsbots to test, debug, and control the CotsBots. This tutorial will go over using some basic features of RobotCmdGUI including testing communication between the Mica mote and Motorboard, calibrating the servo, and simple open-loop navigation.

Starting RobotCmdGUI

Modify Classpath

In order to use any of the tools in the CotsBots directory, it is first necessary to modify your classpath. Because the software is located in the contrib directory, you should add the following path to your classpath -- {INSTALL_DRIVE}/tinyos-1.x/contrib/cotsbots/tools; where {INSTALL_DRIVE} is where the tinyos-1.x directory is located. You can do this with the "export CLASSPATH=" command or if running cygwin, you may also set up a CLASSPATH Environment Variable in Windows. Use
to make sure your classpath is now set up correctly.

Compiling CotsBots Tools

A Makefile is provided to compile the java code in the contrib/cotsbots/tools directory.
	cd contrib/cotsbots/tools
You should see a string of commands showing various files being compiled. Errors are most likely due to the java classpath not being set up correctly.

Using SerialForwarder

RobotCmdGUI currently requires SerialForwarder to operate so that it does not compete for the serial port with any other services you might be running. SerialForwarder is covered in Lesson 6 of the TinyOS Tutorial and is covered in less detail here.

SerialForwarder reads and writes data over a serial port from an internet connection. To run this program, cd to tinyos-1.x/tools/java and

	java net.tinyos.sf.SerialForwarder -comm serial@COM1:[baud rate]
where baud rate can be simplified to "mica" or "mica2" depending on which Mica mote you are using. If using a different COM port, be sure to change this as well.

Starting RobotCmdGUI

Once SerialForwarder is started, you can now run RobotCmdGUI. Change to the contrib/cotsbots/tools/ directory and run
	java RobotCmd/RobotCmdGUI [group-id]
where "group-id" is the Group ID used when you compiled for the Mica or Mica2. If your Makelocal defines group-id to be 0x19, run
	java RobotCmd/RobotCmdGUI 25

Setting up the Robot(s) and Base Station

Load MotorBoardTop

Based on the previous tutorials, you should already have MotorBoardTop installed on the Motorboards you are using.

Load TestMotorBoard

TestMotorBoard is an application that allows a user to test communication between the Mica mote and Motorboard, as well as drive the robot from the RobotCmdGUI. To install, cd to the contrib/cotsbots/apps/TestMotorBoard directory and run
	make mica2 install
if using a Mica2 mote. If you are using Mica motes, replace "mica2" with "mica".

Load TOSBase

In order to talk to Mica motes over the radio, you need to create a base station which will connect to the serial port on your computer and forward messages from the computer to the radio and vice versa. To install, cd to the tinyos-1.x/apps/TOSBase directory and install the application. Make sure that you are using the same type of Mote for TestMotorBoard and TOSBase. You'll also need to make sure that the group IDs are the same for the base station mote and the TestMotorBoard mote (can be modified in the apps/Makelocal files). Keep the base station mote in the programming board and connect it to the serial port on your computer.

LED Test

The easiest way to test that things are working properly before the Mica mote and Motorboard are attached to a robot is to try toggling the LEDs on the Mica mote and Motorboard. Switch to the "Other" tab and try pressing the "Toggle Mica LED" button. You should see the command you just sent to the Mica mote appear in the text box to the right and the yellow LED on the Mica should toggle. If this doesn't happen, make sure SerialForwarder thinks it is sending messages and the Base station should toggle an LED each time you send a message.

Once you can toggle the Mica LED, try the "Toggle Motor LED" next. The red LED on the motorboard should toggle. Failure could be due to a mis-calibrated clock (see Lesson 1) so that the UART is not timed correctly.

Car Control

To test that you've connected all of the wires correctly on the CotsBots, connect the TestMotorBoard mote and Motorboard to a robot. Switch to the "Car Control" tab and try driving the car from the GUI. I would recommend first holding the car as you try this so that it doesn't run out of radio range while you are searching for the "OFF" button.

Servo Calibration

In Lesson 1 it was mentioned that RobotCmdGUI could be used to calibrate the Mini-Z servo. Switch to the "Servo Calibration" tab and try getting the "straight" value as well as "Kp" and "Ki". If this doesn't work the first time, try again a couple times. Setting "straight" will be covered here and it will be assumed that the same process may be repeated for "Kp" and "Ki".

First, set your new straight value. For a rough look at straight, I recommend turning the wheels all the way to the the left or right using the turn slider and then resetting to "straight". If you are off significantly, it will be obvious here.

For finer adjustment, try driving forward with this new straight value. Remember to reset the wheels to "straight" each time you change the straight value by turning the wheels significantly and then moving them back to straight.


Load TestNavigation App

The "Navigation" tab requires you to load a different application on the TestMotorBoard mote. Install TestNavigation on this mote instead. This application will interpret the navigation messages sent by RobotCmdGUI to navigate from a particular point and orientation to another point. It is important to note that since we are not currently using any odometry or speed sensors, this is entirely open loop and the accuracy will depend heavily on battery power, floor surface, etc. The calculated path is shown in the GUI for the points given and assumes the Mini-Z base is being used.

Running TestNavigation

To run TestNavigation, enter the starting point (x1,y1) and the starting orientation using (numerator, denominator). The starting orientation is calculated using numerator*PI/denominator. If starting at orienation PI/2, numerator = 1 and denominator = 2.

Plug the TestNavigation mote into the CotsBot and power it up. You can then play around with navigating from point to point.

There are other features available in the RobotCmdGUI (namely figure8 calibration) which you can play around with on your own.

Go to Lesson 4