0% found this document useful (0 votes)
18 views

TinyMPC: Model-Predictive Control on Resource-Constrained Microcontrollers

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views

TinyMPC: Model-Predictive Control on Resource-Constrained Microcontrollers

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

TinyMPC: Model-Predictive Control on

Resource-Constrained Microcontrollers
Khai Nguyen*, Sam Schoedel*, Anoushka Alavilli*, Brian Plancher, Zachary Manchester

Abstract— Model-predictive control (MPC) is a powerful


tool for controlling highly dynamic robotic systems subject
to complex constraints. However, MPC is computationally
demanding, and is often impractical to implement on small,
resource-constrained robotic platforms. We present TinyMPC,
arXiv:2310.16985v3 [cs.RO] 7 May 2024

a high-speed MPC solver with a low memory footprint targeting


the microcontrollers common on small robots. Our approach
is based on the alternating direction method of multipliers
(ADMM) and leverages the structure of the MPC problem for
efficiency. We demonstrate TinyMPC’s effectiveness by bench-
marking against the state-of-the-art solver OSQP, achieving
nearly an order of magnitude speed increase, as well as through
hardware experiments on a 27 gram quadrotor, demonstrating
high-speed trajectory tracking and dynamic obstacle avoidance.
TinyMPC is publicly available at https://tinympc.org.

I. I NTRODUCTION
Model-predictive control (MPC) enables reactive and dy-
namic online control for robots while respecting complex
control and state constraints such as those encountered during
dynamic obstacle avoidance and contact events [1], [2], [3],
[4]. However, despite MPC’s many successes, its practical
application is often hindered by computational limitations,
which can necessitate algorithmic simplifications [5], [6].
Fig. 1. TinyMPC is a fast convex model-predictive control solver that
This challenge is amplified when dealing with systems that enables real-time optimal control on resource-constrained microcontrollers.
have fast or unstable open-loop dynamics, where high control We demonstrate its efficacy in dynamic obstacle avoidance (top) and
rates are needed for safe and effective operation. recovery from 90◦ attitude errors (bottom) on a 27 gram Crazyflie quadrotor.
At the same time, there has been an explosion of interest
in tiny, low-cost robots that can operate in confined spaces, ligent robot behaviors executed on these tiny platforms rely
making them a promising solution for applications ranging on off-board computers [14], [15], [16], [17], [18], [19], [20].
from emergency search and rescue [7] to routine monitoring Several efficient optimization solvers suitable for embed-
and maintenance of infrastructure and equipment [8], [9]. ded MPC [29], [30] have emerged in recent years, most
These robots are limited to low-power, resource-constrained notably OSQP [31] and CVXGEN [32]. Both of these
microcontrollers (MCUs) for their computation [10], [11]. solvers have code-generation tools that enable users to create
As shown in Figure 2, these microcontrollers feature orders dependency-free C code to solve quadratic programs (QPs)
of magnitude less RAM, flash memory, and processor speed on embedded computers. However, they do not take full
compared to the CPUs and GPUs available on larger robots advantage of the unique structure of the MPC problem,
and historically were not able to support the real-time execu- generally making them too memory intensive and too com-
tion of computationally or memory-intensive algorithms [12], putationally demanding to run within the resource constraints
[13]. Consequently, many examples in the literature of intel- of many microcontrollers.
On the other hand, the recent success of “TinyML”
∗These authors contributed equally. has enabled the deployment of neural networks on micro-
Khai Nguyen is with the Department of Mechanical Engineering,
Carnegie Mellon University, 5000 Forbes Ave., Pittsburgh, PA 15213. controllers [12]. Motivated by these results, we developed
[email protected] TinyMPC, an MCU-optimized implementation of convex
Samuel Schoedel and Zachary Manchester are with the Robotics Institute, MPC using the alternating direction method of multipliers
Carnegie Mellon University, 5000 Forbes Ave., Pittsburgh, PA 15213.
{sschoede, zmanches}@andrew.cmu.edu (ADMM) algorithm. At its core, our solver is designed to
Anoushka Alavilli is with the Department of Electrical & Computer accelerate and compress the ADMM algorithm by exploiting
Engineering, Carnegie Mellon University, 5000 Forbes Ave., Pittsburgh, PA the structure of the MPC problem.
15213. [email protected]
Brian Plancher is with Barnard College, Columbia University, 3009 In particular, we precompute and cache expensive matrix
Broadway New York, NY 10027. [email protected] factorizations, allowing TinyMPC to completely avoid online
Fig. 2. A comparison of micro, tiny, and full-scale robot platforms and their associated computational hardware. At the smallest scale, microrobots like
the Robobee [21] and HAMR-F [22] use highly constrained 8-bit microcontrollers to execute pre-planned open-loop gaits or wing motions. At large scales,
powerful embedded CPUs and GPUs, found onboard the Snapdragon Flight quadrotor [23] or Unitree Go1edu quadruped [24], enable high performance
at the cost of high power requirements. In this work we target tiny robots such as the Crazyflie2.1 [25], DeepPiCarMicro [26], PIXHAWK PX4 [27], and
Petoi Bittle [28] that leverage 32-bit microcontrollers for motion planning and control. These devices are capable of some onboard computation, but feature
orders of magnitude less processor speed, RAM, and flash memory than full-scale robots.

