SUMO - Simulation of Urban MObility
TraCIServerAPI_Person.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2017 German Aerospace Center (DLR) and others.
4 /****************************************************************************/
5 //
6 // This program and the accompanying materials
7 // are made available under the terms of the Eclipse Public License v2.0
8 // which accompanies this distribution, and is available at
9 // http://www.eclipse.org/legal/epl-v20.html
10 //
11 /****************************************************************************/
17 // APIs for getting/setting person values via TraCI
18 /****************************************************************************/
19 
20 
21 // ===========================================================================
22 // included modules
23 // ===========================================================================
24 #ifdef _MSC_VER
25 #include <windows_config.h>
26 #else
27 #include <config.h>
28 #endif
29 
30 #ifndef NO_TRACI
31 
36 #include <microsim/MSNet.h>
37 #include <microsim/MSEdge.h>
38 #include "TraCIConstants.h"
39 #include "TraCIServer.h"
40 #include "TraCIServerAPI_Person.h"
41 #include <libsumo/Person.h>
43 
44 
45 // ===========================================================================
46 // method definitions
47 // ===========================================================================
48 bool
50  tcpip::Storage& outputStorage) {
51  // variable
52  int variable = inputStorage.readUnsignedByte();
53  std::string id = inputStorage.readString();
54  // check variable
55  if (variable != ID_LIST && variable != ID_COUNT
56  && variable != VAR_POSITION && variable != VAR_POSITION3D && variable != VAR_ANGLE && variable != VAR_SPEED
57  && variable != VAR_ROAD_ID && variable != VAR_LANEPOSITION
58  && variable != VAR_WIDTH && variable != VAR_LENGTH && variable != VAR_MINGAP
59  && variable != VAR_TYPE && variable != VAR_SHAPECLASS && variable != VAR_COLOR
60  && variable != VAR_WAITING_TIME && variable != VAR_PARAMETER
61  && variable != VAR_NEXT_EDGE
62  && variable != VAR_EDGES
63  && variable != VAR_STAGE
64  && variable != VAR_STAGES_REMAINING
65  && variable != VAR_VEHICLE
66  ) {
67  return server.writeErrorStatusCmd(CMD_GET_PERSON_VARIABLE, "Get Person Variable: unsupported variable " + toHex(variable, 2) + " specified", outputStorage);
68  }
69  // begin response building
70  tcpip::Storage tempMsg;
71  // response-code, variableID, objectID
73  tempMsg.writeUnsignedByte(variable);
74  tempMsg.writeString(id);
75 
76  try {
77  if (variable == ID_LIST || variable == ID_COUNT) {
78  if (variable == ID_LIST) {
81  } else {
84  }
85  } else {
86  switch (variable) {
87  case VAR_POSITION: {
90  tempMsg.writeDouble(pos.x);
91  tempMsg.writeDouble(pos.y);
92  }
93  break;
94  case VAR_POSITION3D: {
97  tempMsg.writeDouble(pos.x);
98  tempMsg.writeDouble(pos.y);
99  tempMsg.writeDouble(pos.z);
100  }
101  break;
102  case VAR_ANGLE:
105  break;
106  case VAR_SPEED:
109  break;
110  case VAR_ROAD_ID:
113  break;
114  case VAR_LANEPOSITION:
117  break;
118  case VAR_COLOR: {
120  tempMsg.writeUnsignedByte(TYPE_COLOR);
121  tempMsg.writeUnsignedByte(col.r);
122  tempMsg.writeUnsignedByte(col.g);
123  tempMsg.writeUnsignedByte(col.b);
124  tempMsg.writeUnsignedByte(col.a);
125  }
126  break;
127  case VAR_WAITING_TIME:
130  break;
131  case VAR_TYPE:
134  break;
135  case VAR_NEXT_EDGE:
138  break;
139  case VAR_EDGES: {
140  int nextStageIndex = 0;
141  if (!server.readTypeCheckingInt(inputStorage, nextStageIndex)) {
142  return server.writeErrorStatusCmd(CMD_GET_PERSON_VARIABLE, "The message must contain the stage index.", outputStorage);
143  }
145  tempMsg.writeStringList(libsumo::Person::getEdges(id, nextStageIndex));
146  break;
147  }
148  case VAR_STAGE: {
149  int nextStageIndex = 0;
150  if (!server.readTypeCheckingInt(inputStorage, nextStageIndex)) {
151  return server.writeErrorStatusCmd(CMD_GET_PERSON_VARIABLE, "The message must contain the stage index.", outputStorage);
152  }
154  tempMsg.writeInt(libsumo::Person::getStage(id, nextStageIndex));
155  break;
156  }
160  break;
161  case VAR_VEHICLE: {
164  break;
165  }
166  case VAR_PARAMETER: {
167  std::string paramName = "";
168  if (!server.readTypeCheckingString(inputStorage, paramName)) {
169  return server.writeErrorStatusCmd(CMD_GET_PERSON_VARIABLE, "Retrieval of a parameter requires its name.", outputStorage);
170  }
172  tempMsg.writeString(libsumo::Person::getParameter(id, paramName));
173  break;
174  }
175  default:
177  break;
178  }
179  }
180  } catch (libsumo::TraCIException& e) {
181  return server.writeErrorStatusCmd(CMD_GET_PERSON_VARIABLE, e.what(), outputStorage);
182  }
183  server.writeStatusCmd(CMD_GET_PERSON_VARIABLE, RTYPE_OK, "", outputStorage);
184  server.writeResponseWithLength(outputStorage, tempMsg);
185  return true;
186 }
187 
188 
189 bool
191  tcpip::Storage& outputStorage) {
192  std::string warning = ""; // additional description for response
193  // variable
194  int variable = inputStorage.readUnsignedByte();
195  if (variable != VAR_PARAMETER
196  && variable != ADD
197  && variable != APPEND_STAGE
198  && variable != REMOVE_STAGE
199  && variable != CMD_REROUTE_TRAVELTIME
200  && variable != MOVE_TO_XY
201  && variable != VAR_SPEED
202  && variable != VAR_TYPE
203  && variable != VAR_LENGTH
204  && variable != VAR_WIDTH
205  && variable != VAR_HEIGHT
206  && variable != VAR_MINGAP
207  && variable != VAR_COLOR
208  ) {
209  return server.writeErrorStatusCmd(CMD_SET_PERSON_VARIABLE, "Change Person State: unsupported variable " + toHex(variable, 2) + " specified", outputStorage);
210  }
211 
212  try {
213  // TODO: remove declaration of c after completion
215  // id
216  std::string id = inputStorage.readString();
217  // TODO: remove declaration of p after completion
218  const bool shouldExist = variable != ADD;
219  MSTransportable* p = c.get(id);
220  if (p == 0 && shouldExist) {
221  return server.writeErrorStatusCmd(CMD_SET_PERSON_VARIABLE, "Person '" + id + "' is not known", outputStorage);
222  }
223  // process
224  switch (variable) {
225  case VAR_SPEED: {
226  double speed = 0;
227  if (!server.readTypeCheckingDouble(inputStorage, speed)) {
228  return server.writeErrorStatusCmd(CMD_SET_PERSON_VARIABLE, "Setting speed requires a double.", outputStorage);
229  }
230  // set the speed for all (walking) stages
231  libsumo::Person::setSpeed(id, speed);
232  // modify the vType so that stages added later are also affected
234  }
235  break;
236  case VAR_TYPE: {
237  std::string vTypeID;
238  if (!server.readTypeCheckingString(inputStorage, vTypeID)) {
239  return server.writeErrorStatusCmd(CMD_SET_PERSON_VARIABLE, "The vehicle type id must be given as a string.", outputStorage);
240  }
241  libsumo::Person::setType(id, vTypeID);
242  break;
243  }
244  case ADD: {
245  if (inputStorage.readUnsignedByte() != TYPE_COMPOUND) {
246  return server.writeErrorStatusCmd(CMD_SET_PERSON_VARIABLE, "Adding a person requires a compound object.", outputStorage);
247  }
248  if (inputStorage.readInt() != 4) {
249  return server.writeErrorStatusCmd(CMD_SET_PERSON_VARIABLE, "Adding a person needs four parameters.", outputStorage);
250  }
251  std::string vTypeID;
252  if (!server.readTypeCheckingString(inputStorage, vTypeID)) {
253  return server.writeErrorStatusCmd(CMD_SET_PERSON_VARIABLE, "First parameter (type) requires a string.", outputStorage);
254  }
255  std::string edgeID;
256  if (!server.readTypeCheckingString(inputStorage, edgeID)) {
257  return server.writeErrorStatusCmd(CMD_SET_PERSON_VARIABLE, "Second parameter (edge) requires a string.", outputStorage);
258  }
259  int depart;
260  if (!server.readTypeCheckingInt(inputStorage, depart)) {
261  return server.writeErrorStatusCmd(CMD_SET_PERSON_VARIABLE, "Third parameter (depart) requires an integer.", outputStorage);
262  }
263  double pos;
264  if (!server.readTypeCheckingDouble(inputStorage, pos)) {
265  return server.writeErrorStatusCmd(CMD_SET_PERSON_VARIABLE, "Fourth parameter (position) requires a double.", outputStorage);
266  }
267  libsumo::Person::add(id, edgeID, pos, STEPS2TIME(depart), vTypeID);
268  }
269  break;
270  case APPEND_STAGE: {
271  if (inputStorage.readUnsignedByte() != TYPE_COMPOUND) {
272  return server.writeErrorStatusCmd(CMD_SET_PERSON_VARIABLE, "Adding a person stage requires a compound object.", outputStorage);
273  }
274  int numParameters = inputStorage.readInt();
275  int stageType;
276  if (!server.readTypeCheckingInt(inputStorage, stageType)) {
277  return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "The first parameter for adding a stage must be the stage type given as int.", outputStorage);
278  }
279  if (stageType == MSTransportable::DRIVING) {
280  // append driving stage
281  if (numParameters != 4) {
282  return server.writeErrorStatusCmd(CMD_SET_PERSON_VARIABLE, "Adding a driving stage needs four parameters.", outputStorage);
283  }
284  std::string edgeID;
285  if (!server.readTypeCheckingString(inputStorage, edgeID)) {
286  return server.writeErrorStatusCmd(CMD_SET_PERSON_VARIABLE, "Second parameter (edge) requires a string.", outputStorage);
287  }
288  std::string lines;
289  if (!server.readTypeCheckingString(inputStorage, lines)) {
290  return server.writeErrorStatusCmd(CMD_SET_PERSON_VARIABLE, "Third parameter (lines) requires a string.", outputStorage);
291  }
292  std::string stopID;
293  if (!server.readTypeCheckingString(inputStorage, stopID)) {
294  return server.writeErrorStatusCmd(CMD_SET_PERSON_VARIABLE, "Fourth parameter (stopID) requires a string.", outputStorage);
295  }
296  libsumo::Person::appendDrivingStage(id, edgeID, lines, stopID);
297  } else if (stageType == MSTransportable::WAITING) {
298  // append waiting stage
299  if (numParameters != 4) {
300  return server.writeErrorStatusCmd(CMD_SET_PERSON_VARIABLE, "Adding a waiting stage needs four parameters.", outputStorage);
301  }
302  int duration;
303  if (!server.readTypeCheckingInt(inputStorage, duration)) {
304  return server.writeErrorStatusCmd(CMD_SET_PERSON_VARIABLE, "Second parameter (duration) requires an int.", outputStorage);
305  }
306  std::string description;
307  if (!server.readTypeCheckingString(inputStorage, description)) {
308  return server.writeErrorStatusCmd(CMD_SET_PERSON_VARIABLE, "Third parameter (description) requires a string.", outputStorage);
309  }
310  std::string stopID;
311  if (!server.readTypeCheckingString(inputStorage, stopID)) {
312  return server.writeErrorStatusCmd(CMD_SET_PERSON_VARIABLE, "Fourth parameter (stopID) requires a string.", outputStorage);
313  }
314  libsumo::Person::appendWaitingStage(id, STEPS2TIME(duration), description, stopID);
315  } else if (stageType == MSTransportable::MOVING_WITHOUT_VEHICLE) {
316  // append walking stage
317  if (numParameters != 6) {
318  return server.writeErrorStatusCmd(CMD_SET_PERSON_VARIABLE, "Adding a walking stage needs six parameters.", outputStorage);
319  }
320  std::vector<std::string> edgeIDs;
321  if (!server.readTypeCheckingStringList(inputStorage, edgeIDs)) {
322  return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Second parameter (edges) route must be defined as a list of edge ids.", outputStorage);
323  }
324  double arrivalPos;
325  if (!server.readTypeCheckingDouble(inputStorage, arrivalPos)) {
326  return server.writeErrorStatusCmd(CMD_SET_PERSON_VARIABLE, "Third parameter (arrivalPos) requires a double.", outputStorage);
327  }
328  int duration;
329  if (!server.readTypeCheckingInt(inputStorage, duration)) {
330  return server.writeErrorStatusCmd(CMD_SET_PERSON_VARIABLE, "Fourth parameter (duration) requires an int.", outputStorage);
331  }
332  double speed;
333  if (!server.readTypeCheckingDouble(inputStorage, speed)) {
334  return server.writeErrorStatusCmd(CMD_SET_PERSON_VARIABLE, "Fifth parameter (speed) requires a double.", outputStorage);
335  }
336  std::string stopID;
337  if (!server.readTypeCheckingString(inputStorage, stopID)) {
338  return server.writeErrorStatusCmd(CMD_SET_PERSON_VARIABLE, "Fourth parameter (stopID) requires a string.", outputStorage);
339  }
340  libsumo::Person::appendWalkingStage(id, edgeIDs, arrivalPos, STEPS2TIME(duration), speed, stopID);
341  } else {
342  return server.writeErrorStatusCmd(CMD_SET_PERSON_VARIABLE, "Invalid stage type for person '" + id + "'", outputStorage);
343  }
344  }
345  break;
346  case REMOVE_STAGE: {
347  int nextStageIndex = 0;
348  if (!server.readTypeCheckingInt(inputStorage, nextStageIndex)) {
349  return server.writeErrorStatusCmd(CMD_GET_PERSON_VARIABLE, "The message must contain the stage index.", outputStorage);
350  }
351  libsumo::Person::removeStage(id, nextStageIndex);
352  }
353  break;
354  case CMD_REROUTE_TRAVELTIME: {
355  if (inputStorage.readUnsignedByte() != TYPE_COMPOUND) {
356  return server.writeErrorStatusCmd(CMD_SET_PERSON_VARIABLE, "Rerouting requires a compound object.", outputStorage);
357  }
358  if (inputStorage.readInt() != 0) {
359  return server.writeErrorStatusCmd(CMD_SET_PERSON_VARIABLE, "Rerouting should obtain an empty compound object.", outputStorage);
360  }
362  }
363  break;
364  case MOVE_TO_XY: {
365  if (inputStorage.readUnsignedByte() != TYPE_COMPOUND) {
366  return server.writeErrorStatusCmd(CMD_SET_PERSON_VARIABLE, "MoveToXY person requires a compound object.", outputStorage);
367  }
368  const int numArgs = inputStorage.readInt();
369  if (numArgs != 5) {
370  return server.writeErrorStatusCmd(CMD_SET_PERSON_VARIABLE, "MoveToXY person should obtain: edgeID, x, y, angle and keepRouteFlag.", outputStorage);
371  }
372  // edge ID
373  std::string edgeID;
374  if (!server.readTypeCheckingString(inputStorage, edgeID)) {
375  return server.writeErrorStatusCmd(CMD_SET_PERSON_VARIABLE, "The first parameter for moveToXY must be the edge ID given as a string.", outputStorage);
376  }
377  // x
378  double x = 0;
379  if (!server.readTypeCheckingDouble(inputStorage, x)) {
380  return server.writeErrorStatusCmd(CMD_SET_PERSON_VARIABLE, "The second parameter for moveToXY must be the x-position given as a double.", outputStorage);
381  }
382  // y
383  double y = 0;
384  if (!server.readTypeCheckingDouble(inputStorage, y)) {
385  return server.writeErrorStatusCmd(CMD_SET_PERSON_VARIABLE, "The third parameter for moveToXY must be the y-position given as a double.", outputStorage);
386  }
387  // angle
388  double angle = 0;
389  if (!server.readTypeCheckingDouble(inputStorage, angle)) {
390  return server.writeErrorStatusCmd(CMD_SET_PERSON_VARIABLE, "The fourth parameter for moveToXY must be the angle given as a double.", outputStorage);
391  }
392  int keepRouteFlag = 1;
393  if (!server.readTypeCheckingByte(inputStorage, keepRouteFlag)) {
394  return server.writeErrorStatusCmd(CMD_SET_PERSON_VARIABLE, "The fifth parameter for moveToXY must be the keepRouteFlag given as a byte.", outputStorage);
395  }
396  libsumo::Person::moveToXY(id, edgeID, x, y, angle, keepRouteFlag);
397  }
398  break;
399  case VAR_PARAMETER: {
400  if (inputStorage.readUnsignedByte() != TYPE_COMPOUND) {
401  return server.writeErrorStatusCmd(CMD_SET_PERSON_VARIABLE, "A compound object is needed for setting a parameter.", outputStorage);
402  }
403  //read itemNo
404  inputStorage.readInt();
405  std::string name;
406  if (!server.readTypeCheckingString(inputStorage, name)) {
407  return server.writeErrorStatusCmd(CMD_SET_PERSON_VARIABLE, "The name of the parameter must be given as a string.", outputStorage);
408  }
409  std::string value;
410  if (!server.readTypeCheckingString(inputStorage, value)) {
411  return server.writeErrorStatusCmd(CMD_SET_PERSON_VARIABLE, "The value of the parameter must be given as a string.", outputStorage);
412  }
413  libsumo::Person::setParameter(id, name, value);
414  }
415  break;
416  default:
417  try {
418  if (!TraCIServerAPI_VehicleType::setVariable(CMD_SET_PERSON_VARIABLE, variable, libsumo::Person::getSingularVType(id), server, inputStorage, outputStorage)) {
419  return false;
420  }
421  } catch (ProcessError& e) {
422  return server.writeErrorStatusCmd(CMD_SET_PERSON_VARIABLE, e.what(), outputStorage);
423  }
424  break;
425  }
426  } catch (libsumo::TraCIException& e) {
427  return server.writeErrorStatusCmd(CMD_SET_PERSON_VARIABLE, e.what(), outputStorage);
428  }
429  server.writeStatusCmd(CMD_SET_PERSON_VARIABLE, RTYPE_OK, warning, outputStorage);
430  return true;
431 }
432 
433 
434 bool
435 TraCIServerAPI_Person::getPosition(const std::string& id, Position& p) {
436  MSPerson* person = dynamic_cast<MSPerson*>(MSNet::getInstance()->getPersonControl().get(id));
437  if (person == 0) {
438  return false;
439  }
440  p = person->getPosition();
441  return true;
442 }
443 
444 
445 #endif
446 
447 
448 /****************************************************************************/
449 
#define VAR_ROAD_ID
unsigned char g
Definition: TraCIDefs.h:79
static std::string getNextEdge(const std::string &personID)
Definition: Person.cpp:128
#define VAR_LENGTH
#define TYPE_COMPOUND
#define POSITION_2D
#define VAR_POSITION
#define RTYPE_OK
#define VAR_HEIGHT
#define VAR_WAITING_TIME
#define CMD_GET_PERSON_VARIABLE
#define VAR_TYPE
static void setType(const std::string &personID, const std::string &typeID)
Definition: Person.cpp:195
#define VAR_VEHICLE
static int getIDCount()
Definition: Person.cpp:63
#define VAR_COLOR
bool readTypeCheckingInt(tcpip::Storage &inputStorage, int &into)
Reads the value type and an int, verifying the type.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
Definition: MSNet.cpp:167
static void moveToXY(const std::string &personID, const std::string &edgeID, const double x, const double y, double angle, const int keepRouteFlag)
Definition: Person.cpp:411
static std::string getSingularVType(const std::string &personID)
Definition: Person.cpp:574
#define APPEND_STAGE
bool readTypeCheckingString(tcpip::Storage &inputStorage, std::string &into)
Reads the value type and a string, verifying the type.
#define TYPE_COLOR
#define TYPE_STRINGLIST
static std::vector< std::string > getIDList()
Definition: Person.cpp:50
bool readTypeCheckingDouble(tcpip::Storage &inputStorage, double &into)
Reads the value type and a double, verifying the type.
#define POSITION_3D
static std::string getTypeID(const std::string &personID)
Definition: Person.cpp:116
#define VAR_STAGE
virtual void writeUnsignedByte(int)
bool writeErrorStatusCmd(int commandId, const std::string &description, tcpip::Storage &outputStorage)
Writes a status command to the given storage with status = RTYPE_ERR.
static bool getVariable(const int variable, const std::string &v, tcpip::Storage &tempMsg)
Processes a value request for the given type.
static double getLanePosition(const std::string &personID)
Definition: Person.cpp:98
#define VAR_NEXT_EDGE
#define REMOVE_STAGE
virtual void writeInt(int)
#define VAR_POSITION3D
static void appendDrivingStage(const std::string &personID, const std::string &toEdge, const std::string &lines, const std::string &stopID="")
Definition: Person.cpp:271
#define TYPE_STRING
virtual int readUnsignedByte()
static int getRemainingStages(const std::string &personID)
Definition: Person.cpp:164
static std::string getVehicle(const std::string &personID)
Definition: Person.cpp:170
static bool getPosition(const std::string &id, Position &p)
Returns the named persons&#39;s position.
#define VAR_ANGLE
unsigned char b
Definition: TraCIDefs.h:79
#define VAR_SHAPECLASS
static TraCIPosition getPosition(const std::string &personID)
Definition: Person.cpp:69
#define MOVE_TO_XY
static bool processSet(TraCIServer &server, tcpip::Storage &inputStorage, tcpip::Storage &outputStorage)
Processes a set value command (Command 0xce: Change Person State)
static void add(const std::string &personID, const std::string &edgeID, double pos, double depart=DEPARTFLAG_NOW, const std::string typeID="DEFAULT_PEDTYPE")
Definition: Person.cpp:205
virtual int readInt()
virtual MSTransportableControl & getPersonControl()
Returns the person control.
Definition: MSNet.cpp:768
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:45
#define VAR_LANEPOSITION
bool readTypeCheckingStringList(tcpip::Storage &inputStorage, std::vector< std::string > &into)
Reads the value type and a string list, verifying the type.
unsigned char a
Definition: TraCIDefs.h:79
virtual void writeStringList(const std::vector< std::string > &s)
#define STEPS2TIME(x)
Definition: SUMOTime.h:64
#define CMD_SET_VEHICLE_VARIABLE
virtual std::string readString()
#define VAR_EDGES
unsigned char r
Definition: TraCIDefs.h:79
static void setParameter(const std::string &personID, const std::string &key, const std::string &value)
Definition: Person.cpp:529
#define ADD
TraCI server used to control sumo by a remote TraCI client.
Definition: TraCIServer.h:69
static bool processGet(TraCIServer &server, tcpip::Storage &inputStorage, tcpip::Storage &outputStorage)
Processes a get value command (Command 0xae: Get Person Variable)
static std::string getParameter(const std::string &routeID, const std::string &param)
Definition: Person.cpp:181
static void setSpeed(const std::string &personID, double speed)
Definition: Person.cpp:189
#define VAR_SPEED
void writeResponseWithLength(tcpip::Storage &outputStorage, tcpip::Storage &tempMsg)
static TraCIColor getColor(const std::string &personID)
Definition: Person.cpp:104
static std::string getRoadID(const std::string &personID)
Definition: Person.cpp:92
static bool setVariable(const int cmd, const int variable, const std::string &id, TraCIServer &server, tcpip::Storage &inputStorage, tcpip::Storage &outputStorage)
Processes a set value for the given type.
virtual void writeString(const std::string &s)
static void removeStage(const std::string &personID, int nextStageIndex)
Definition: Person.cpp:341
#define TYPE_DOUBLE
std::string toHex(const T i, std::streamsize numDigits=0)
Definition: ToString.h:65
static double getWaitingTime(const std::string &personID)
Definition: Person.cpp:122
virtual Position getPosition() const
Return the Network coordinate of the transportable.
#define CMD_REROUTE_TRAVELTIME
#define RESPONSE_GET_PERSON_VARIABLE
virtual void writeDouble(double)
static int getStage(const std::string &personID, int nextStageIndex=0)
Definition: Person.cpp:151
static void appendWaitingStage(const std::string &personID, double duration, const std::string &description="waiting", const std::string &stopID="")
Definition: Person.cpp:292
MSTransportable * get(const std::string &id) const
Returns the named transportable, if existing.
static std::vector< std::string > getEdges(const std::string &personID, int nextStageIndex=0)
Definition: Person.cpp:134
void writeStatusCmd(int commandId, int status, const std::string &description, tcpip::Storage &outputStorage)
Writes a status command to the given storage.
#define CMD_SET_PERSON_VARIABLE
static void appendWalkingStage(const std::string &personID, const std::vector< std::string > &edgeIDs, double arrivalPos, double duration=-1, double speed=-1, const std::string &stopID="")
Definition: Person.cpp:309
#define VAR_PARAMETER
#define ID_COUNT
static double getSpeed(const std::string &personID)
Definition: Person.cpp:86
A 3D-position.
Definition: TraCIDefs.h:71
static void rerouteTraveltime(const std::string &personID)
Definition: Person.cpp:354
#define TYPE_INTEGER
#define VAR_MINGAP
#define ID_LIST
#define VAR_STAGES_REMAINING
bool readTypeCheckingByte(tcpip::Storage &inputStorage, int &into)
Reads the value type and a byte, verifying the type.
static double getAngle(const std::string &personID)
Definition: Person.cpp:80
#define VAR_WIDTH