Skip to content

JaumeAlbardaner/ninjacar_mppi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 

Repository files navigation

ninjacar_mppi

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.

Setup Instructions

Contents

  1. Install Prerequisites
  2. Clone repository
  3. Run MPPI controller
  4. Sidenotes

1. Install Prerequisites

  1. Install Ubuntu 18.04 64-bit

  2. Install required packages

    sudo apt install git doxygen openssh-server libusb-dev texinfo

  3. Install ros-melodic-desktop-full

  4. 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 CUDA

    • 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
      

2. Clone or Fork Repositories

Get the autorally repository in a catkin workspace. The suggested location is ~/catkin_ws/src/ , but any valid catkin worskspace source folder will work.

  1. Create workspace if non-existent and switch into it

    mkdir ~/catkin_ws/src/ ; cd ~/catkin_ws/src/
    
  2. 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
    
  3. 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/
    
  4. 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
    
  5. 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.

  6. 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
    

3. Run MPPI controller

  1. Change into the workspace

    cd ~/catkin_ws/
    
  2. Source into the workspace's environment

    source devel/setup.bash
    
  3. Connect to the VRPN server (if in the lab, simulation still works otherwise)

    roslaunch vrpn_client_ros sample.launch server:=tracker
    
  4. 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
    

4. Sidenotes

  1. All of the variables set in the launch files are described in the MPPI Wiki.

  2. Issues with Eigen occurred during compilation, hence why in some CMakeFiles, a different c++ compiler is used.

  3. 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.

  4. 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.

  5. 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.

  6. The costMap building tool is located in the ninjacar_map repository.

About

This repository contains the MPPI implementation for the NinjaCar at the Autonomous Robotics and Perception Group at the University of Colorado, Boulder.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published