Skip to content

cmubig/Social-Navigation-Simulator

Repository files navigation

Agents spelling ``CADRL''

Social Navigation Simulator (SNS)

Social Navigation Simulator (SNS) is developed based on Gym-Collision-Avoidance (GCA) to simulate diverse types of realistic pedestrian crowds, with various settings and algorithms available to generate dense and rare crowd scenarios.

The SNS simulator provides the following new features, in addition to what is available in the GCA simulator:

  • Addition of more social navigation policies. On top of the CADRL, ORCA algorithms provided by the GCA simulator, we additionally implemented Social LSTM, Social GAN, Social force model, Social-STGCNN, Constant Velocity Model and Social-PEC. With the addition of the mentioned algorithms, it is able to simulate a diverse type of more realistic pedestrian crowds.

  • Support different scene experiment setups to generate dense and rare crowd scenarios. Such that it is easier to collect crowded scenarios and rare agent collision scenarios, which can be difficult to collect in real life.

  • Supports a variable number of agents present in the scene during simulation, allowing asynchronous entrance and exit of agents. Agents can exit the scene while new agents enter the scene simultaneously, which can help simulate the pedestrian's social navigation behavior more accurately.

  • Support agents' temporary collision freeze and action resume timeout, such that collided agents will halt their action temporarily, similar to pedestrian behavior when they accidentally run into each other.

  • Output agents trajectories during simulation, export the simulation results in the format of datasets such as ETH,ZARA1,ZARA2. Allowing users to directly use the simulated trajectories as a new extra dataset for further training.

  • Agents can be easily configured to use different combinations of social navigation algorithms as their policies. (e.g. CADRL vs Socialforce )

Project Contributors

Sam Shum (cshum@andrew.cmu.edu)

Advaith Sethuraman

Dapeng Zhao

PI: Jean Oh


Download and install

git clone https://github.com/cmubig/Social-Navigation-Simulator.git --recurse-submodules
cd Social-Navigation-Simulator
sudo ./install.sh

Library Requirement and Suggested Version

The following libraries will be automatically installed in the virtual environment(venv) created by the installation script.
Your original python workspace, library versions will not be affected.

The following libraries should already exist in the venv, when you run the install script.

  • tensorflow==1.15.2
  • Pillow
  • PyOpenGL
  • pyyaml
  • matplotlib>=3.0.0
  • shapely
  • pytz
  • imageio==2.4.1
  • gym
  • moviepy
  • pandas
  • networkx
  • torch===1.3.1
  • attrdict

Hardware, Software System Requirements

These are the specifications of the hardware used during development.
Different combinations of hardware could work and will yield different speeds.

  • Intel(R) Core(TM) i7-4720HQ CPU @ 2.60GHz
  • 8GB ram
  • GeForce GTX 960M (4GB)

These are the specifications of the software used during development. Different combinations of software might work.

  • Ubuntu 18.04
  • CUDA 10.0 (CUDA Version 10.0.326 / Cuda compilation tools, release 10.0, V10.0.326)
  • cuDNN 7.6.5
  • Python 3.6.9

Example Usage

cd experiments
./run_test_experiments

Different mode usage

exp1 is for ( algorithm-generated dataset using settings from dataset (e.g. UNIV ) )
exp2 is for ( algorithm-generated dataset using population density from 0.1 to 1.0 )
exp3 is for ( 1 vs n-1 ) mixed algorithms case, where 1 agents running algorithm A vs n-1 agents running algorithm B
exp4 is for ( 50% vs 50% ) mixed algorithms case, where 50% agents running algorithm A vs 50% agents running algorithm B

corresponding command format:

# For exp1
python3 src/run_experiment_1.py --output_name "exp1_ETH_CADRL" --experiment_num 1 --algorithm_name "CADRL"\ 
--experiment_iteration 3 --timeout 60 --dataset_name "ETH"
# For exp2
python3 src/run_experiment_1.py --output_name "exp2_0.1_CADRL" --experiment_num 2 --algorithm_name "CADRL"\
--experiment_iteration 3 --timeout 60 --population_density 0.1
# For exp3  ( --algorithm_name [ "algorithm_A", "algorithm_B" ] )
python3 src/run_experiment_1.py --output_name "exp3_0.3_CADRL_RVO" --experiment_num 3 --algorithm_name ["CADRL","RVO"]\
--experiment_iteration 3 --timeout 60 --population_density 0.3
# For exp4  ( --algorithm_name [ "algorithm_A", "algorithm_B" ] )
python3 src/run_experiment_1.py --output_name "exp4_0.3_CADRL_RVO" --experiment_num 4 --algorithm_name ["CADRL","RVO"]\
--experiment_iteration 3 --timeout 60 --population_density 0.3

By following the format above, create your simulation command,
comment out the default simulation command inside run_test_experiment.sh,
put your command in the end of run_test_experiment.sh

Miscellaneous

To change the plot_while_simulation or output_animation setting, change experiment/src/master_config_deploy.py

self.SHOW_EPISODE_PLOTS  = False    # plot and show while simulation? 
self.SAVE_EPISODE_PLOTS  = self.ANIMATE_EPISODES = True  #save simulation result as animation as well?

References

Social LSTM
Alahi, A., Goel, K., Ramanathan, V., Robicquet, A., Fei-Fei, L., & Savarese, S. (2016). Social lstm: Human trajectory prediction in crowded spaces. In Proceedings of the IEEE conference on computer vision and pattern recognition (pp. 961-971).
link to paper

Social GAN
Gupta, A., Johnson, J., Fei-Fei, L., Savarese, S., & Alahi, A. (2018). Social gan: Socially acceptable trajectories with generative adversarial networks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (pp. 2255-2264).
link to paper

Social Force Model
Helbing, D., & Molnar, P. (1995). Social force model for pedestrian dynamics. Physical review E, 51(5), 4282.
link to paper

ORCA (RVO2)
Snape, J., Guy, S. J., Van Den Berg, J., & Manocha, D. (2014). Smooth coordination and navigation for multiple differential-drive robots. In Experimental Robotics (pp. 601-613). Springer, Berlin, Heidelberg.
link to paper

Social-STGCNN Mohamed, A., Qian, K., Elhoseiny, M., & Claudel, C. (2020). Social-stgcnn: A social spatio-temporal graph convolutional neural network for human trajectory prediction. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (pp. 14424-14432).
link to paper

Constant Velocity Model (CVM)
Schöller, C., Aravantinos, V., Lay, F., & Knoll, A. (2020). What the constant velocity model can teach us about pedestrian motion prediction. IEEE Robotics and Automation Letters, 5(2), 1696-1703.
link to paper

Social-PEC (SPEC)
Zhao, D., & Oh, J. (2020). Noticing Motion Patterns: Temporal CNN with a Novel Convolution Operator for Human Trajectory Prediction. IEEE Robotics and Automation Letters.
link to paper

Implementation References

Social Force Implementation modified from here
Social LSTM Implementation modified from here
Social GAN Implementation modified from here
Social STGCNN Implementation modified from here
Constant Velocity Model modified from here
CADRL Implementation from here
RVO2 Implementation from here, here