division and matrix inversion. This approach enables rapid dynamics, Q ⪰ 0, R ≻ 0, and Qf ⪰ 0 are symmetric cost
computation with a very small memory footprint, enabling matrices and q and r are linear cost vectors.
deployment on resource-constrained MCUs. To the best of Equation (1) has a closed-form solution in the form of an
the authors’ knowledge, TinyMPC is the first MPC solver affine feedback controller [33]:
tailored for execution on these MCUs that has been demon-
strated onboard a highly dynamic, compute-limited robotic u∗k = −Kk xk − dk . (2)
system. Our contributions include: The feedback gain Kk and feedforward dk are found by solv-
• A novel quadratic-programming algorithm that is opti- ing the discrete Riccati equation backward in time, starting
mized for MPC, is matrix-inversion free, and achieves from PN = Qf , pN = qf , where Pk , pk are the quadratic
high efficiency and a very low memory footprint. and linear terms of the cost-to-go (or value) function [33]:
This combination makes it suitable for deployment on Kk = (R + B ⊺ Pk+1 B)−1 (B ⊺ Pk+1 A)
resource-constrained microcontrollers.
• An open-source implementation of TinyMPC in C++ dk = (R + B ⊺ Pk+1 B)−1 (B ⊺ pk+1 + rk )
that delivers state-of-the-art real-time performance for Pk = Q + Kk⊺ RKk + (A − BKk )⊺ Pk+1 (A − BKk ) (3)
convex MPC problems on microcontrollers. pk = qk + (A − BKk )⊺ (pk+1 − Pk+1 Bdk )+
• Experimental demonstrations on a small, agile, Kk⊺ (Rdk − rk ).
resource-constrained quadrotor platform.
B. Convex Model-Predictive Control
This paper proceeds as follows: Section II reviews linear-
quadratic optimal control, convex optimization, and ADMM. Convex MPC extends the LQR formulation to admit
Section III then derives the core TinyMPC solver algo- additional convex constraints on the system states and control
rithm. Benchmarking results and hardware experiments on inputs, such as joint and torque limits, hyperplanes for
a Crazyflie quadrotor are presented in Section IV. Finally, obstacle avoidance, and contact constraints:
we summarize our results and conclusions in Section V. min J(x1:N , u1:N −1 )
x1:N ,u1:N −1

II. BACKGROUND subject to xk+1 = Axk + Buk , (4)


