The tools contained within this repository have been used to implement an MPPI controller based off of GeorgiaTech's AutoRally implementation.
A Notion website was developed to gain a deeper understanding on how the algorithm is structured in CUDA language.
-
Install Ubuntu 18.04 64-bit
-
Install required packages
sudo apt install git doxygen openssh-server libusb-dev texinfo
-
Install ros-melodic-desktop-full
-
Install Dependencies The core idea behind MPPI is to sample thousands of trajectories really fast. This is accomplished by implementing the sampling step on a GPU, for which you will need CUDA. We also use an external library to load python's numpy zip archives (.npz files) into C++.
-
Install CNPY
mkdir -p ~/tmp ; cd ~/tmp git clone git@github.com:rogersce/cnpy.git cd cnpy && mkdir build ; cd build && cmake .. make sudo make install
-
Install gtsam
mkdir -p ~/tmp ; cd ~/tmp git clone git@github.com:borglab/gtsam.git cd gtsam && mkdir build && cd build cmake -DGTSAM_INSTALL_GEOGRAPHICLIB=ON -DGTSAM_WITH_EIGEN_MKL=OFF .. make sudo make install
Get the autorally repository in a catkin workspace. The suggested location is ~/catkin_ws/src/
, but any valid catkin worskspace source folder will work.
-
Create workspace if non-existent and switch into it
mkdir ~/catkin_ws/src/ ; cd ~/catkin_ws/src/
-
Clone repository and its dependencies
git clone git@github.com:arpg/ninja_car_driving_control.git --recurse-submodules git clone git@github.com:JaumeAlbardaner/ninjacar_mppi.git
-
Set variables in ~/.bashrc
Your
~/.bashrc
should include these lines (adapted for your PC):export CUDA_HOME=/usr/local/cuda export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib64:/usr/local/cuda/extras/CUPTI/lib64 export PATH=$PATH:$CUDA_HOME/bin source /opt/ros/melodic/setup.bash source /home/yauma/catkin_ws/devel/setup.bash export AR_MPPI_PARAMS_PATH=`rospack find autorally_control`/src/path_integral/params/
-
Install AutoRally ROS Dependencies
Within the catkin workspace folder, run this command to install the packages this project depends on.
cd ~/catkin_ws/ && rosdep install --from-path src --ignore-src -y
-
Build ninjacar_mppi
It is recommended that you use
catkin build
:sudo apt-get install python-catkin-tools
cd ~/catkin_ws/ && catkin build autorrally_control
If problems arise building
drive_control
, contact @mmiles19 . If the problem is related to a missing library, you may try to comment lines 105-144 of the CMakeLists.txt file within the package ros_polulu_servo, building again, descommenting them, and building again. The issue should subside. -
Compilation & Running
First, check your Eigen version with
pkg-config --modversion eigen3
If you don't have at least version 3.3.5, update it:
mkdir -p ~/tmp ; cd ~/tmp git clone git@github.com:eigenteam/eigen-git-mirror.git cd eigen-git-mirror && mkdir build && cd build cmake .. sudo make install
-
Change into the workspace
cd ~/catkin_ws/
-
Source into the workspace's environment
source devel/setup.bash
-
Connect to the VRPN server (if in the lab, simulation still works otherwise)
roslaunch vrpn_client_ros sample.launch server:=tracker
-
Run the MPPI controller
If the neural network model wants to be launched:
roslaunch autorally_control path_integral_nn.launch
If the base functions model wants to be launched instead:
roslaunch autorally_control path_integral_bf.launch
-
All of the variables set in the launch files are described in the MPPI Wiki.
-
Issues with Eigen occurred during compilation, hence why in some CMakeFiles, a different c++ compiler is used.
-
The republisher called in both launchers: command_republisher.py, is a patch made to regulate that the output of MPPI actually is within a range. Otherwise it would still output values outside the min and max values set in the
.launch
file. -
When the
path_integral_bf.launch
is called, the variable use_feedback_gains must be set to false. The DDP algorithm does not work properly when the pose messages are not given consistently, which does not hold true in the motion capture space. -
The republisher command_rosbag.py is to be called every time one wants to capture a rosbag to train a neural network using mppi_trainer.
-
The costMap building tool is located in the ninjacar_map repository.