ROS package that contains implementation of trajectory generation methods such as Model Predictive Control methods.
This is tested with Ubuntu 22.04, and ROS2 humble
.
-
custom_trajectory_msgs
ros2_humble
branch -
Eigen3
-
OSQP, commit
25b6b39
-
osqp-eigen, version
v0.8.0
A sample setup.sh script is availble for convenience in the main directory of this repo.
Core libraries are implementations of MPC with specific model with no dependence on ROS.
mpc_6dof.cpp
implements MPC problem for a 3D discrete linear model with position and velocities as states, and acceleration as control inputs.
- Uses
mpc_6dof.cpp
px4_ros/in/odom
: Message typenav_msgs::msg::Odometry
. This is to get current state (e.g. position, velocity)traj_predictor/in/ref_traj
: Message type custom_trajectory_msgs::msg::StateTrajectory. This subscribes to the desired (reference) trajectory (position, velocity).
mpc_tracker/out/path
: Message typenav_msgs::msg::Path
. To publish the poses of the solution state trajectory to visualize in RViz2mpc_tracker/out/trajectory
: Message type custom_trajectory_msgs::msg::StateTrajectory. Publishes the detailed trajectory (position, velocity, acceleration, ...)
ros2 launch trajectory_generation mpc.launch.py
The core algorithm can be tested using test cases implemented in the test directory, no dependency on ROS.
test_mpc_6dof
ros2 run trajectory_generation test_mpc_6dof