# Acrobot progress

In the video below, you see the first demo of our Acrobot in motion. However, this is work in progress - we cannot balance it at the top yet. Read on for more details.

After the mechanical construction of the Acrobot was finished, we had to develop a suitable motor controller to power the BLDC motor. As mentioned in the last blog post, most R/C BLDC controllers employ sensorless commutation, which leads to jerky motion at startup and for slow speeds and is therefore of little use for us. Thus, we added an encoder to the motor axis and started to develop a new controller. To reduce development effort, we re-used the power stage from a cheap sensorless BLDC controller, but completely replaced the logic by an STM32 microcontroller board. We also added current sensors to be able to precisely measure the current in the motor.

Initially, we used a "standard" BLDC control algorithm with the commutation timing determined by the motor encoder. This, however, still resulted in fairly jerky motion at low speeds. Therefore, we implemented space vector modulation, i.e. we feed the motor with actual 3-phase AC current, the phase of which is locked to the motor motion via the encoder. The new controller works fairly well, but still requires some cleanup. It will be documented in detail in a future blog post.

Now that the Acrobot hardware works, it is time to work on the control algorithms. For the demo in the video above, we used a very simple energy-pumping controller, as suggested in a paper by M. Spong. The idea is to use a PD controller to control the angle of the active joint, $q_2$, and dynamically set it to

\begin{equation*} q_2^{d} = \alpha \arctan(\dot{q}_1) \end{equation*}

where $\alpha$ is a fixed parameter (gain) and $\dot{q}_1$ is the angular velocity of the passive joint. Obviously, this needs an initial "kick" to get started, so we manually play with the offset in the beginning. If the gain is adjusted correctly, we can pump enough energy into the system such that the Acrobot almost gets to the top, but does not swing over. As we cannot capture it yet, we simply switch off the controller after a while and let the system swing down again.

The next step will be to implement more sophisticated control schemes to actually capture the Acrobot at the top and balance it there. After that, we need to clean up, document, and release everything.