Skip to content
Snippets Groups Projects
user avatar
yejimun2 authored
4b286970
History

PaS CrowdNav

Set Up

Download pytorch a2c-ppo-acktr from https://github.com/ikostrikov/pytorch-a2c-ppo-acktr-gail Install Python-RVO library : https://github.com/sybrenstuvel/Python-RVO2

The code was written using python 3.6. The following libraries are the minimal to run the code:

cd /home/hcalab/Desktop/MYJ
python3.6 -m venv crowdnew
source crowdnew/bin/activate
pip install Cython
pip install -e .
python setup.py build
python setup.py install
pip install -r requirements.txt
# pip install git+git://github.com/sybrenstuvel/Python-RVO2 # Install Python-RVO library
echo $PWD > crowdnew/lib/python3.6/site-packages/crowd_nav.pth # Add crowd_nav directory to python path
echo $PWD > crowdnew/lib/python3.6/site-packages/crowd_sim.pth # Add crowd_sim directory to python path
# git clone https://github.com/openai/baselines.git # Install baseline package from https://github.com/openai/baselines
cd baselines 
pip install -e .
pip3 install llvmlite==0.36.0
pip install numba==0.48
pip install googledrivedownloader

Change configurations

  1. Environment configurations: modify crowd_nav/configs/config.py
  • For FoV environment (left in the figure below): change the value of robot.FOV
  • For Group environment (right in the figure below): set sim.group_human to True
  1. PPO configurations: modify arguments.py

Before you run the code

  1. Create a 'data' folder and unzip the shared 'VAE_CC_LabelAE' inside the folder https://drive.google.com/file/d/1EzotQv1gaoeX0Npditz_f_X9243sw-KO/view?usp=sharing

Run the code

**You can skip step 1,2. The shared "VAE_CC_LabelAE" folder has pretrained weights. 0. Activate your virtual environment

source crowdenv/bin/activate
  1. Collect data for training a autoencoder (Learning occlusion inference) Some of the parameters need to be changed in the config & argument file before running. Please check the below python file for details.
python collect_data.py 
  1. Train a autoencoder (Learning occlusion inference)
python vae_pretrain.py 
  1. Train a policy.
python train.py 
  1. Test policies.
python test.py 
  1. Plot training curve.
python plot.py

(Tested our code in Ubuntu 18.04 with Python 3.6.)

Changing input of the multi_env

Need to change the following files

pytorchBaselines/a2c_ppo_acktr/envs.py
pytorchBaselines/a2c_ppo_acktr/shmem_vec_env.py
baselines/baselines/common/vec_env/shmem_vec_env.py
baselines/baselines/common/vec_env/dummy_vec_env.py

Troubleshooting

File "/home//crowdenv/lib/python3.8/site-packages/torch/nn/modules/rnn.py", line 175, in flatten_parameters torch._cudnn_rnn_flatten_weight( RuntimeError: CUDA error: no kernel image is available for execution on the device CUDA kernel errors might be asynchronously reported at some other API call,so the stacktrace below might be incorrect.

Solution

pip uninstall torch torchvision torchaudio

Install the Preview (Nightly) by pip according to https://pytorch.org/get-started/locally/