P08201: RP10 Drive Platform 2nd Generation
/public/

CESite

Table of Contents

Software Design

Communication Strategy

The goal of the communications subsystem is to deliver a method for successful remote control of drive and steering motors using wireless technologies. The main controlling unit of the subsystem is an 8-bit Freescale microcontroller. This microprocessor was chosen because of the team's familiarity with the board and because it was readily available from the Computer Engineering department. A pair of Crossbow TelosB motes is used to deliver user commands remotely from a laptop to the microcontroller.

Wireless Communication: The 10kg robotic platform developed last year was controlled using commands sent from a laptop, which was connected to the platform through a tethered wire connection. In order to extend the control range of the robotic platform, a wireless communication system was implemented.

At the initial stage of the design process, various approaches were evaluated and analyzed. These included the use of a RC kit, infrared remote control, and Crossbow wireless modules. After much deliberation, the pros and cons of using each design route were researched and examined. The main advantage of using an RC kit is that it has most of the hardware and functionalities built in, including joysticks and RF communication. However, an RC kit lacks the capability to support the navigation system. Infrared remote control has a similar advantage as the RC kit, but line of sight would be required for communication with the robot. The Crossbow TelosB wireless module was selected for the final design because it uses radio frequency to communicate and thus does not require line of sight. It can also be plugged into a computer through a USB/Serial port, allowing most computer platforms to reuse the design as long as the source code can be obtained. It also has a greater range of coverage area and the capability for extended functionalities to be added in the future. The following sections will describe the Crossbow TelosB wireless module in a more detailed manner.

Graphical Interface UML Diagram

Graphical Interface UML Diagram

Hardware: Two Crossbow TelosB wireless modules are used in this project; each wireless module has a transceiver, so it has the capability to both transmit and receive data. The TelosB mote, a small, low powered device capable of forming a network, has a USB connector which allows for communication with a PC; software can then be downloaded onto both of the motes. The TelosB mote is IEEE 802.15.4 compliant with a 250 kbps data transfer rate over radio and it has a communication coverage range of up to 30m indoor. Onboard expansion connectors provide the capability for the mote to communicate with external devices. Two of the pins from the U2 10-pin expansion connector allow for UART (Universal Asynchronous Receiver/Transmitter) communication. UART is a hardware used to translate data between parallel and sequential forms. These UART RX and the UART TX pins are used to exchange data with the microcontroller. Software implementation allows the mote to write 3V TTL signals to these output pins which is then connected to an interface board to convert TTL logics to RS232 standard communication. The central microcontroller reads signals from the RS232 port to determine commands.

Software: Java and nesC are the main programming languages used for this project. nesC is an extension of C which is used to support network applications, allowing applications to exchange information on platforms with TinyOS. TinyOS is a compact event-driven operating system which is designed for network applications. TinyOS version 2.x was used for this particular project. Java was used to implement the Graphical User Interface (GUI), which takes user inputs and controls the behaviors of the wireless motes. The following is the UML which describes the overall software layout and connections:

The program TestSerial is the main control of the GUI. It has two main objects contained within it. The first object is the MoteIF object, an abstraction of the actual Crossbow Mote, has functions such as SendPackets and messageReceived. By using these two functions, the java program will be able to communicate with the TelosB mote through the use of serial forwarder with the USB port opened. The wireless mote will receive the packet as if it came from another mote. The second object contained within the class TestSerial is the UserInterfaceGUI object, an inner class which resides within the main control to generate all the GUI components. Upon creation of the object, it

Wireless Mote State Diagram

Wireless Mote State Diagram

creates a JFrame with various components and enables KeyListener to detect key presses on the keyboard. Key presses are interpreted as different commands from the user including RAMP_UP, RAMP_DOWN, EMERGENCY_STOP, STOP, TURN_LEFT, TURN_RIGHT, etc. After commands are interpreted from the GUI and sent to the motes, a series of events is triggered to allow the motes to communicate with each other.

The diagram above gives an overview of the communication sequences for the wireless motes. Upon receiving a packet from the GUI, a message received event is triggered in the mote on the base station, and it broadcasts another packet with the command, node id, sequence number, and any additional parameters. The mote on the robotic platform receives the packet and authenticates it using the node id to verify that it comes from the intended source before processing the data. Once the packet is authenticated, the mote will turn off the transceiver and prepares for UART transmission. The reason for this is because it shares the same hardware resources as the UART thus both cannot be turned on at the same time. In addition, instant on/off of transceiver and UART can possibly cause loss of data bits in packets. In order to avoid such events from happening, a timer is used to maintain a setup time before the UART transmission as well as after the transmission. This will assure that the UART has enough time to initialize the resources prior to sending. Acknowledgements and sequence numbers are used to minimize packet loss during the switching between the two operations.

The various components of the microcontroller subsystem are discussed below.

Microcontroller

The main reason for choosing the Freescale CSM12D microcontroller module over the PIC dsPIC30F4011 microcontroller used last year was because of the team's previous experience with it. The board includes 7 channels of 8-bit pulse-width generators, which are required to control the drive and steering motors. The various duty cycles that are generated determine how fast the motors spin, so the platform travels at a faster rate as the duty cycle increases.
Freescale Microprocessor

Freescale Microprocessor

The microcontroller is the main gateway between the user and the robot, handling all commands sent to the platform and interpreting all feedback from the robot via the encoders on each of the four motors.

The microcontroller communicates directly with the Crossbow TelosB mote via a UART-to-RS232 conversion kit. Three volt TTL output signals are fed into the TX and RX pins on the interface board from the 10-pin expansion connector on the TelosB wireless module. The interface board then converts the TTL level signals to RS232 standard communication protocol to allow for data exchange with the microcontroller.

There are six PWM channels altogether, two of which are connected to the drive motors and the other four are connected to each of the steering motors. The two PWM channels that are connected to the drive motors are split between each side; one drives the left motors while the other drives the right motors. This is multiplexed since there are not enough PWM channels on the Freescale board. In addition, there are five additional digital outputs from the microcontroller. There are two sets of two directional outputs, one for left/right, and the other for forward/reverse. A high signal indicates left for the left/right pair and forward for the forward/reverse pair. The last output is an active low emergency stop-enable output.

The microcontroller also has twelve digital inputs, four each for the steer module, drive module, and the steering alignment. The four steer module inputs are feedback from steering encoders from each of the four different motors. They will be interrupt driven. The four drive inputs are feedback from the driving encoders. Four 8-bit pulse accumulators receive pulse data from the encoders and then store them in a bigger register every 100 ms. The frequency of the pulses is then used to determine the speed at which the platform is moving. Steering alignment is accomplished using four polled inputs that will reset the position of the steer motors when the platform is skidding or turning when it should not be.

Encoders. There are eight encoders total, a pair (one drive and one steer) mounted on each of the motor module. The encoders provide feedback of important data to the microcontroller. It will also be used to determine whether or not the robotic platform is moving as intended. For example, one motor may be spinning faster than another, and the feedback can be used to adjust the motors so they are all operating at the same speed.

Since all the motors may not be exactly the same, we need a way to calculate the duty cycle to apply to each of the motors. Equation 4.1 is used to compensate for any variation between the motors and equation 4.2 is used to determine the speed error of the left and right motors.

Microcontroller Components

Freescale Microprocessor

Wireless Modules

Strengths

Areas for Improvement


Home | Software Repository