scieee AI-readable full text Open interactive document viewer

Dynamics of the Acrobot

de Lope, Javier

Abstract

The acrobot is a well-known nonlinear dynamical system frequently used as a benchmark in control theory. It has been studied in depth in both simulation and real mechanisms. This report shows how to apply conventional methods to derive its equations of motion.

Full text

Dynamics of the Acrobot Javier de Lope Asia´ın Technical Report AIR-25-13 Abstract The acrobot is a well-known nonlinear dynamical system frequently used as a benchmark in control theory. It has been studied in depth in both simulation and real mechanisms. This report shows how to apply conventional methods to derive its equations of motion. Keywords: Dynamical systems; Nonlinear dynamics; Equations of motion; Acrobot system. 1 Introduction The acrobot is a planar two-link underactuated robot like a gymnast on a parallel bar, with one only actuator in the second joint (Fig. 1). The first joint is underactuated, so the motion is made by the actuator and the inertia. The most common problem is the swing-up, in which the robot end must go up to a predefined height, usually above the parallel bar. The balance problem in the upper unstable position is also frequently studied. l1 l2 θ1 θ2 τ Figure 1: Schematic of the acrobot, where l1and l2are lengths of links, θ1and θ2are the angles of the first and second joints, respectively, and τis the torque applied at the second joint. Although they are not represented in the figure other parameters used are the masses of links m1and m2, the lengths to center of mass of links lc1and lc2and are the moments of inertia of links I1and I2. 2 Equations of motion The state of the system is determined by θ1and θ2, angles of the first and second joints, respectively, and the angular velocities ˙ θ1and ˙ θ2. The system dynamical equations are: J. de Lope is with the Department of Artificial Intelligence, Escuela T´ecnica Superior de Ingenieros Inform´aticos, Universidad Polit´ecnica de Madrid, Spain. e-mail: [email protected]. More info: https://jdlope.github.io. Technical report created May 4, 2025; revised November 17, 2025. This work is licensed under Creative Commons Attribution 4.0 International. To view a copy of this license, visit https://creativecommons.org/licenses/by/4.0/. 1 ¨ θ1=−d−1 1(d2¨ θ2+ϕ1) ¨ θ2=m2l2 c2+I2− d2 2 d1−1τ+d2 d1 ϕ1−ϕ2 d1=m1l2 c1+m2(l2 1+l2 c2+ 2l1lc2cos θ2)+I1+I2 d2=m2(l2 c2+l1lc2cos θ2)+I2 ϕ1=−m2l1lc2˙ θ2 2sin θ2−2m2l1lc2˙ θ2˙ θ1sin θ2+ (m1lc1+m2l1)gcos(θ1−π/2)+ϕ2 ϕ2=m2lc2gcos(θ1+θ2−π/2) where m1and m2are the masses of links, l1and l2are the lengths of links, lc1and lc2are the lengths to center of mass of links, I1and I2are the moments of inertia of links, and τis the torque applied at the second joint. 3 Coding in Python The equations of motion can be easily coded in Python. We use a Python class to define the Acrobot object, as shown below. Probably the most used constants for simulations are the ones proposed by Sutton [4]. We define them as well as the gravitational acceleration by means of a Python dictionary. Note that we have implemented the dynamics as a static method. import numpy as np GRAVITATIONAL_ACCELERATION = 9.81 ACROBOT_SUTTON_PARAMS = { ’m1’: 1.0, ’l1’: 1.0, ’lc1’: 0.5, ’i1’: 1.0, ’m2’: 1.0, ’l2’: 1.0, ’lc2’: 0.5, ’i2’: 1.0, ’g’: GRAVITATIONAL_ACCELERATION } class Acrobot(): def __init__(self, dt=0.05): self.state = np.array([0.0, 0.0, 0.0, 0.0]) self.params = ACROBOT_SUTTON_PARAMS self.dt = dt def reset(self): self.state = np.array([0.0, 0.0, 0.0, 0.0]) return self.state.copy() def step(self, torque): new_state = Acrobot.dynamics(self.state, torque, self.params) self.state = self.state + new_state * self.dt return self.state.copy() @staticmethod def dynamics(state, torque, params): theta1, theta2, theta1_dot, theta2_dot = state m1, l1, lc1, i1 = params[’m1’], params[’l1’], params[’lc1’], params[’i1’] 2 m2, l2, lc2, i2 = params[’m2’], params[’l2’], params[’lc2’], params[’i2’] g = params[’g’] s2 = np.sin(theta2) c2 = np.cos(theta2) phi2 = m2 * lc2 * g * np.cos(theta1 + theta2 - np.pi/2); phi1 = - m2 * l1 * lc2 * theta2_dot**2 * s2 \ - 2 * m2 * l1 * lc2 * theta2_dot * theta1_dot * s2 \ + (m1 * lc1 + m2 * l1) * g * np.cos(theta1 - np.pi/2) + phi2; d2 = m2 * (lc2**2 + l1 * lc2 * c2) + i2; d1 = m1 * lc1**2 + m2 * (l1**2 + lc2**2 + 2 * l1 * lc2 * c2) + i1 + i2; theta2_ddot = (torque + d2 / d1 * phi1 - phi2) / (m2 * lc2**2 + i2 - d2**2 / d1); theta1_ddot = - (d2 * theta2_ddot + phi1) / d1; return np.array([theta1_dot, theta2_dot, theta1_ddot, theta2_ddot]) An example of use is shown below. The default parameters are used for the acrobot. A torque τ=−1 is applied for the first 50 steps. Then, the torque τ= +1 is applied until the end of the simulation time. Finally, the reset method is called an example. def main(): a = Acrobot() current_time = 0.0 for i in range(100): if i < 50: a.step(-1.0) else: a.step(+1.0) current_time += a.dt a.reset() 4 Concluding remarks This report describes the equations of motion for the acrobot. From here we could keep studying the system behavior analyzing the stability with and without external forces, the controllability and the observability, or designing a controller such as an LQR by manipulating the system response through the control law. License Copyright (C) 2025 Javier de Lope This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. 3 References [1] J. de Lope. Equations of motion for the cart-pole. Tech. Rep. AIR-25-04, Dept. of Artificial Intelligence, Escuela T´ecnica Superior de Ingenieros Inform´aticos, Universidad Polit´ecnica de Madrid, 2025. [2] G. Mier and J. de Lope. Control of the acrobot with motors of atypical size using artificial intelligence techniques. Inventions, 2(3):16, 2017. [3] R.M. Murray and J. Hauser. A case study in approximate linearization: The acrobot example. Tech. Rep. UCB/ERL M91/46, Electronics Research Laboratory, College of Engineering, University of California, Berkeley, 1991. [4] R.J. Sutton. Generalization in reinforcement learning: Successful examples using sparse coarse coding. In Proc. of the 9th Int. Conf. on Neural Information Processing Systems, pp. 1038–1044, 1995. [5] Russ Tedrake. Underactuated Robotics. Algorithms for Walking, Running, Swimming, Flying, and Manipulation. Course Notes for MIT 6.832, 2023. 4