xk ∈ X , uk ∈ U,
A. The Linear-Quadratic Regulator
where X and U are convex sets. The convexity of this
The linear-quadratic regulator (LQR) [33] is a widely
problem means that it can be solved efficiently and reli-
used approach for solving robotic control problems. LQR
ably, enabling real-time deployment in a variety of control
optimizes a quadratic cost function subject to a set of linear
applications including the landing of rockets [34], legged
dynamics constraints:
locomotion [35], and autonomous driving [36].
1 ⊺ When X and U can be expressed as linear constraints, (4)
min J= x Qf xN + qf⊺ xN +
x1:N ,u1:N −1 2 N is a QP, and can be put into the standard form:
N −1
X 1 ⊺ 1 (1) 1 ⊺
xk Qxk + qk⊺ xk + u⊺k Ruk + rk⊺ uk min x P x + q⊺ x
2 2 x∈Rn 2
k=1
subject to Ax ≤ b, (5)
subject to xk+1 = Axk + Buk ∀k ∈ [1, N ),
Cx = d.
where xk ∈ Rn , uk ∈ Rm are the state and control input at
time step k, N is the number of time steps (also referred to Further analysis, including theoretical guarantees regard-
as the horizon), A ∈ Rn×n and B ∈ Rn×m define the system ing feasibility and stability can be found in [37] and [38].
C. The Alternating Direction Method of Multipliers A. Combining LQR and ADMM for MPC
The alternating direction method of multipliers We solve the following problem, introducing slack vari-
(ADMM) [39], [40], [41] is a popular and efficient ables as in (9) and transforming (4) into the following:
approach for solving convex optimization problems,
including QPs like (5). We provide a very brief summary min
x1:N ,z1:N ,
LA (·) = J(x1:N , u1:N −1 )+
here and refer readers to [42] for more details. λ1:N ,u1:N −1 , IX (z1:N ) + IU (w1:N −1 )+
w1:N −1 ,µ1:N −1
Given a generic problem: N
X ρ
min f (x) (xk − zk )⊺ (xk − zk ) + λ⊺k (xk − zk )+ (13)
x (6) 2
k=1
subject to x ∈ C, N −1
X ρ
with f and C convex, we define the indicator function for (uk − wk )⊺ (uk − wk ) + µ⊺k (uk − wk )
2
the set C: k=1
( subject to: xk+1 = Axk + Buk ,
0 z∈C
IC (z) = (7)
∞ otherwise.
where z, w, λ, and µ are the state slack, input slack, state
We can now form the following equivalent problem by dual, and input dual variables over the entire horizon. State
introducing the slack variable z: and input constraints are enforced through the indicator
functions IX and IU . We use the ADMM algorithm (10),
min f (x) + IC (z)
x (8) (11), (12) to solve this optimal control problem. The primal
subject to x = z. update for (13) becomes an equality-constrained QP:
The augmented Lagrangian of the transformed problem (8) 1 ⊺
min x Q̃f xN + q̃f⊺ xN +
is as follows, where λ is a Lagrange multiplier and ρ is a x1:N ,u1:N −1 2 N
scalar penalty weight: N −1
1 ⊺ 1
X (14)
ρ x Q̃xk + q̃k⊺ xk + u⊺k R̃uk + r̃⊺ uk
LA (x, z, λ) = f (x) + IC (z) + λ⊺ (x − z) + ||x − z||22 . (9) 2 k 2
2 k=1

If we alternate minimization over x and z, rather than subject to xk+1 = Axk + Buk ,
simultaneously minimizing over both, we arrive at the three- where
step ADMM iteration, Q̃f = Qf + ρI, q̃f = qf + λN − ρzN ,
primal update : x+ = arg min LA (x, z, λ), (10) Q̃ = Q + ρI, q̃k = qk + λk − ρzk , (15)
x
+ +
slack update : z = arg min LA (x , z, λ), (11) R̃ = R + ρI, r̃k = rk + µk − ρwk .
z
We reformulate (15) and introduce the scaled dual vari-
dual update : λ+ = λ + ρ(x+ − z + ), (12)
ables y and g for convenience [41]:
the last step of which is a gradient-ascent update on the q̃f = qf + ρ(λN /ρ − zN ) = qf + ρ(yN − zN ),
Lagrange multiplier [41]. These steps can be iterated until a
desired convergence tolerance is achieved. q̃k = qk + ρ(λk /ρ − zk ) = qk + ρ(yk − zk ), (16)
In the special case of a QP, each step of the ADMM r̃k = rk + ρ(µk /ρ − wk ) = rk + ρ(gk − wk ).
algorithm becomes very simple to compute: the primal We observe that, because (14) exhibits the same LQR prob-
update is the solution to a linear system, and the slack lem structure as in (1), it can be solved efficiently with the
update is a linear projection. ADMM-based QP solvers, like Riccati recursion in (3). The slack update for (13) becomes
OSQP [31], have demonstrated state-of-the-art results. a simple linear projection onto the feasible set:
zk+ = projX (x+
k + yk ),
III. T HE T INY MPC S OLVER (17)
wk+ = projU (u+
k + gk ),
TinyMPC trades generality for speed by exploiting the spe-
where the superscript denotes the variable at the subsequent
cial structure of the MPC problem. Specifically, we leverage
ADMM iteration. The dual update for (13) becomes:
the closed-form Riccati solution to the LQR problem to com-
pute the primal update in (10). Pre-computing and caching yk+ = yk + x+ +
k − zk ,
(18)
this solution allows us to avoid online matrix factorizations gk+ = gk + u+ +
k − wk .
and enables very fast performance while maintaining a small
memory footprint. Finally, the algorithm terminates when the primal and dual
residuals are within a set tolerance.
Time per Iteration (us)
600 600 600 TinyMPC
OSQP
400 400 400

200 200 200

0 0 0
0 10 20 30 0 10 20 30 0 10 20 30 40 50
600 600 600
TinyMPC
Memory Usage (kB)

Memory Limit OSQP


500 500 500

400 400 400

300 300 300


4 8 12 16 24 28 32 4 8 12 16 24 28 32 4 8 12 16 30 40 50
(a) State dimension (n) (b) Input dimension (m) (c) Time horizon (N)

Fig. 3. Comparison of average iteration times (top) and memory usage (bottom) for OSQP and TinyMPC on randomly generated trajectory tracking
problems on a Teensy 4.1 development board (ARM Cortex-M7 running at 600 MHz with 32-bit floating point support, 7.75 MB of flash, and 512 kB of
tightly coupled RAM). Error bars show the maximum and minimum time per iteration over all MPC steps executed for a given problem. In (a), the input
dimension and time horizon are held constant at m = 4 and N = 10 while the state dimension n varies from 4 to 32. In (b), n = 10 and N = 10 while
the m varies from 4 to 32. In (c), n = 10, m = 4 and N varies from 4 to 50. The dotted black line indicates the memory limit of the Teensy 4.1.

B. Pre-Computation Online, we switch between these cached matrices based on


Solving the linear system in each primal update is the most the values of the primal and dual residual values in a scheme
expensive step in each ADMM iteration. In our case, this is adapted from OSQP. The resulting TinyMPC algorithm is
the solution to the Riccati equation, which has properties we summarized in Algorithm 1.
can leverage to significantly reduce computation and memory
usage. Given a long enough horizon, the Riccati recursion Algorithm 1 TinyMPC
(3) converges to the constant solution of the infinite-horizon function TINY SOLVE(input)
LQR problem [33]. Thus, we pre-compute a single LQR gain while not converged do
matrix Kinf and cost-to-go Hessian Pinf . We then cache the //Primal update
following matrices from (3): p1:N −1 , d1:N −1 ← Backward pass via (20)
C1 = (R + B ⊺ Pinf B)−1 , x1:N , u1:N −1 ← Forward pass via (2)
(19) //Slack update
C2 = (A − BKinf )⊺ . z1:N , w1:N −1 ← Project to feasible set (17)
A careful analysis of the Riccati equation then reveals that //Dual update
only the linear terms need to be updated as part of the y1:N , g1:N −1 ← Gradient ascent (18)
ADMM iteration: q1:N , r1:N −1 , pN ← Update linear cost terms
dk = C1 (B ⊺ pk+1 + rk ), return x1:N , u1:N −1
⊺ (20)
pk = qk + C2 pk+1 − Kinf rk .
As a result, we completely avoid online matrix factorization IV. E XPERIMENTS
and only compute matrix-vector products. We also dramati-
cally reduce memory footprint by only storing a few vectors We evaluate TinyMPC through two sets of experiments:
at each time step. first, we benchmark our solver against the state-of-the-
art OSQP [31] solver on a representative microcontroller,
C. Penalty Scaling demonstrating improved computational speed and reduced
ADMM is sensitive to the value of the penalty term ρ memory footprint. We then test the efficacy of our solver on a
in (9). Solvers like OSQP [31] overcome this issue by adap- resource-constrained nano-quadrotor platform, the Crazyflie
tively scaling ρ. However, this requires performing additional 2.1. We show that TinyMPC enables the Crazyflie to track
matrix factorizations. To avoid this, we pre-compute and aggressive reference trajectories while satisfying control lim-
cache a set of matrices corresponding to several values of ρ. its and time-varying state constraints.
·105
1
0.5
0.8
0.6
0.4
Y [m]

0 0.2
0
0 0.1 0.2 0.3 0.4 0.5
(a) Time [s], Brescianini
−0.5
·105
1
−1 −0.5 0 0.5 1 0.8

Controls
(a) X [m], period = 5 s 0.6
0.4
0.2
0.5 0
0 0.1 0.2 0.3 0.4 0.5
(b) Time [s], PID
Y [m]

0 ·105
1
Reference
0.8
Mellinger 0.6
Brescianini 0.4
−0.5 TinyMPC 0.2
0
−1 −0.5 0 0.5 1 0 0.1 0.2 0.3 0.4 0.5
(b) X [m], period = 3 s (c) Time [s], TinyMPC

Fig. 4. Figure-eight tracking at low speed (top) and high speed (bottom) Fig. 5. Control trajectories during the Extreme Initial Poses experiment.
comparing TinyMPC with the two most performant controllers available Four pre-clipped PWM motor commands are shown for each controller.
on the Crazyflie. For slower trajectories, all three controllers resulted in The black dotted line denotes the thrust limit, from 0 to 65535 PWM value.
similar performance. For faster trajectories, only TinyMPC was capable of Among the three successful controllers, only TinyMPC could reason about
maintaining tracking without crashing. The maximum velocity and attitude control feasibility, exhibiting the maneuver shown in Fig. 1 (bottom).
deviation from hover with TinyMPC reached 1.5 m/s and 20◦ , respectively.

2) Evaluation: Fig. 3 shows the average execution times


