Skip to content

[PROCESSORS] BonnMotionTrajectoryProcessor changes trajectories in FootStepProcessor

Mayr, Christina Maria requested to merge bug_fix_wait_jumping_agents into master

Observation:

'Wrong' trajectories, see scenario vadere/Scenarios/Demos/test_project/one_way_lane_wait_with_bonnmotion.scenario

agent_in_obstacle

Problem:

The BonnMotionTrajectoryProcessor changes the trajectories stored in the FootStepProcessor:

Map<TimestepPedestrianIdKey, VPoint> trajectories = this.pedestrianPositionProcessor.getData();
		trajectories.entrySet().forEach(e -> {
			int pedId = e.getKey().getPedestrianId();
			double time = e.getKey().getTimestep() * simTimeStepLength;
			VPoint point = e.getValue();

			if (attr.getOrigin().equals("upper left")){
				point.y = boundHeight - point.y;
			}

			if(attr.isApplyOffset() && coordRef != null){
				point  = point.add(coordRef.getTranslation());
			}

			point = point.multiply(attr.getScale());
			point = point.add(attr.getTranslate());

			Pair<Double, VPoint> wayPoint = Pair.of(time, point);
			addWayPoint(pedId, wayPoint); // HERE THE TRAJECTORY IS CHANGED

Solution:

The BonnMotionTrajectoryProcessor has to work on a deepcopy of the trajectories or the footsteps. I suggest to clone the footstep:

		for (TimestepPedestrianIdKey e : trajectories.keySet()) {
			int pedId = e.getPedestrianId();
			double time = e.getTimestep() * simTimeStepLength;
			VPoint point = trajectories.get(e).clone(); // CLONE!!!

Notes:

  • the BonnMotionTrajectoryProcessorTest is currently not running neither in the master branch nor in this branch, see #344 .

Before merging:

  • please remove the example scenario files under vadere/Scenarios/Demos/test_project

Merge request reports