ROBOT
CONTROL
A
simple GUI runs on the PC during the localization
process. The GUI gives you some simple options for
commanding the Robosapien. For this project, the
commands were limited to Stop, Go Forward, Turn
Left, and Turn Right. When you select a command,
the computer sends a command packet down the serial
port to the C node, which broadcasts the command
packet over the wireless network. When the R node
receives this packet, it executes the command specified
on the Robosapien and then broadcasts a packet to
signify that it has performed the command. Meanwhile,
the T node stops sending information after it receives
the command packet so it won’t bog down the network.
It then begins its transmissions once it receives
the command-executed packet from the R node.
To
ensure that the correct command has been executed,
both the command and command-executed packets also
contain a command number indexed from zero at the
beginning of operation. It wraps back to zero when
the maximum command number has been reached. Table
1 includes all of the packets and their formats.
The
final phase of our project involved executing a
command at node R on the Robosapien. After dissecting
the Robosapien, we decided that the easiest way
to command the robot using a Freescale ZigBee node
would be to replace the Robosapien’s infrared receiver
with the ZigBee node. The node was programmed to
mimic the signals from the Robosapien’s infrared
receiver. These signals were discovered experimentally
with an oscilloscope. We found that command signals
sent to the Robosapien were made up of four distinct
time slices: 7, 3.3, 1, and 0.7 ms. When data isn’t
transmitted, the logic level for the command signal
is high (logic 1).
For
example, take a look at the Go Forward command in
Figure 3. These signals include only four time slices,
so they are easily stored on a Freescale node as
an array.
Take
a look at the Go Forward command stored on a node:
int
FORWARD_COMMAND[] = {1,2,3,4,3,4,3,
4,3,4,3,2,3,2,3,4,3,-1};
Each
number represents one time slice. The terminating
-1 exists because not all commands are the same
number of time slices. This format allows for a
simple while loop command implementation that uses
a delay function to create each time slice. Port
C5 on the MC13192 evaluation board was connected
to the Robosapien’s IR receive wire in place of
the actual IR receive module. We were able to transmit
commands from the ZigBee network to the Robosapien
by toggling port C5 high and low.