Commit eccf9c7a authored by Hengwen Zhang's avatar Hengwen Zhang
Browse files

Add a field in VehicleProperties that stores vehicle's latest global coordinates

parent 72b93704
......@@ -7,6 +7,7 @@ import java.util.Vector;
import de.rwth.montisim.commons.eventsimulation.DiscreteEventSimulator;
import de.rwth.montisim.commons.utils.Coordinates;
import de.rwth.montisim.commons.utils.Geometry;
import de.rwth.montisim.commons.utils.Vec2;
import de.rwth.montisim.commons.utils.json.JsonEntry;
......@@ -49,6 +50,7 @@ public class VehicleProperties /* implements JsonSerializable */ {
public Vec2 end_coords;
public Task task;
public Coordinates coordinates; // keep track of vehicle's global coordinates
  • If this is state related it should be in Vehicle directly. (If the user should not need to set this as a configuration entry).

  • If I put this field in vehicle, then the Vehicle::stateToJson() would need to be updated accordingly? So that the coordinates can be read from the serialized vehicle.

  • stateToJson() doesn't need to be updated. The function also serializes all the non-transient fields of the Vehicle itself with the Json.toJson(w, this, null); call (here)

  • After a second thought, I think it would be more appropriate to manage this global coordinate on the server side, since this field is only needed by server, when a vehicle gets transferred between different simulators. So I will remove this field for now, keeping the vehicle as it is.

Please register or sign in to reply
public VehicleProperties(){
body = new BodyProperties();
......@@ -188,4 +190,11 @@ public class VehicleProperties /* implements JsonSerializable */ {
return target;
public Coordinates getCoordinates() {
return coordinates;
public void setCoordinates(Coordinates coordinates) {
this.coordinates = coordinates;
\ No newline at end of file
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