How abuibaid/roboplan_mpc works
roboplan_MPC is a joint-space model-predictive controller for robot arms, with C++ and Python APIs. Its example workflow builds a RoboPlan scene, converts Cartesian targets to joint goals with OInK, sets the MPC goal, and repeatedly solves from the measured state; the predicted trajectory can then be followed or visualized. Internally, the MPC formulates a constrained multiple-shooting problem, using Pinocchio dynamics and symbolic forward kinematics for environment limits, and CasADi solvers. The example and solve flow are excerpted; several solver and trajectory details are documented in the README rather than fully shown in source excerpts.
Main entry points: example_mpc.py MPC example · src/mpc.cpp MPC controller · __init__.py Python API · src/mpc.cpp Nanobind bindings
Components 15
Application workflow
- MPC example
roboplan_mpc_examples/python/example_mpc.py - Predicted trajectory
- Trajectory visualization
roboplan_mpc_examples/python/example_mpc.py
MPC API
- Python API
bindings/python/roboplan/mpc/__init__.py - Nanobind bindings
bindings/src/mpc.cpp - MPC API contract
include/roboplan_mpc/mpc.hpp
Control formulation
- MPC controller
src/mpc.cpp - MPC formulation
src/mpc.cpp - Symbolic kinematics
src/robot_transformation.cpp
Robot integrations
- OInK IK
- RoboPlan Scene
- Pinocchio dynamics
- CasADi solver
Other components
- Operator
- Robot controller
Connections 17
- Operator → MPC example: runs example
README.md - MPC example → RoboPlan Scene: builds scene
roboplan_mpc_examples/python/example_mpc.py - MPC example → OInK IK: solves IK
roboplan_mpc_examples/python/example_mpc.py - MPC example → Python API: imports API
roboplan_mpc_examples/python/example_mpc.py - Python API → Nanobind bindings: loads extension
bindings/python/roboplan/mpc/__init__.py - Nanobind bindings → MPC controller: exposes methods
bindings/src/mpc.cpp - MPC controller → MPC API contract: implements API
include/roboplan_mpc/mpc.hpp - MPC controller → RoboPlan Scene: uses scene
- MPC controller → MPC formulation: sets up problem
src/mpc.cpp - MPC formulation → Symbolic kinematics: builds constraints
src/mpc.cpp - MPC formulation → Pinocchio dynamics: computes dynamics
README.md - MPC formulation → CasADi solver: solves NLP
src/mpc.cpp - MPC example → MPC controller: sets goal and solves
roboplan_mpc_examples/python/example_mpc.py - MPC example → Predicted trajectory: receives prediction
README.md - MPC controller → Predicted trajectory: returns trajectory
- Predicted trajectory → Robot controller: follows plan
README.md - MPC example → Trajectory visualization: plots and animates
roboplan_mpc_examples/python/example_mpc.py