# How do robots maintain stability?

I've been watching a clip of a robot dragging a heavy load behind it.

I am wondering, in a fairly high level, how does the robot maintain its balance?

For example, I know that with a Segway, there is a gyroscope which senses in which direction the Segway is tilting, to allow the wheels to move accordingly to maintain balance. Is it the same principle with stabilising a robot?

I have also seen that some robots use accelerometers for stabilisation. Do robots need both an accelerometer and a gyroscope?

Would there also be some kind of proportional–integral–derivative (PID) controller, such that when the robot notices that it is tipping backwards, the applied extra forward force does not cause the robot to overshoot?

• For the segway, look up the "inverted pendulum" problem. Jan 22, 2016 at 21:58

PID, LQR, and LQG feedback control laws are only small pieces of the solution. Alone, these methods generally cannot solve the problem of balanced bipedal walking.

The reason why is because these aforementioned control laws are designed to send the dynamics to a single, stable equilibrium point. If our goal is only to keep the robot balanced while standing, the aforementioned control laws suffice. Standing upright consists of a single point in the robot's dynamical configuration space and these control laws can make that point stable with respect to small perturbations.

Stable walking, on the other hand, consists of the dynamics following a periodic trajectory in the configuration space (also known as a stable limit cycle in ordinary differential equation terminology). Designing control laws to ensure this is extremely difficult due to the extreme non-linearities associated with the dynamics. Often, this cannot be done analytically and is too complex (or risky) to accomplish by mere trial and error. Instead, this is often done numerically through a process called trajectory optimization, where an "ideal path" of the robot is prescribed and a numerical method determines the best approximation to this path that the robot can achieve, where the criterion for "best" is determined by a specially chosen cost function which accounts for both the ideal path and the limitations of the robot.

Often, the solution involves non-constant gains on the actuators. This is something that linear feedback laws like PID cannot achieve. PID's come into play when trying to achieve a particular action with a particular actuator, but is far from sufficient when tackling the overall problem of dynamic balance while walking.

This discussion, of course, also assumes that you have a "good model" of the robot's dynamics to begin with. That, my friend, is an entirely different struggle in and of itself.

• Nice concise explanation of the limitations of conventional feedback control. +1 Jan 25, 2016 at 3:16

Clearly there are a lot of different potential solutions to this depending on the application and design approach. Also, as is clear from the video, bipedal robots are still a long way from achieving the level of elegance in walking that most humans manage with little conscious effort.

As the most important comparison is with humans, it's worth looking at how humans maintain balance. This can involve a lot of senses working in concert.

A key organ is the set of tubes in the inner ear, which is essentially a set of accelerometers. Humans also have an innate sense of where our limbs are in space in addition to a fairly refined sense of both external pressure and exactly how much force our muscles are providing.

Clearly sight is also very important, not just for sensing obstacles but in providing a reference point for speed, position and orientation.

Another very important factor is that the human body has a lot of degrees of freedom and hundreds of different muscles that can act as springs and dampers as well as actuators. Indeed, this is one of the big challenges in humanoid robot walking. Although it's not to difficult to assemble the main joints (e.g. hips, knees and ankles) and provide them with pairs of pneumatic pistons, in real humans the whole body is involved in maintaining balance with constant, subtle and dynamic adjustments in stance to adjust the centre of mass.

In terms of the actual mechanism of the control system it's fairly clear that a human brain is a very different thing from conventional software control. One of the big challenges is that, unlike something like steering a car where a certain control input gives a known response, with walking the whole geometry of the system is constantly changing and the input required might be the sum of a large number of different muscles, indeed there might be a large number of possible inputs to achieve the same output.

With this in mind there are a number of approaches to control. The first is what you might call a 'brute force approach' where you have many sensors and a lot of computing power to model the whole system as a series of free body diagrams and try to model the whole system in sufficient detail that PID control can be effective. But as already mentioned the obstacle here is that the response required for a given correction may be ambiguous.

Another approach is to come up with a algorithm that responds to certain conditions in certain ways with a more limited degree of feedback-based control, i.e. you have a predetermined 'standard' gait and make corrections if something goes wrong.

A third and potentially more powerful method is to use an evolutionary learning type approach where you give the software access to the sensors and actuators and establish some criteria for 'success' and just let it get on with it by trial and error. In this case the software develops control systems pretty much at random and tries them out, deleting the versions which have low success scores and randomly combining the ones that work better.

The robot likely has a body accelerometer & integrates it to use a velocity tracking controller with some sort of explicit or implicit proportional & integral control for the body.
- This would keep the robot moving at the same speed as the weight it is dragging goes up.
The balance of the robot body can be measured 2 ways:
1) the most straightforward is to use the geometry of the robot & measurements at each joint 2) or a Kalman filter could be used with a gyroscope for the high frequency portion of motion and the joint measurements for the very low frequency portion. Another option would be to have a force transducer that measures the pull from the basket it is dragging and use this to generate a counteracting torque on the leg joints.