Skip to main content

Numpy implementation of the Extended Social Force model.

Project description

PySocialForce

master: Build Status dev: Build Status

Extended Social Force Model implemented in NumPy

Table of Contents

About The Project

This project is a NumPy implementation of the Extended Social Force Model [2]. It extends the vanilla social force model [1] to simulate the walking behaviour of pedestrian social groups.

Roadmap

  • Simulation of indiviual pedestrians
  • Social groups simulation
  • Inter-group interactions
  • Environmental obstacles
  • Better environment representation
  • Easy configuration with toml file
  • Visualization of indiviuals and groups
  • Visualization of forces/potentials

Installation

  1. Clone the PySocialForce repo

    git clone https://github.com/yuxiang-gao/PySocialForce.git
    
  2. (optional) Create a python virtual environment and activate it

  3. Install the pip package

        # Option 1: install from PyPI
        pip install 'pysocialforce[test,plot]'
    
        # Option 2:  install from source
        pip install -e '.[test,plot]'
    
        # run linting and tests
        pylint pysocialforce
        pytest tests/*.py
    

Usage

Basic usage:

import pysocialforce as psf
# initiate simulator
sim = psf.Simulator(
        initial_state, groups=groups, obstacles=obstacles, config_file="config.toml"
    )
# do 50 updates
sim.step(n=50)

You can configure the parameters by passing in a toml file. Default configurations are located in the config.toml file in root directory.

For more examples, please refer to the examples folder.

Examples

Ped-ped Scenarios

crossing narrow
opposing 2opposing

Environmental obstacles

sperator gate
Emergent lane formation with Emergent lane formation with 30 pedestrians: walkway30 Emergent lane formation with Emergent lane formation with 60 pedestrians: walkway60

Groups

group crossing

License

Distributed under the MIT License. See LICENSE for more information.

Acknowledgements

  • This project is based on svenkreiss's implementation of the vanilla social force model.
  • The implementation of forces drew inspiration from the pedsim_ros package.

References

[1] Helbing, D., & Molnár, P. (1995). Social force model for pedestrian dynamics. Physical Review E, 51(5), 4282–4286. https://doi.org/10.1103/PhysRevE.51.4282

[2] Moussaïd, M., Perozo, N., Garnier, S., Helbing, D., & Theraulaz, G. (2010). The walking behaviour of pedestrian social groups and its impact on crowd dynamics. PLoS ONE, 5(4), 1–7. https://doi.org/10.1371/journal.pone.0010047

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

PySocialForce-0.2.1.tar.gz (13.9 kB view hashes)

Uploaded Source

Built Distribution

PySocialForce-0.2.1-py3-none-any.whl (16.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page