The principle behind getting the robot to balance is to shift its weight. The amplitude of force from each leg sensor is used to calculate the robots center of gravity. The information is used to determine what adjustments are needed to move the robot in the most stable position.
As a rule of thumb, when the center of gravity is located directly in the center of all the legs, the robot will be in its most stable position. Only the sensor that are touching the ground will be used to balance the robot.
In order for the robot to shift its weight back an forth, it extends and retraces its legs accordingly. The robot extends its leg, to reduce the weight exerted on that leg. Similarly, the robot reduces the weight exerted on that leg by retracting it. In general, this rule only works if there are three or less legs touching the ground.
In the event that all four legs are in contact with the ground a this rule partially fails. If the robot extends it leg, it is certain that the weight component on that leg will be reduced. However, if it retracts its leg, one of two things can happen.
Either the robot tips over on that leg, or that leg may be lifted off the ground. In the event that its center of gravity is closer to the retracting leg, the robot will tip onto it and its share of the weight will be increased. On the other hand, if the center of gravity is further away, the robot will just lift that leg off the ground.
Therefore, in balancing 4 legs, the algorithm is slightly changed. If the weight shared by any leg is less than average, it does nothing. Only if the weight exceeds the average, action is taken by extending that leg. When the robot's leg reaches it maximum length and still needs to extend, it keeps that leg the same and retracts all others. It effect if a leg has too little weight it waits for one of the legs with more than its share to transfer it over.
The R/C servos used in this project require a specific square waveform to control the angle of the servo. To save money from using a separate microprocessor or even a servo controller, all the timing was conducted by the same microprocessor. For this reason, a timer within the microprocessor was used to send a control signal to the servos.
Furthermore, the timing could not be performed using delays because its would consume too much of the microprocessors time, and not allow for anything else. To alleviate the problem interrupts were used so that the microprocessor would only be occupied with the waveform timing when it needed to be
Table of Content