BADGR: An Autonomous Self-Supervised Learning-Based Navigation System.


Make sure you have 90GB of space available, anaconda installed, and ROS installed. Our installation was on Ubuntu 16.04 with ROS Kinetic.

Clone the repository and go into the folder:

git clone
cd badgr

From now on, we will assume you are in the badgr folder.

Download the training data tfrecords and sample rosbags from here, and extract them into the data folder:

mkdir data
cd data
mv </path/to/> .
mv </path/to/> .
mv </path/to/> .
cd ..

Then setup the anaconda environment:

conda create -y --name badgr python==3.6.9
source activate badgr
pip install -r requirements.txt
sudo apt-get install ros-${ROS_DISTRO}-ros-numpy

Add the src directory to your PYTHONPATH:

echo 'export PYTHONPATH=</path/to/badgr/src>:$PYTHONPATH' >> ~/.bashrc


Open a new terminal and activate the badgr anaconda environment:

source activate badgr

We train two separate neural networks: one that predicts future collisions and positions, and one that predicts bumpy terrain:

python scripts/ configs/
python scripts/ configs/

These networks are trained separately so that the data can be rebalanced for either equal proportion collision or bumpy labels. However, at test time these models are combined into a single predictive model, which is possible because the models both have the same inputs.

Create the folder for the combined model:

mkdir data/bumpy_collision_position


First, play the collision rosbag in a loop,

rosbag play -l data/rosbags/collision.bag

set the cost function weights to only account for collisions,

rosparam set /cost_weights "{'collision': 1.0, 'position': 0.0, 'position_sigmoid_center': 0.4, 'position_sigmoid_scale': 100., 'action_magnitude': 0.01, 'action_smooth': 0.0, 'bumpy': 0.0}"

and then start the policy

python scripts/ configs/

This will display a visualizer showing the candidate action sequences, predicted probabilities of collision, and the optimal action sequence for purely avoiding collisions.


If you wish to visualize the planner for avoiding bumpy terrain, start the bumpy rosbag in a loop,

rosbag play -l data/rosbags/bumpy.bag

change the cost function,

rosparam set /cost_weights "{'collision': 0.0, 'position': 0.0, 'position_sigmoid_center': 0.4, 'position_sigmoid_scale': 100., 'action_magnitude': 0.01, 'action_smooth': 0.0, 'bumpy': 1.0}"

change the visualizer to show bumpiness by modifying configs/ to have debug_color_cost_key='bumpy', and restart the policy

python scripts/ configs/


  1. If you are having issues with importing OpenCV (e.g., ImportError: /opt/ros/kinetic/lib/python2.7/dist-packages/ undefined symbol: PyCObject_Type), try the following to have python look for the Python 3 OpenCV first:
export PYTHONPATH=<path/to/anaconda/envs>/badgr/lib/python3.6/site-packages/:$PYTHONPATH