Model predictive control based on data-driven model
- Compiler supporting C++17
- Tested on
Ubuntu 20.04 / ROS Noetic
andUbuntu 18.04 / ROS Melodic
This package depends on
Some tests depend on
It is assumed that ROS is installed.
-
Follow the official instructions to download and extract the zip file of libtorch.
-
Setup catkin workspace.
$ mkdir -p ~/ros/ws_ddmpc/src
$ cd ~/ros/ws_ddmpc
$ wstool init src
$ wstool set -t src isri-aist/NMPC [email protected]:isri-aist/NMPC.git --git -y
$ wstool set -t src isri-aist/DataDrivenMPC [email protected]:isri-aist/DataDrivenMPC.git --git -y
$ wstool update -t src
- Install dependent packages.
$ source /opt/ros/${ROS_DISTRO}/setup.bash
$ rosdep install -y -r --from-paths src --ignore-src
- Build a package.
$ catkin build data_driven_mpc -DCMAKE_BUILD_TYPE=RelWithDebInfo -DLIBTORCH_PATH=<absolute path to libtorch> --catkin-make-args all tests
<absolute path to libtorch>
is the path to the directory named libtorch that was extracted in step 1.
Make sure that it is built with --catkin-make-args tests
option.
Control the Van der Pol oscillator by the learned state equation.
$ rosrun data_driven_mpc TestMpcOscillator
Control the CoM motion of robot and object by combining the known CoM-ZMP model and the learned object dynamics model.
$ rosrun data_driven_mpc TestMpcPushWalk --gtest_filter=*.RunMPC
$ rosrun data_driven_mpc plotTestMpcPushWalk.py
Control the position and angle of the one wheel cart on the PyBullet dynamics simulator.
# 3-second simulation
$ rostest data_driven_mpc TestMpcCart.test enable_gui:=true --text
# Endless simulation
$ rostest data_driven_mpc TestMpcCart.test no_exit:=true enable_gui:=true --text
Control the robot CoM and the position and angle of the one wheel cart on the PyBullet dynamics simulator. The robot CoM-ZMP model is known. The object dynamics model is learned.
$ rostest data_driven_mpc TestMpcCartWalk.test enable_gui:=true --text