Commit c6dcfe8e authored by Daniel Lehmberg's avatar Daniel Lehmberg
Browse files

resolve in-code TODO -> rename getFootsteps() to getTrajectory()

parent 9eec9eb4
{
"name" : "thin_wall_discrete_ok",
"description" : "",
"release" : "1.2",
"release" : "1.3",
"processWriters" : {
"files" : [ {
"type" : "org.vadere.simulator.projects.dataprocessing.outputfile.PedestrianIdOutputFile",
......@@ -135,7 +135,8 @@
"height" : 10.0
},
"boundingBoxWidth" : 0.5,
"bounded" : true
"bounded" : true,
"referenceCoordinateSystem" : null
},
"obstacles" : [ {
"shape" : {
......
{
"name" : "thin_wall_nelder_mead_ok",
"description" : "",
"release" : "1.2",
"release" : "1.3",
"processWriters" : {
"files" : [ {
"type" : "org.vadere.simulator.projects.dataprocessing.outputfile.PedestrianIdOutputFile",
......@@ -135,7 +135,8 @@
"height" : 10.0
},
"boundingBoxWidth" : 0.5,
"bounded" : true
"bounded" : true,
"referenceCoordinateSystem" : null
},
"obstacles" : [ {
"shape" : {
......
{
"name" : "thin_wall_pso_ok",
"description" : "",
"release" : "1.2",
"release" : "1.3",
"processWriters" : {
"files" : [ {
"type" : "org.vadere.simulator.projects.dataprocessing.outputfile.PedestrianIdOutputFile",
......@@ -135,7 +135,8 @@
"height" : 10.0
},
"boundingBoxWidth" : 0.5,
"bounded" : true
"bounded" : true,
"referenceCoordinateSystem" : null
},
"obstacles" : [ {
"shape" : {
......
......@@ -2,13 +2,11 @@ package org.vadere.simulator.control.cognition;
import org.vadere.state.events.types.BangEvent;
import org.vadere.state.behavior.SalientBehavior;
import org.vadere.state.events.types.Event;
import org.vadere.state.scenario.Pedestrian;
import org.vadere.state.scenario.Topography;
import org.vadere.state.simulation.LastFootSteps;
import java.util.Collection;
import java.util.List;
/**
* The SalientBehaviorCognition class should provide logic to change the salient behavior of a pedestrian
......@@ -36,7 +34,7 @@ public class SalientBehaviorCognition {
int requiredFootSteps = 2;
double requiredSpeedInMetersPerSecondToBeCooperative = 0.05;
LastFootSteps lastFootSteps = pedestrian.getFootSteps().getLastFootSteps();
LastFootSteps lastFootSteps = pedestrian.getTrajectory().getLastFootSteps();
if (lastFootSteps.size() >= requiredFootSteps) { // Adapt behavior only if we have seen some footsteps in the past
if (lastFootSteps.getAverageSpeedInMeterPerSecond() <= requiredSpeedInMetersPerSecondToBeCooperative) {
......
......@@ -189,7 +189,7 @@ public class PedestrianBHM extends Pedestrian {
throw new UnsupportedEventException(mostImportantEvent, this.getClass());
}
getFootSteps().add(new FootStep(position, getPosition(), timeOfNextStep, timeOfNextStep + durationNextStep));
getTrajectory().add(new FootStep(position, getPosition(), timeOfNextStep, timeOfNextStep + durationNextStep));
}
/**
......
......@@ -13,7 +13,6 @@ import org.vadere.state.scenario.DynamicElement;
import org.vadere.state.scenario.Pedestrian;
import org.vadere.state.scenario.Topography;
import org.vadere.state.simulation.FootStep;
import org.vadere.simulator.utils.cache.ScenarioCache;
import org.vadere.util.geometry.shapes.VPoint;
import org.vadere.util.geometry.shapes.VShape;
......@@ -111,7 +110,7 @@ public class BiomechanicsModel implements MainModel {
for(int i = 0; i < pedestriansBMM.size(); i++) {
PedestrianBMM agent = pedestriansBMM.get(i);
agent.clearFootSteps();
agent.getFootSteps().add(new FootStep(positions.get(i), agent.getPosition(), lastSimTimeInSec, simTimeInSec));
agent.getTrajectory().add(new FootStep(positions.get(i), agent.getPosition(), lastSimTimeInSec, simTimeInSec));
}
this.lastSimTimeInSec = simTimeInSec;
......
......@@ -128,7 +128,7 @@ public abstract class ODEModel<T extends DynamicElement, TAttributes extends Att
if (element.getType() == ScenarioElementType.PEDESTRIAN) {
Pedestrian pedestrian = (Pedestrian)element;
pedestrian.clearFootSteps();
pedestrian.getFootSteps().add(new FootStep(positions.get(i), pedestrian.getPosition(), lastSimTimeInSec, simTimeInSec));
pedestrian.getTrajectory().add(new FootStep(positions.get(i), pedestrian.getPosition(), lastSimTimeInSec, simTimeInSec));
}
}
}
......
......@@ -11,7 +11,6 @@ import org.vadere.state.scenario.Pedestrian;
import org.vadere.state.scenario.Target;
import org.vadere.state.scenario.Topography;
import org.vadere.state.simulation.FootStep;
import org.vadere.state.simulation.VTrajectory;
import org.vadere.util.geometry.shapes.VPoint;
import org.vadere.util.geometry.shapes.Vector2D;
......@@ -79,7 +78,7 @@ public class OSMBehaviorController {
// strides and foot steps have no influence on the simulation itself, i.e. they are saved to analyse trajectories
pedestrian.getStrides().add(Pair.of(currentPosition.distance(nextPosition), stepStartTime));
pedestrian.getFootSteps().add(new FootStep(currentPosition, nextPosition, stepStartTime, stepEndTime));
pedestrian.getTrajectory().add(new FootStep(currentPosition, nextPosition, stepStartTime, stepEndTime));
}
public void wait(PedestrianOSM pedestrian) {
......
......@@ -190,8 +190,8 @@ public class UpdateSchemeEventDrivenParallel extends UpdateSchemeEventDriven {
}
private boolean hasChanged() {
//System.out.println(pedestrianOSM.getFootSteps().getFootSteps().size());
return pedestrianOSM.getFootSteps().isEmpty() || pedestrianOSM.getFootSteps().getFootSteps().peekLast().length() > 0;
//System.out.println(pedestrianOSM.getTrajectory().getTrajectory().size());
return pedestrianOSM.getTrajectory().isEmpty() || pedestrianOSM.getTrajectory().getFootSteps().peekLast().length() > 0;
}
@Override
......
......@@ -134,7 +134,7 @@ public interface UpdateSchemeOSM extends DynamicElementRemoveListener<Pedestrian
* strides and foot steps have no influence on the simulation itself, i.e. they are saved to analyse trajectories
*/
pedestrian.getStrides().add(Pair.of(currentPosition.distance(nextPosition), timeOfNextStep));
pedestrian.getFootSteps().add(new FootStep(currentPosition, nextPosition, timeOfNextStep, entTimeOfStep));
pedestrian.getTrajectory().add(new FootStep(currentPosition, nextPosition, timeOfNextStep, entTimeOfStep));
}
}
......@@ -44,7 +44,7 @@ public class PedestrianReynolds extends Pedestrian {
setPosition(newPosition);
clearFootSteps();
// TODO: the first footstep starts at the wrong time!
getFootSteps().add(new FootStep(oldPosition, newPosition, lastSimTimeInSec, simTime));
getTrajectory().add(new FootStep(oldPosition, newPosition, lastSimTimeInSec, simTime));
lastSimTimeInSec = simTime;
}
......
......@@ -15,7 +15,7 @@ public class EventtimePedestrianIdKey implements DataKey<EventtimePedestrianIdKe
private final int pedestrianId;
public EventtimePedestrianIdKey(double simTime, int pedestrianId) {
this.simTime = simTime ;
this.simTime = simTime;
this.pedestrianId = pedestrianId;
}
......@@ -43,7 +43,7 @@ public class EventtimePedestrianIdKey implements DataKey<EventtimePedestrianIdKe
@Override
public String toString() {
return "TimestepPedestrianIdKey{" +
return "EventtimePedestrianIdKey{" +
"simTime=" + this.simTime +
", pedestrianId=" + pedestrianId +
'}';
......
......@@ -12,12 +12,10 @@ import org.vadere.state.attributes.processor.AttributesProcessor;
import org.vadere.state.scenario.MeasurementArea;
import org.vadere.state.scenario.Pedestrian;
import org.vadere.state.simulation.FootStep;
import org.vadere.util.factory.processors.Flag;
import org.vadere.util.geometry.shapes.VRectangle;
import org.vadere.util.logging.Logger;
import java.util.Collection;
import java.util.List;
@DataProcessorClass()
public class PedestrianCrossingTimeProcessor extends DataProcessor<PedestrianIdKey, Pair<Double, Double>> implements UsesMeasurementArea {
......@@ -39,7 +37,7 @@ public class PedestrianCrossingTimeProcessor extends DataProcessor<PedestrianIdK
for(Pedestrian ped : peds) {
PedestrianIdKey key = new PedestrianIdKey(ped.getId());
for(FootStep footStep : ped.getFootSteps()) {
for(FootStep footStep : ped.getTrajectory()) {
if(footStep.intersects(measurementAreaVRec)) {
double intersectionTime = footStep.computeIntersectionTime(measurementAreaVRec);
......
......@@ -12,7 +12,7 @@ import java.util.Arrays;
import java.util.LinkedList;
/**
* <p>During one time step a pedestrian my move multiple times which is saved by {@link Pedestrian#getFootSteps()}, i.e.
* <p>During one time step a pedestrian my move multiple times which is saved by {@link Pedestrian#getTrajectory()}, i.e.
* the {@link VTrajectory} will be adjusted after each update(simTimeInSec) call such that it contains the foot steps
* which started at the lastSimTimeInSec!</p>
*
......@@ -36,7 +36,7 @@ public class PedestrianFootStepProcessor extends DataProcessor<EventtimePedestri
@Override
protected void doUpdate(final SimulationState state) {
for (Pedestrian pedestrian : state.getTopography().getElements(Pedestrian.class)) {
LinkedList<FootStep> footSteps = pedestrian.getFootSteps().clone().getFootSteps();
LinkedList<FootStep> footSteps = pedestrian.getTrajectory().clone().getFootSteps();
for (FootStep fs : footSteps) {
putValue(new EventtimePedestrianIdKey(fs.getStartTime(), pedestrian.getId()), fs);
......
......@@ -35,7 +35,7 @@ public class PedestrianLineCrossProcessor extends DataProcessor<PedestrianIdKey,
for(Pedestrian ped : peds) {
PedestrianIdKey key = new PedestrianIdKey(ped.getId());
for(FootStep footStep : ped.getFootSteps()) {
for(FootStep footStep : ped.getTrajectory()) {
if(footStep.intersects(line)) {
double intersectionTime = footStep.computeIntersectionTime(line);
this.putValue(key, intersectionTime);
......
......@@ -32,7 +32,7 @@ public class PedestrianTrajectoryProcessor extends DataProcessor<PedestrianIdKey
for(Pedestrian ped : peds) {
PedestrianIdKey key = new PedestrianIdKey(ped.getId());
getValue(key).concat(ped.getFootSteps());
getValue(key).concat(ped.getTrajectory());
}
}
......
......@@ -288,7 +288,7 @@ public class TrajectoryReader {
if(stridesIndex != NOT_SET_COLUMN_INDEX_IDENTIFIER) {
FootStep[] footSteps = StateJsonConverter.deserializeObjectFromJson(rowTokens[stridesIndex], FootStep[].class);
for(FootStep footStep : footSteps) {
ped.getFootSteps().add(footStep);
ped.getTrajectory().add(footStep);
}
}
......
......@@ -105,8 +105,7 @@ public class Pedestrian extends Agent {
return ScenarioElementType.PEDESTRIAN;
}
// TODO Rename "getFootSteps()" to "getTrajectory()".
public VTrajectory getFootSteps() {
public VTrajectory getTrajectory() {
return trajectory;
}
......
......@@ -292,8 +292,8 @@ public class Trajectory {
// use the foot step information if available
if(agent instanceof Pedestrian) {
Pedestrian pedestrian = (Pedestrian)agent;
if(!pedestrian.getFootSteps().isEmpty()) {
Iterable<FootStep> iterable = () -> pedestrian.getFootSteps().descendingIterator();
if(!pedestrian.getTrajectory().isEmpty()) {
Iterable<FootStep> iterable = () -> pedestrian.getTrajectory().descendingIterator();
return StreamSupport.stream(iterable.spliterator(), false).map(footStep -> footStep.getEnd());
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment