- Select the transport: TCP or UDP;
- Design the protocol for carrying the control messages;
- Design and implement the server application (running in OpenWrt linux);
- Design and implement the client application (running in Windows or desktop linux);
(2) In the second point, a very simple protocol for carrying the control messages have been defined. Each packet has the following:
- CSEQ - (2 bytes) a field containing a sequential number for each message. It helps keep track of message order and rate of packet loss;
- CODE - (2 bytes) describes the type of the message (can be CONTROL, STATUS, or KEEP_ALIVE);
- LENGTH - (2 bytes) indicates the size in bytes of the payload (the field that follows);
- DATA - (0 - 18 bytes) the data itself;
- CHKSUM - (2 bytes) a simple 16 bit check sum of the entire packet.
- CHANNELS - (16 bytes) each channel is a 2 byte value which corresponds to the pulse width to be applied to the corresponding servo;
- BUTTONS - (2 bytes) each button in the joystick is represented by one bit, which contains its status.
(4) For the client I have given preference to implementing it in Java. The only challenge however was that Java doesn't natively support Joystick devices, so I had to find a library to take care of that. After a bit of searching I have found JXInput (http://www.hardcode.de/jxinput/), which seemed to be a decent library, with reasonable documentation and examples. All I had to do was using this library in my application (in the form of a Jar), and have the necessary windows dll in my application folder. This dll establishes the bridge (through JNI) to the Windows Joystick (or any other HID) API. Here is a screenshot of my application:
It connects to the car, passing steering commands from the joystick device. The user can select the joystick to use, and enter the IP address and port of the car.
A few photos of the car, during a maintenance task. In the aileron is the battery pack for the control electronics (the Fonera and the MuIn):
A bottom view of the sensor and control block (the heart of the robot), with all the necessary components:
Now controlling the "beast" is as simple as playing a videogame :)
Don't need the big 41 MHz antenna anymore, great! It's now easier to get under the table and say...watch under the skirt :)
No comments:
Post a Comment