This repository contains an MPC Trajectory Tracker based on the mpc_ros library developed by Geonhee-LEE et. al. The MPC itself is written over the IPOPT nonlinear solver and integrated with ROS (Robot Operating System). The model used for trajectory tracking within the MPC is the unicycle model, but there are plans to expand this out to double / triple integrators as well, and even to aerial vehicles. These features will come out when I either need them for a project or when I get the free time to develop them.
NOTE: Tested in Ubuntu 16.04/18.04/20.04 in ROS Kinetic/Melodic/Noetic.
-
Install ROS
-
Install IPOPT. So far only tested on IPOPT version 3.14.4, no guarantees that it works on any other version.
- The steps I use to install IPOPT can be found in the install_ipopt.sh script.
-
Clone repository into a
catkin_ws
and compile with eithercatkin build
orcatkin_make
- Note: The following line was added to the
CMakeLists.txt
in case the user doesn't want to add/usr/local/lib
toLD_LIBRARY_PATH
:
link_directories(/usr/local/lib)
If your IPOPT install is located elsewhere, I'd recommend changing that directory to wherever your IPOPT libraries are if you are having problems linking. Alternatively, you can write a custom
Findipopt.cmake
file - Note: The following line was added to the
You can run the MPC by launching the following launch file:
roslaunch mpc_trajectory_tracking jackal_mpc_track.launch
All the MPC needs is a reference trajectory, then it will publish a Twist message to the cmd_vel
topic.
Note: You can change the default odometry topic via the
odomTopic
argument in the launch file.
You can send a trajectory to one of two topics:
-
/reference_trajectory
: Will reset the trajectory timer and track the trajectory starting at time=0s. -
/reference_trajectory_no_reset
: Same asreference_trajectory
but will not reset the trajectory timer. This is useful for appending to a trajectory currently being tracked.
I am actively adding features / fixing bugs in this repository. With that said, if you would like to use this repository and are having any troubles, please feel free to submit an issue and I will most likely see it within a few days.