Skip to content

Code for our paper "Active Safety Envelopes using Light Curtains with Probabilistic Guarantees", RSS 2021

License

Notifications You must be signed in to change notification settings

CMU-Light-Curtains/SafetyEnvelopes

Repository files navigation

Active Safety Envelopes using Light Curtains with Probabilistic Guarantees

Project Website: https://siddancha.github.io/projects/active-safety-envelopes-with-guarantees

This is the official code for our paper:

Siddharth Ancha, Gaurav Pathak, Srinivasa Narasimhan, and David Held.
Active Safety Envelopes using Light Curtains with Probabilistic Guarantees.
In Proceedings of Robotics: Science and Systems (RSS), July 2021.

Installation

1. Clone repository

git clone --recursive [email protected]:CMU-Light-Curtains/SafetyEnvelopes.git
cd SafetyEnvelopes

2. Install python package dependencies:

Note: this repository uses Python 3.6+.

pip install fire easydict sacred stable-baselines3 Flask scikit-image pyzmq

3. Set up the light curtain simulator package Simulator.

cd Simulator
mkdir build && cd build
ANACONDA_ENV_PATH=/path/to/anaconda/env
cmake -DCMAKE_BUILD_TYPE=Release \
      -DPYTHON_EXECUTABLE:FILEPATH=$ANACONDA_ENV_PATH/bin/python \
      -DPYTHON_LIBRARY=$ANACONDA_ENV_PATH/lib/libpython3.so \
      -DPYTHON_INCLUDE_DIR=$ANACONDA_ENV_PATH/include/python3.7m ..
make -j
cd ../..

4. Set up the light curtain planning and optimization package ConstraintGraph.

cd ConstraintGraph
mkdir build && cd build
ANACONDA_ENV_PATH=/path/to/anaconda/env
cmake -DCMAKE_BUILD_TYPE=Release \
      -DBIND_PY=ON \
      -DPYTHON_EXECUTABLE:FILEPATH=$ANACONDA_ENV_PATH/bin/python \
      -DPYTHON_LIBRARY=$ANACONDA_ENV_PATH/lib/libpython3.so \
      -DPYTHON_INCLUDE_DIR=$ANACONDA_ENV_PATH/include/python3.7m ..
make -j
cd ../..

5. Install cpp utils.

cd cpp
mkdir build && cd build
ANACONDA_ENV_PATH=/path/to/anaconda/env
cmake -DCMAKE_BUILD_TYPE=Release \
      -DPYTHON_EXECUTABLE:FILEPATH=$ANACONDA_ENV_PATH/bin/python \
      -DPYTHON_LIBRARY=$ANACONDA_ENV_PATH/lib/libpython3.so \
      -DPYTHON_INCLUDE_DIR=$ANACONDA_ENV_PATH/include/python3.7m ..
make -j
cd ../..

6. Set up environment variables

Note: $DATADIR/synthia should be the location of the SYNTHIA-AL dataset.

# Ideally add these to your .bashrc file
export DATADIR=/path/to/data/dir
export SE_DIR=/path/to/SafetyEnvelopes
export PYTHONPATH=$PYTHONPATH:$SE_DIR:$SE_DIR/Simulator/python:$SE_DIR/ConstraintGraph/apis/py:$SE_DIR/cpp/build

7. Set up the dataset

python data/synthia.py create_video_infos_file --split=mini_train  # creates video info file in $DATADIR 

Running the visualizer

In separate windows, run:

1. Backend server

python ./visualizer/backend/backend.py --actor=ACTOR_NAME --horizon=HORIZON --load_weights_from_run=RUN_ID

2. Frontend server

cd ./visualizer/frontend
python -m http.server

3. Open http://127.0.0.1:8000/ in browser

Commands to reproduce experiments in the paper

The following set of commands fully reproduces all experiments in our paper.

Ours

  • python dagger.py with bevnet_all -p -m sacred
  • python dagger.py with bevnet_all env.use_random_curtain=True -p -m sacred

Baselines

1D CNN

  • python dagger.py with cnn1d_all -p -m sacred
  • python dagger.py with cnn1d_all env.use_random_curtain=True -p -m sacred

1D GNN

  • python dagger.py with vres_all -p -m sacred
  • python dagger.py with vres_all env.use_random_curtain=True -p -m sacred

Ablations

Don't perform forecasting

  • Change to gt_action = prev_frame.annos["se_ranges"].copy() in line 256 of envs/env.py

Don't use the base policy as input

  • Appropriately modify policies/actors/nn/networks/bevnet.py.

Reduce the history from 5 to 1

  • python dagger.py with bevnet_all bevnet.history=2 -p -m sacred
  • python dagger.py with bevnet_all bevnet.history=2 env.use_random_curtain=True -p -m sacred

Evaluation

Baseline

  • python eval/main.py --actor=BaselineActor --horizon=50 --split=mini_test
  • python eval/main.py --actor=BaselineActor --horizon=50 --split=mini_test with env.use_random_curtain=True

Ours

  • python eval/main.py --actor=BevNet --horizon=50 --split=mini_test --load_weights_from_run=154
  • python eval/main.py --actor=BevNet --horizon=50 --split=mini_test --load_weights_from_run=154 with env.use_random_curtain=True

About

Code for our paper "Active Safety Envelopes using Light Curtains with Probabilistic Guarantees", RSS 2021

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published