ARXTERRA APPLICAIONT & ARDUINO IDE
By Railly Mateo (Systems Engineer)
Approved by Paul Oo (Project Manager)
Approved by Railly Mateo (Systems Engineer)
Configuration:
To establish communication between the robot and the phone, its important to know how the Arxterra application works and what kind of information it will send to the microcontroller (Arduino Micro). To interpret what the various telemetry commands were: the Bluetooth device (HC-06) was connected to the Arduino Micro. Next, the arxrobot-firmware was uploaded into the Arduino Micro to establish communication between itself and the Arxterra application (Android version).
Testing Connectivity:
To test connectivity, begin by opening he serial monitor on the Arduino. Play around by pressing on the Arxterra application. When the phone is not connected to the Bluetooth, the monitor will display “emergency exception 0x0100”. When the phone is connected, it will display “robber received command: 11”. When pressing on a direction (forward), five data inputs will be displayed on the monitor. According Hill’s command PDF file, the Arxterra application sends a 7 element matrix to the microcontroller.
Data Interpretation:
Data [0] A5 = Command Packet ID
Data [1] 05 = Packet Length N w/o parity byte
Data [2] 01 = Move ID
Data [3] 01 = Left Motor Forward
Data [4] 80 = Half Speed (128/255)
Data [5] 01 = Right Motor Forward
Data [6] 80 = Half Speed (128/255)
Data [7] A1 = Longitudinal Redundancy Check (LRC)
For our robot, the only elements of interest are data [2], data [3], and data [5]. This is due to our project only using servos, in comparison to using servos and motors. Thus the speed of the robot will only be controlled by using delays in the walking code.
Data [2]: if the command bit is 1, that tells the command decoder to issue a move command.
Data [3] and [5]: These elements are direction bits. If both are set to 1, it is interpreted as forward direction (2 would mean the reverse direction). However, our servos don’t go in reverse, therefore we won’t be setting these elements to 2.
Setting Up Walking Code:
Begin by pressing on the arrow control panel. Then write down all the telemetry responses that would be needed. By playing with remote functions, you will notice that setting data[3] and [5] to 1 and 1 will be move forward, 1 and 2 will be move to the right, and 2 and 1 will be move to the left.
Walking Command Examples:
If (data3 == 1 && data 5 == 1), the Arduino will read a series of servos angle that will make the walking forward motion.
If ((data3 == 1 && data5 = 2)), the Arduino will read a series of servos angle that will make the right turn.
If ((data3 = 2 && data5 == 1)), the Arduino will read a series of servos angle that will make the left turn.
You can see the implementation of the code in the Prototype blog post.