DataDrivenMPC
DataDrivenMPC copied to clipboard
Model predictive control based on data-driven model
DataDrivenMPC
Model predictive control based on data-driven model
Install
Requirements
- Compiler supporting C++17
- Tested on
Ubuntu 20.04 / ROS NoeticandUbuntu 18.04 / ROS Melodic
Dependencies
This package depends on
Some tests depend on
Installation procedure
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.
Examples
Make sure that it is built with --catkin-make-args tests option.
MPC for Van der Pol oscillator
Control the Van der Pol oscillator by the learned state equation.
$ rosrun data_driven_mpc TestMpcOscillator
MPC for walking with pushing
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
MPC for cart pushing
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
MPC for walking with cart pushing
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