Home

Awesome

lightsfm

A lightweight implementation of the Social Force Model for Social Local Navigation. It is based on the initial model proposed by Helbing and Molnar [1] and extended for social groups by Moussaid et Al. [2][3]:

Acknowledgement

This work has been financed by the European Regional Development Fund (FEDER) and by the Ministry of Economy, Knowledge, Business and University, of the Government of Andalucía , within the framework of the FEDER Andalucía 2014-2020 operational program. Specific objective 1.2.3. "Promotion and generation of frontier knowledge and knowledge oriented to the challenges of society, development of emerging technologies" within the framework of the reference research project UPO-1264631. FEDER co-financing percentage 80% <img src="https://github.com/robotics-upo/lightsfm/blob/master/media/logos_repo_github.jpg" width="600">

Social Forces

The model consists on the definition of different attractive and repulsive forces that describe the local navigation behavior of pedestrians.

<img src="https://render.githubusercontent.com/render/math?math=F_{total} = F_{goal} %2B \sum F_{obs} %2B \sum F_{soc} %2B F_{group}">

*Note: vectors are indicated with capital letters

1. Attractive force to reach the goal (DesiredForce F<sub>goal</sub>)

<img src="https://render.githubusercontent.com/render/math?math=F_{goal} = \omega_{g}+\frac{1}{\sigma_{g}}+(v_{desired}E_{desired} - V_{actual})">

With:

And parameters:

2. Repulsive force of obstacles (ObstacleForce F<sub>obs</sub>)

We use a monotonic decreasing potential of the force (an exponential in our case) based on the distance between the agent and the obstacles.

<img src="https://render.githubusercontent.com/render/math?math=F_{obs} = - \omega_{o}+e^{(-R_{po} / \sigma_{o})} U_{R_{po}}">

With:

And parameters:

3. Respulsive force of other pedestrians (SocialForce F<sub>soc</sub>)

Other pedestrians will prokove a repulsive effect on the agent. In the initial model [1], a potential with the form of an ellipse directed in the motion direction of the pedestrian is proposed. However, in the empirical study carried out in [2], the authors specify a more advanced interaction function based on two components, <img src="https://render.githubusercontent.com/render/math?math=f_{v}"> and <img src="https://render.githubusercontent.com/render/math?math=f_{\theta}">, describing the deceleration along the interaction direction <img src="https://render.githubusercontent.com/render/math?math=I_{pi}"> and directional changes along the normal vector to the interaction direction oriented to the left, <img src="https://render.githubusercontent.com/render/math?math=N_{pi}">.

<img src="https://render.githubusercontent.com/render/math?math=F_{soc} = \omega_{s} (f_{v} I_{pi} %2B f_{\theta} N_{pi}) +">

in which the interaction direction between the agent p and the pedestrian i, is the unit vector <img src="https://render.githubusercontent.com/render/math?math=I_{pi} = \frac{I_{vpi}}{\left \| I_{vpi} \right \|}+">

And the interaction vector computed as a composition of the direction of relative motion and the direction in which the interaction pedestrian i is located:

<img src="https://render.githubusercontent.com/render/math?math=I_{vpi} = \lambda_{s}(V_{p} - V_{i}) %2B \frac{R_{i}-R_{p}}{\left \| R_{i}-R_{p} \right \|} +">

If <img src="https://render.githubusercontent.com/render/math?math=d_{pi}"> denotes the distance between two pedestrians p and i and <img src="https://render.githubusercontent.com/render/math?math=\theta+"> the angle between the interaction direction <img src="https://render.githubusercontent.com/render/math?math=I_{pi}"> and the vector pointing from agent p to pedestrian i, we have:

<img src="https://render.githubusercontent.com/render/math?math=f_{v} = - e^{(-d/B - (n_{s}\'B\theta)^2)}+">

This represents an exponential decay of the deceleration with distance d.

<img src="https://render.githubusercontent.com/render/math?math=f_{\theta} = - k e^{(-d/B - (n_{s}B\theta)^2)}+">

With:

Parameters:

4. Force of interaction groups (GroupForce F<sub>group</sub>)

This force is a combination of another subforces that describes the formation of the social group, as described in [3].

<img src="https://render.githubusercontent.com/render/math?math=F_{group} = F_{ggaze} %2B F_{gcoh} %2B \sum F_{grep}">

4.1. Force of vision field of the group (GroupGazeForce F<sub>ggaze</sub>)

It is based on the rotation angle of the pedestrian's head (gazing direction) so that the group's mass center is included in the vision field (~90º). The greater the head rotation the less comfortable is the turning for walking, and therefore the pedestrian adjusts its position to reduce the head rotation. In our implementation we can not detect the gaze direction, so we check if the group's mass center is beyond the vision field of the pedestrian according to his/her movement direction. Therefore, if the angle to communicate with the group (look to the mass center) is greater than the vision field we apply the following force:

<img src="https://render.githubusercontent.com/render/math?math=F_{ggaze} = \omega_{gz}+\alpha+V_{desired}">

With:

Where <img src="https://render.githubusercontent.com/render/math?math=R_{pg} +"> is the position of the group's mass center g relative to the pedestrian p.

Parameters:

4.2. Attraction force to the group's center of mass (GroupCoherenceForce F<sub>gcoh</sub>)

The agent feels an attraction to keep close to its interaction group (to keep the coherence of the group). <img src="https://render.githubusercontent.com/render/math?math=F_{gcoh} = \omega_{gc}+q_{a}+R_{pg}">

With:

4.3. Respulsion force of overlaping group members (GroupRespulsionForce F<sub>grep</sub>)

Repulsion effect so that the group members do not overlap each other.

<img src="https://render.githubusercontent.com/render/math?math=F_{grep} = - \omega_{gr}+q_{r}+R_{pi}">

With:

Parameters:

Code indications

This is header-only library that does not depend on ROS. All the agents positions, velocities, obstacles, etc must be provided according to the same selected coordinate frame.

<!--- **rosmap.hpp** is a class that implements the virtual methods of map.hpp and uses ROS to obtain the static navigation map. It also implement a kd-tree to perform a nearest-neighbor search on the obstacle map.--> <!--- **cmd_vel.hpp** make use of the forces in order to compute a velocity command to be sent to the robot. A aproximation based on Dynamic Window Approach is employed. --> <!--- **astar.hpp** is an auxiliary class that contains the implementation of a Astar path planning algorithm.-->

How to use it

First, you need to compile and install the library:

make

sudo make install

The library will be installed in the directory /usr/local/include/lightsfm

To use the library in you project, you need two things mainly:

An example of the use of the library can be seen in: