Fall 2016 Biped – Code/Software Update
By: Alan Valles (Electronics and Control)
Approved by: Ijya Karki (Project Manager)
Table of Contents
Introduction
The purpose of this document is to explain the logical flow of the firmware portion of the Biped. Several external libraries will be used in order to control our electromechanical devices with firmware.
Analysis
The most recent design iteration of the Biped walking robot calls for a single DC motor, four servos to turn and shift center of mass, and a color sensor to detect power pads which will be on the floor. The single DC motor will provide the electromotive force for two legs which will be out of phase by 180 degrees through a crankshaft. The servos will provide the x and y shifts in the center of mass.
There are several additional libraries that we will be using. The non-default libraries are, Robot3DotBoard, ADS_1015, and I2cDev which includes the MPU6050 files. As a side note, I am using the Arduino IDE with an external text editor for all of the screenshots below.
As the program is running, it will constantly read the rotary position sensor by requesting this information from the ADS1015 which will be connected onto the I2C bus. Thus, depending on the user input into the app which will be in RC mode, it will move the motors to the correct position in order to turn or continuously go straight. Similar to the code snippet below.
Other control logic will be implemented based on the parameters received from the Move command. Depending on the button pressed in the move command, i.e. straight left,right, or reverse. The desired motor position may be different. For example, when making a left turn, the DesiredMotorPosition will correspond to the value of the left foot planted, the code will then stop the motor. Next, code will be inserted to move to ankle servo to a specified angle, and walking will commence again. This will be repeated but then the servo will move back to the home position.
Some challenges will be the Servos maintaining 0 degrees home position throughout the game. I have noticed that due to the difference in servo control boards, play in gears or other unknown factors, the servo position seems to every so often move to the 0 degree position but with an offset. More detailed code will be uploaded to the Github once it has been found to be bug free.
Conclusion
In conclusion, the electromechanical devices will be controlled utilizing our Firmware design. Several external libraries will be used in order to ensure mission success and maintain a controlled walking and turning motion.
Reference
[1] https://github.com/jrowberg/i2cdevlib[2] https://github.com/adafruit/Adafruit_ADS1X15