예제 #1
0
def test_desired_force(generate_scene):
    scene, config = generate_scene
    f = forces.DesiredForce()
    f.init(scene, config)
    f.factor = 1.0
    assert f.get_force(debug=True) == pytest.approx(
        np.array([
            [-3.83847763, -1.83847763],
            [-1.74894926, -3.92384419],
            [-4.6, -4.6],
            [-6.10411508, -8.11779546],
            [-10.93315315, -8.57753753],
        ]))
예제 #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