A. Microcontroller Benchmarks for both solvers, in which TinyMPC exhibits a maxi-
mum speed-up of 8.85x over OSQP. This speed-up allows
As shown in Fig. 3, we first compare TinyMPC and OSQP
TinyMPC to perform real-time trajectory tracking while
on random linear MPC problems while varying the state and
handling input constraints. OSQP also quickly exceeded the
input dimensions, as well as the horizon length.
memory limitations of the MCU, while TinyMPC was able to
1) Methodology: Experiments were performed on a scale to much larger problem sizes. For example, for a fixed
Teensy 4.1 [43] development board, which has an ARM input dimension of m = 4 and time horizon of N = 10
Cortex-M7 microcontroller operating at 600 MHz, 7.75 MB (Fig. 3a), OSQP exceeded the 512 kB memory limit of the
of flash memory, and 512 kB of RAM. TinyMPC is imple- Teensy at a state dimension of only n = 16, while TinyMPC
mented in C++ using the Eigen matrix library [44]. We used only used around 400 kB at a state dimension of n = 32.
OSQP’s code-generation feature to generate a C implementa-
tion of each problem to run on the microcontroller. Objective B. Hardware Experiments
tolerances were set to 10−3 and constraint tolerances to We demonstrate the efficacy of our solver for real-
10−4 . The maximum number of iterations for both solvers time execution of dynamic control tasks on a resource-
was set to 4000, and both utilized warm starting. OSQP’s constrained Crazyflie 2.1 quadrotor. We present three ex-
solution polishing was disabled to decrease solve time. Other periments: 1) figure-eight trajectory tracking at slow and
parameters were set to equivalent values wherever possible. fast speeds, 2) recovery from extreme initial attitudes, and
Dynamics models A and B were randomly generated 3) dynamic obstacle avoidance through online updating of
and checked to ensure controllability for all values of state state constraints.
dimension n, input dimension m, and time horizon N . 1) Methodology: The Crazyflie 2.1 is a 27 gram quadro-
The control input was constrained within fixed bounds over tor. Its primary MCU is an ARM Cortex-M4 (STM32F405)
the entire horizon. During the microcontroller tests, noise clocked at 168 MHz with 192 kB of SRAM and 1 MB
was added to mimic imperfect state estimation. The largest of flash. OSQP could not fit within the memory available
problem instance involved 696 decision variables, 490 linear on this MCU, making it impossible to be used as an MPC
equality constraints, and 392 linear inequality constraints. baseline. Instead, we compare against the four controllers
included with the Crazyflie firmware: Cascaded PID [45], V. C ONCLUSION AND F UTURE W ORK
Mellinger [46], INDI [47], and Brescianini [48]. These are We introduce TinyMPC, a model-predictive control solver
reactive controllers that often clip the control input to meet for resource-constrained embedded systems. TinyMPC uses
hardware constraints. ADMM to handle state and input constraints while leverag-
All experiments shown were performed in an Opti- ing the structure of the MPC problem and insights from LQR
Track motion-capture environment sending pose data to the to reduce memory footprint and speed up online execution
Crazyflie at 100 Hz. TinyMPC ran at 500 Hz with a horizon compared to existing state-of-the-art solvers like OSQP.
length of N = 15 for the figure-eight tracking task and We demonstrated TinyMPC’s practical performance on a
the attitude-recovery task. For the obstacle-avoidance task, Crazyflie nano-quadrotor performing highly dynamic tasks
we sent the location of the end of a stick to the Crazyflie with input and obstacle constraints.
using the onboard radio. Additionally, we reduced the MPC Several directions for future work remain. First, it should
frequency to 100 Hz and increased N to 20. be straightforward to extend TinyMPC to handle second-
In all experiments, we linearized the quadrotor’s 6-DOF order cone constraints, which are useful in many MPC appli-
dynamics about a hover and represented its attitude with a cations for modeling thrust and friction. We also plan to fur-
quaternion using the formulation in [49]. This problem has ther reduce TinyMPC’s hardware requirements by developing
state dimension n = 12 and m = 4 representing the quadro- a fixed-point version, since many small microcontrollers lack
tor’s full state and PWM motor commands. The largest hardware floating-point support. Finally, to ease deployment
problem was in the dynamic obstacle avoidance scenario, and adoption, we plan to develop a code-generation wrapper
which was solved onboard at high frequency and consisted for TinyMPC in a high-level language such as Julia or
of 316 decision variables, 248 linear equality constraints, and Python, similar to OSQP and CVXGEN.
172 linear inequality constraints. For more information and to get started using our open-
2) Evaluation––Figure-Eight Trajectory Tracking: We source solver, we recommend users visit our website,
compare the tracking performance of TinyMPC and other https://tinympc.org.
controllers with a figure-eight trajectory, as shown in Fig. 4.
For the faster trajectory, the maximum velocity and atti- VI. ACKNOWLEDGMENTS
tude deviation reached 1.5 m/s and 20◦ , respectively. Only The authors would like to thank Brian Jackson for insight-
TinyMPC could track the entire reference while respecting ful discussions and Professor Mark Bedillion for providing
actuator limits, while the Mellinger and Brescianini con- us with extra Crazyflies.
trollers crashed almost immediately. TinyMPC converged at
R EFERENCES
all steps within a maximum of 7 iterations and under the
allotted 2 ms solve time defined by the 500 Hz control [1] P. M. Wensing, M. Posa, Y. Hu, A. Escande, N. Mansard, and
A. Del Prete, “Optimization-based control for dynamic legged robots,”
frequency. arXiv preprint arXiv:2211.11644, 2022.
3) Evaluation––Extreme Initial Poses: Fig. 1 (bottom) [2] J. Di Carlo, “Software and control design for the mit cheetah
shows the performance of the Crazyflie when initialized quadruped robots,” Ph.D. dissertation, Massachusetts Institute of Tech-
nology, 2020.
with a 90◦ attitude error. TinyMPC displayed the best [3] Z. Manchester, N. Doshi, R. J. Wood, and S. Kuindersma, “Contact-
recovery performance with a maximum position error of implicit trajectory optimization using variational integrators,” The
23 cm while respecting the input limits. The PID and International Journal of Robotics Research, vol. 38, no. 12-13, pp.
1463–1476, 2019.
Brescianini controllers achieved maximum errors of 40 cm [4] S. Kuindersma, “Taskable agility: Making useful dynamic behavior
and 65 cm, respectively, while violating input limits (Fig. 5). easier to create,” Princeton Robotics Seminar, 4 2023.
The other controllers, INDI and Mellinger, failed to stabilize [5] B. Plancher and S. Kuindersma, “A performance analysis of parallel
differential dynamic programming on a gpu,” in Algorithmic Foun-
the quadrotor, causing it to crash. dations of Robotics XIII: Proceedings of the 13th Workshop on the
4) Evaluation––Dynamic Obstacle Avoidance: We Algorithmic Foundations of Robotics 13. Springer, 2020, pp. 656–
demonstrate TinyMPC’s ability to handle time-varying state 672.
[6] S. M. Neuman, B. Plancher, T. Bourgeat, T. Tambe, S. Devadas,
constraints by avoiding a moving stick (Fig. 1 top). These and V. J. Reddi, “Robomorphic computing: A design methodology
experiments are more challenging because the constraints for domain-specific accelerators parameterized by robot morphology,”
arbitrarily switch between inactive and active, requiring far ser. ASPLOS 2021. New York, NY, USA: Association for
Computing Machinery, 2021, p. 674–686. [Online]. Available:
more iterations to solve to convergence. The obstacle sphere https://doi-org.ezp-prod1.hul.harvard.edu/10.1145/3445814.3446746
was re-linearized about its updated position at each MPC [7] K. McGuire, C. De Wagter, K. Tuyls, H. Kappen, and G. C. de Croon,
step, allowing the drone to avoid the unplanned movements “Minimal navigation solution for a swarm of tiny flying robots to
explore an unknown environment,” Science Robotics, vol. 4, no. 35,
of the swinging stick. As illustrated, the quadrotor could p. eaaw9710, 2019.
move freely in space to avoid the dynamic obstacle and [8] S. D. De Rivaz, B. Goldberg, N. Doshi, K. Jayaram, J. Zhou, and R. J.
come back safely to the hovering position. As an additional Wood, “Inverted and vertical climbing of a quadrupedal microrobot
using electroadhesion,” Science Robotics, vol. 3, no. 25, p. eaau3038,
challenge, we added a constraint such that the quadrotor 2018.
must stay within a vertical plane defined by x = 0. The [9] B. P. Duisterhof, S. Li, J. Burgués, V. J. Reddi, and G. C. de Croon,
Crazyflie deviated a maximum of approximately 5 cm “Sniffy bug: A fully autonomous swarm of gas-seeking nano quad-
copters in cluttered environments,” in 2021 IEEE/RSJ International
from this constraint plane while successfully avoiding the Conference on Intelligent Robots and Systems (IROS). IEEE, 2021,
dynamic obstacle. pp. 9099–9106.
[10] W. G. et al. Crazyflie 2.0 quadrotor as a platform for research and Kerrigan, and M. Morari, “Embedded online optimization for model
education in robotics and control engineering. [Online]. Available: predictive control at megahertz rates,” IEEE Transactions on Automatic
https://www.bitcraze.io/papers/giernacki draft crazyflie2.0.pdf Control, vol. 59, no. 12, pp. 3238–3251, 2014.
[11] Petoi, “Open source, programmable robot dog bittle,” Available [30] B. O’Donoghue, G. Stathopoulos, and S. Boyd, “A splitting method
at https://www.petoi.com/pages/bittle-open-source-bionic-robot-dog for optimal control,” Control Systems Technology, IEEE Transactions
(5.9.2023). on, vol. 21, pp. 2432–2442, 11 2013.
[12] S. M. Neuman, B. Plancher, B. P. Duisterhof, S. Krishnan, C. Banbury, [31] B. Stellato, G. Banjac, P. Goulart, A. Bemporad, and S. Boyd, “Osqp:
M. Mazumder, S. Prakash, J. Jabbour, A. Faust, G. C. de Croon, et al., An operator splitting solver for quadratic programs,” Mathematical
“Tiny robot learning: challenges and directions for machine learning in Programming Computation, vol. 12, no. 4, pp. 637–672, 2020.
resource-constrained robots,” in 2022 IEEE 4th International Confer- [32] J. Mattingley and S. Boyd, “CVXGEN: A code generator for embed-
ence on Artificial Intelligence Circuits and Systems (AICAS). IEEE, ded convex optimization,” in Optimization Engineering, pp. 1–27.
2022, pp. 296–299. [33] F. L. Lewis, D. Vrabie, and V. Syrmos, “Optimal Control,” 1 2012.
[13] Z. Zhang, A. A. Suleiman, L. Carlone, V. Sze, and S. Karaman, [Online]. Available: https://doi.org/10.1002/9781118122631
“Visual-inertial odometry on chip: An algorithm-and-hardware co- [34] B. Açıkmeşe, J. M. Carson, and L. Blackmore, “Lossless convexi-
design approach,” 2017. fication of nonconvex control bound and pointing constraints of the
[14] V. Adajania, S. Zhou, S. Arun, and A. Schoellig, “Amswarm: An soft landing optimal control problem,” IEEE Transactions on Control
alternating minimization approach for safe motion planning of quadro- Systems Technology, vol. 21, no. 6, pp. 2104–2113, 2013.
tor swarms in cluttered environments,” in 2023 IEEE International [35] J. Di Carlo, P. M. Wensing, B. Katz, G. Bledt, and S. Kim, “Dynamic
Conference on Robotics and Automation (ICRA), 2023, pp. 1421– locomotion in the mit cheetah 3 through convex model-predictive
1427. control,” in 2018 IEEE/RSJ International Conference on Intelligent
[15] P. Varshney, G. Nagar, and I. Saha, “Deepcontrol: Energy-efficient Robots and Systems (IROS), 2018, pp. 1–9.
control of a quadrotor using a deep neural network,” in 2019 IEEE/RSJ [36] M. Babu, Y. Oza, A. K. Singh, K. M. Krishna, and S. Medasani,
International Conference on Intelligent Robots and Systems (IROS), “Model predictive control for autonomous driving based on time scaled
2019, pp. 43–50. collision cone,” in 2018 European Control Conference (ECC), 2018,
[16] N. O. Lambert, D. S. Drew, J. Yaconelli, S. Levine, R. Calandra, pp. 641–648.
and K. S. Pister, “Low-level control of a quadrotor with deep model- [37] A. Boccia, L. Grüne, and K. Worthmann, “Stability and
based reinforcement learning,” IEEE Robotics and Automation Letters, feasibility of state constrained mpc without stabilizing terminal
vol. 4, no. 4, pp. 4224–4230, 2019. constraints,” Systems and Control Letters, vol. 72, pp. 14–21, 2014.
[17] C. E. Luis, M. Vukosavljev, and A. P. Schoellig, “Online trajectory [Online]. Available: https://www.sciencedirect.com/science/article/pii/
generation with distributed model predictive control for multi-robot S0167691114001595
motion planning,” IEEE Robotics and Automation Letters, vol. 5, no. 2, [38] A. Mohammadi, H. Asadi, S. Mohamed, K. Nelson, and S. Nahavandi,
pp. 604–611, 2020. “Optimizing model predictive control horizons using genetic
[18] L. Xi, X. Wang, L. Jiao, S. Lai, Z. Peng, and B. M. Chen, “Gto- algorithm for motion cueing algorithm,” Expert Systems with
mpc-based target chasing using a quadrotor in cluttered environments,” Applications, vol. 92, pp. 73–81, 2018. [Online]. Available: https:
IEEE Transactions on Industrial Electronics, vol. 69, no. 6, pp. 6026– //www.sciencedirect.com/science/article/pii/S0957417417306000
6035, 2021. [39] R. Glowinski and A. Marroco, “Sur l’approximation, par éléments finis
[19] G. Torrente, E. Kaufmann, P. Föhn, and D. Scaramuzza, “Data-driven d’ordre un, et la résolution, par pénalisation-dualité d’une classe de
mpc for quadrotors,” IEEE Robotics and Automation Letters, vol. 6, problèmes de dirichlet non linéaires,” Revue française d’automatique,
no. 2, pp. 3769–3776, 2021. informatique, recherche opérationnelle. Analyse numérique, vol. 9,
[20] K. Y. Chee, T. Z. Jiahao, and M. A. Hsieh, “Knode-mpc: A knowledge- no. R2, pp. 41–76, 1975.
based data-driven predictive control framework for aerial robots,” [40] D. Gabay and B. Mercier, “A dual algorithm for the solution of
IEEE Robotics and Automation Letters, vol. 7, no. 2, pp. 2819–2826, nonlinear variational problems via finite element approximation,”
2022. Computers & mathematics with applications, vol. 2, no. 1, pp. 17–
[21] N. T. Jafferis, E. F. Helbling, M. Karpelson, and R. J. Wood, 40, 1976.
“Untethered flight of an insect-sized flapping-wing microscale aerial [41] S. Boyd, N. Parikh, E. Chu, B. Peleato, J. Eckstein, et al., “Dis-
vehicle,” Nature, vol. 570, no. 7762, pp. 491–495, 2019. tributed optimization and statistical learning via the alternating di-
[22] B. Goldberg, R. Zufferey, N. Doshi, E. F. Helbling, G. Whittredge, rection method of multipliers,” Foundations and Trends® in Machine
M. Kovac, and R. J. Wood, “Power and control autonomy for high- learning, vol. 3, no. 1, pp. 1–122, 2011.
speed locomotion with an insect-scale legged robot,” IEEE Robotics [42] S. Boyd, N. Parikh, E. Chu, B. Peleato, and J. Eckstein, 2011.
and Automation Letters, vol. 3, no. 2, pp. 987–993, 2018. [43] “Teensy® 4.1.” [Online]. Available: https://www.pjrc.com/store/
[23] G. Loianno, C. Brunner, G. McGrath, and V. Kumar, “Estimation, teensy41.html
control, and planning for aggressive flight with a small quadrotor with [44] G. Guennebaud, B. Jacob, et al., “Eigen v3,” http://eigen.tuxfamily.org,
a single camera and imu,” IEEE Robotics and Automation Letters, 2010.
vol. 2, no. 2, pp. 404–411, 2016. [45] “Controllers in the Crazyflie — Bitcraze.” [Online]. Available:
[24] Unitree, “Unitree go1,” Accessed 2023, https://shop.unitree.com. https://www.bitcraze.io/documentation/repository/crazyflie-firmware/
[25] Bitcraze, “Crazyflie 2.1,” 2023. [Online]. Available: https://www. master/functional-areas/sensor-to-control/controllers/
bitcraze.io/products/crazyflie-2-1/ [46] D. Mellinger and V. Kumar, “Minimum snap trajectory generation
[26] M. Bechtel, Q. Weng, and H. Yun, “Deeppicarmicro: Applying tinyml and control for quadrotors,” in 2011 IEEE International Conference
to autonomous cyber physical systems,” in 2022 IEEE 28th Interna- on Robotics and Automation, 2011, pp. 2520–2525.
tional Conference on Embedded and Real-Time Computing Systems [47] E. J. J. Smeur, Q. Chu, and G. C. H. E. de Croon, “Adaptive
and Applications (RTCSA). IEEE, 2022, pp. 120–127. incremental nonlinear dynamic inversion for attitude control of micro
[27] L. Meier, P. Tanskanen, L. Heng, G. H. Lee, F. Fraundorfer, and air vehicles,” Journal of Guidance, Control, and Dynamics, vol. 39,
M. Pollefeys, “Pixhawk: A micro aerial vehicle design for autonomous no. 3, pp. 450–461, 2016.
flight using onboard computer vision,” Autonomous Robots, vol. 33, [48] D. Brescianini, M. Hehn, and R. D’Andrea, “Nonlinear quadrocopter
pp. 21–39, 2012. attitude control,” 2013.
[28] Petoi, “Petoi bittle robot dog,” Accessed 2023, https://www.petoi.com/ [49] B. E. Jackson, K. Tracy, and Z. Manchester, “Planning with attitude,”
products/petoi-bittle-robot-dog. IEEE Robotics and Automation Letters, vol. 6, no. 3, pp. 5658–5664,
[29] J. L. Jerez, P. J. Goulart, S. Richter, G. A. Constantinides, E. C. 2021.

You might also like