Skip to content

isri-aist/DataDrivenMPC

Repository files navigation

Model predictive control based on data-driven model

CI Documentation

Install

Requirements

  • Compiler supporting C++17
  • Tested on Ubuntu 20.04 / ROS Noetic and Ubuntu 18.04 / ROS Melodic

Dependencies

This package depends on

Some tests depend on

Installation procedure

It is assumed that ROS is installed.

  1. Follow the official instructions to download and extract the zip file of libtorch.

  2. Setup catkin workspace.

$ mkdir -p ~/ros/ws_ddmpc/src
$ cd ~/ros/ws_ddmpc
$ wstool init src
$ wstool set -t src isri-aist/NMPC git@github.com:isri-aist/NMPC.git --git -y
$ wstool set -t src isri-aist/DataDrivenMPC git@github.com:isri-aist/DataDrivenMPC.git --git -y
$ wstool update -t src
  1. Install dependent packages.
$ source /opt/ros/${ROS_DISTRO}/setup.bash
$ rosdep install -y -r --from-paths src --ignore-src
  1. 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.

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