Ejemplo n.º 1
0
def test_social_force(generate_scene):
    scene, config = generate_scene
    f = forces.SocialForce()
    f.init(scene, config)
    f.factor = 1.0
    assert f.get_force(debug=True) == pytest.approx(
        np.array([
            [3.18320152e-12, 1.74095049e-12],
            [-3.64726290e-05, -6.76204532e-05],
            [7.86014187e-03, 1.66840389e-04],
            [7.70524167e-03, -3.03788477e-05],
            [9.12767677e-06, 1.23117582e-05],
        ]))
Ejemplo n.º 2
0
    def make_forces(self, force_configs):
        """Construct forces"""
        force_list = [
            forces.DesiredForce(),
            forces.SocialForce(),
            forces.ObstacleForce(),
            # forces.PedRepulsiveForce(),
            # forces.SpaceRepulsiveForce(),
        ]
        group_forces = [
            forces.GroupCoherenceForceAlt(),
            forces.GroupRepulsiveForce(),
            forces.GroupGazeForceAlt(),
        ]
        if self.scene_config("enable_group"):
            force_list += group_forces

        # initiate forces
        for force in force_list:
            force.init(self, force_configs)

        return force_list