Hexotica - The Design and Implementation of a Small Walking Robot
10. Appendix B - Application Files
This file was used for the initial debugging of the ADC interface software. It repeatedly reads in the value of the three ADC registers. The values are printed out to the screen.
These ADCs are currently used to measure the potentiometer voltages at the three leg joints. The values are then converted into angular positions. Each ADC has two variable inputs connected to trim pots. These trim pots are used to adjust the voltages such that the full range of motion of each angle is measured over the entire 5V input. The value of each of the angles is as follows.
Angle Value Angle g 0 50o 255 -45o q 0 40o 255 180o b 0 90o 255 270o Table 3 - Calibration values for potentiometers
When the ADC values are read in, they must be converted to a meaningful quantity. The ADC libraries provide functionality whereby the ADC structure is initiated with a multiplying constant and an offset that are used for this conversion. The following set of equations shows the relationships between the ADC value and the angular position for each of the three leg joints.
Equation 10 Conversion from ADC values to angular positions
This file performs the same function as the adc.c file but reads all six potentiometers from a leg pair.
adcsmth.c
During development, it was noticed that there seemed to be a considerable amount of noise on the readings taken by the ADCs. In order to minimize the effects of this noise, an averaging low-pass filter was applied. This file was used to develop and test the effectiveness of the filtering process.
In order to debug the low level control software, a local copy of the controller was created. By providing a command line interface, the low level control code can be debugged on a single pair of legs. When this control code is working correctly, the command line interface is then replaced by the TIA/EIA-485 serial interface and the high level controller is given the ability to control each of the legs. Table 4 shows the commands available for the low-level controller.
Command
Arguments
Description <
none
decrease alpha >
none
increase alpha -
none
decrease Kp +
none
increase Kp [
none
decrease Kd ]
none
increase Kd a
none
acknowledge error h
none
help m
leg(#), position (#), speed (cm/s)
move to a via-point at a given speed. q
none
quit r
leg (#)
request status s
speed (cm/s)
start x
none
stop Table 4 - Commands for leg control program
These files contain the low level control code that accepts commands from the high level controller via the TIA/EIA-485 serial link. Each module runs a copy of this software with a unique slave number, identified by the SLAVE_NUM constant. This number is used to identify the destination of the commands arriving from the high-level controller. Table 5 shows the messages that are sent from the high level controller to the low-level controller.
Command
Arguments
Description MSG_DIRN
none
decrease alpha MSG_MOVE_LEG
leg(#), position (#), speed (cm/s)
move to a via-point at a given speed. MSG_QUIT
none
quit MSG_REQ_STATUS
leg (#)
request status MSG_SND_STATUS
leg(#), via index (#), in position (bool), move_flag (bool)
send status MSG_START_LEG
speed (cm/s)
start MSG_STOP_LEG
none
stop Table 5 - Messages used by high level controller to execute low-level commands
This file contains the code necessary to control the high level controller. It provides the developer with a command line interface with which to supply commands to the controller. These commands are interpreted and appropriate messages are sent to the low-level control modules. Feedback is displayed via the standard I/O channels.
Command Arguments Description < none decrease alpha > none increase alpha c leg (#) check in position h none help m leg (#), via-point (#), speed (cm/s) move leg to position q none quit r leg (#) request status s leg (#), speed (cm/s) start t tripod (#), via-point (#), speed (cm/s) move tripod to position w speed (cm/s), gait (r-ripple, t-tripod) walk x none stop Table 6 - Commands for high level control program
This file was used for the initial debugging of the speed control of the motor interface software. It commands the three motors of one leg to move through sinusoidal velocities.
This file was used to debug the motor control of a leg pair. It commands all six motors of a leg pair to move through sinusoidal velocities.
This file was used to test the ability of the controller to command a motor to a particular position. It uses the potentiometer reading of the angles to drive the motors to particular angular positions. When the motors arrive at that position, another position is selected and the motor is driven back.
This file was used to calibrate the motor speeds. It commands the motors through 0-100% of their duty cycle in increments of 10%. The speed of the motor was measured and plotted against the commanded signal. The plots and tables of measured values are shown in the following tables and figures. These measurements were then used to calibrate the motors to convert a supplied angular velocity or torque command into a commanded velocity signal.
Table 7 - GAMMA calibration values
.
Figure 53 - GAMMA calibration curve showing equation
Table 8 - THETA calibration values
Figure 54 - THETA calibration curve showing equation
Table 9 - BETA calibration values
Figure 55 - BETA calibration curve showing equation
This calibration was not very rigorous and further work should be done if and when new motors are selected. Proper testing equipment would allow the torques of the motor to be determined. This information could then be used to properly calibrate the motors.
This file is the original attempt to interface to the motor speed control unit. The motor libraries were developed based on this development effort.
10.5 TIA/EIA-485 (RS485) Master-Slave networking
This is the master side of the TIA/EIA-485 master-slave networking software. It was taken from the SmartCore reference manuals and was subsequently used as the basis for the msg libraries.
This is the slave side of the TIA/EIA-485 master-slave networking software. It was taken from the SmartCore reference manuals and was subsequently used as the basis for the msg libraries.
copyright information
Back to home
page. Last updated: April 20th,
1997