Eclipse 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-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
14 // APIs for getting/setting person values via TraCI
15 /****************************************************************************/
16 
17 
18 // ===========================================================================
19 // included modules
20 // ===========================================================================
21 #include <config.h>
22 
27 #include <microsim/MSNet.h>
28 #include <microsim/MSEdge.h>
29 #include <libsumo/Person.h>
30 #include <libsumo/TraCIConstants.h>
31 #include <libsumo/VehicleType.h>
32 #include "TraCIServer.h"
34 #include "TraCIServerAPI_Person.h"
36 
37 
38 // ===========================================================================
39 // method definitions
40 // ===========================================================================
41 bool
43  tcpip::Storage& outputStorage) {
44  const int variable = inputStorage.readUnsignedByte();
45  const std::string id = inputStorage.readString();
47  try {
48  if (!libsumo::Person::handleVariable(id, variable, &server) &&
50  switch (variable) {
51  case libsumo::VAR_EDGES: {
52  int nextStageIndex = 0;
53  if (!server.readTypeCheckingInt(inputStorage, nextStageIndex)) {
54  return server.writeErrorStatusCmd(libsumo::CMD_GET_PERSON_VARIABLE, "The message must contain the stage index.", outputStorage);
55  }
57  server.getWrapperStorage().writeStringList(libsumo::Person::getEdges(id, nextStageIndex));
58  break;
59  }
60  case libsumo::VAR_STAGE: {
61  int nextStageIndex = 0;
62  if (!server.readTypeCheckingInt(inputStorage, nextStageIndex)) {
63  return server.writeErrorStatusCmd(libsumo::CMD_GET_PERSON_VARIABLE, "The message must contain the stage index.", outputStorage);
64  }
66  break;
67  }
69  std::string paramName = "";
70  if (!server.readTypeCheckingString(inputStorage, paramName)) {
71  return server.writeErrorStatusCmd(libsumo::CMD_GET_PERSON_VARIABLE, "Retrieval of a parameter requires its name.", outputStorage);
72  }
75  break;
76  }
77  default:
78  return server.writeErrorStatusCmd(libsumo::CMD_GET_PERSON_VARIABLE, "Get Person Variable: unsupported variable " + toHex(variable, 2) + " specified", outputStorage);
79  }
80  }
81  } catch (libsumo::TraCIException& e) {
82  return server.writeErrorStatusCmd(libsumo::CMD_GET_PERSON_VARIABLE, e.what(), outputStorage);
83  }
85  server.writeResponseWithLength(outputStorage, server.getWrapperStorage());
86  return true;
87 }
88 
89 
90 bool
92  tcpip::Storage& outputStorage) {
93  std::string warning = ""; // additional description for response
94  // variable
95  int variable = inputStorage.readUnsignedByte();
96  if (variable != libsumo::VAR_PARAMETER
97  && variable != libsumo::ADD
98  && variable != libsumo::APPEND_STAGE
99  && variable != libsumo::REPLACE_STAGE
100  && variable != libsumo::REMOVE_STAGE
101  && variable != libsumo::CMD_REROUTE_TRAVELTIME
102  && variable != libsumo::MOVE_TO_XY
103  && variable != libsumo::VAR_SPEED
104  && variable != libsumo::VAR_TYPE
105  && variable != libsumo::VAR_LENGTH
106  && variable != libsumo::VAR_WIDTH
107  && variable != libsumo::VAR_HEIGHT
108  && variable != libsumo::VAR_MINGAP
109  && variable != libsumo::VAR_COLOR
110  ) {
111  return server.writeErrorStatusCmd(libsumo::CMD_SET_PERSON_VARIABLE, "Change Person State: unsupported variable " + toHex(variable, 2) + " specified", outputStorage);
112  }
113 
114  try {
115  // TODO: remove declaration of c after completion
117  // id
118  std::string id = inputStorage.readString();
119  // TODO: remove declaration of p after completion
120  const bool shouldExist = variable != libsumo::ADD;
121  MSTransportable* p = c.get(id);
122  if (p == nullptr && shouldExist) {
123  return server.writeErrorStatusCmd(libsumo::CMD_SET_PERSON_VARIABLE, "Person '" + id + "' is not known", outputStorage);
124  }
125  // process
126  switch (variable) {
127  case libsumo::VAR_SPEED: {
128  double speed = 0;
129  if (!server.readTypeCheckingDouble(inputStorage, speed)) {
130  return server.writeErrorStatusCmd(libsumo::CMD_SET_PERSON_VARIABLE, "Setting speed requires a double.", outputStorage);
131  }
132  // set the speed for all (walking) stages
133  libsumo::Person::setSpeed(id, speed);
134  // modify the vType so that stages added later are also affected
135  TraCIServerAPI_VehicleType::setVariable(libsumo::CMD_SET_VEHICLE_VARIABLE, variable, p->getSingularType().getID(), server, inputStorage, outputStorage);
136  }
137  break;
138  case libsumo::VAR_TYPE: {
139  std::string vTypeID;
140  if (!server.readTypeCheckingString(inputStorage, vTypeID)) {
141  return server.writeErrorStatusCmd(libsumo::CMD_SET_PERSON_VARIABLE, "The vehicle type id must be given as a string.", outputStorage);
142  }
143  libsumo::Person::setType(id, vTypeID);
144  break;
145  }
146  case libsumo::VAR_COLOR: {
148  if (!server.readTypeCheckingColor(inputStorage, col)) {
149  return server.writeErrorStatusCmd(libsumo::CMD_SET_VEHICLE_VARIABLE, "The color must be given using the according type.", outputStorage);
150  }
151  libsumo::Person::setColor(id, col);
152  break;
153  }
154  case libsumo::ADD: {
155  if (inputStorage.readUnsignedByte() != libsumo::TYPE_COMPOUND) {
156  return server.writeErrorStatusCmd(libsumo::CMD_SET_PERSON_VARIABLE, "Adding a person requires a compound object.", outputStorage);
157  }
158  if (inputStorage.readInt() != 4) {
159  return server.writeErrorStatusCmd(libsumo::CMD_SET_PERSON_VARIABLE, "Adding a person needs four parameters.", outputStorage);
160  }
161  std::string vTypeID;
162  if (!server.readTypeCheckingString(inputStorage, vTypeID)) {
163  return server.writeErrorStatusCmd(libsumo::CMD_SET_PERSON_VARIABLE, "First parameter (type) requires a string.", outputStorage);
164  }
165  std::string edgeID;
166  if (!server.readTypeCheckingString(inputStorage, edgeID)) {
167  return server.writeErrorStatusCmd(libsumo::CMD_SET_PERSON_VARIABLE, "Second parameter (edge) requires a string.", outputStorage);
168  }
169  double depart;
170  if (!server.readTypeCheckingDouble(inputStorage, depart)) {
171  return server.writeErrorStatusCmd(libsumo::CMD_SET_PERSON_VARIABLE, "Third parameter (depart) requires a double.", outputStorage);
172  }
173  double pos;
174  if (!server.readTypeCheckingDouble(inputStorage, pos)) {
175  return server.writeErrorStatusCmd(libsumo::CMD_SET_PERSON_VARIABLE, "Fourth parameter (position) requires a double.", outputStorage);
176  }
177  libsumo::Person::add(id, edgeID, pos, depart, vTypeID);
178  }
179  break;
180  case libsumo::APPEND_STAGE: {
181  if (inputStorage.readUnsignedByte() != libsumo::TYPE_COMPOUND) {
182  return server.writeErrorStatusCmd(libsumo::CMD_SET_PERSON_VARIABLE, "Adding a person stage requires a compound object.", outputStorage);
183  }
184  int numParameters = inputStorage.readInt();
185  if (numParameters == 13) {
187  } else {
188  int stageType;
189  if (!server.readTypeCheckingInt(inputStorage, stageType)) {
190  return server.writeErrorStatusCmd(libsumo::CMD_SET_VEHICLE_VARIABLE, "The first parameter for adding a stage must be the stage type given as int.", outputStorage);
191  }
192  if (stageType == MSTransportable::DRIVING) {
193  // append driving stage
194  if (numParameters != 4) {
195  return server.writeErrorStatusCmd(libsumo::CMD_SET_PERSON_VARIABLE, "Adding a driving stage needs four parameters.", outputStorage);
196  }
197  std::string edgeID;
198  if (!server.readTypeCheckingString(inputStorage, edgeID)) {
199  return server.writeErrorStatusCmd(libsumo::CMD_SET_PERSON_VARIABLE, "Second parameter (edge) requires a string.", outputStorage);
200  }
201  std::string lines;
202  if (!server.readTypeCheckingString(inputStorage, lines)) {
203  return server.writeErrorStatusCmd(libsumo::CMD_SET_PERSON_VARIABLE, "Third parameter (lines) requires a string.", outputStorage);
204  }
205  std::string stopID;
206  if (!server.readTypeCheckingString(inputStorage, stopID)) {
207  return server.writeErrorStatusCmd(libsumo::CMD_SET_PERSON_VARIABLE, "Fourth parameter (stopID) requires a string.", outputStorage);
208  }
209  libsumo::Person::appendDrivingStage(id, edgeID, lines, stopID);
210  } else if (stageType == MSTransportable::WAITING) {
211  // append waiting stage
212  if (numParameters != 4) {
213  return server.writeErrorStatusCmd(libsumo::CMD_SET_PERSON_VARIABLE, "Adding a waiting stage needs four parameters.", outputStorage);
214  }
215  double duration;
216  if (!server.readTypeCheckingDouble(inputStorage, duration)) {
217  return server.writeErrorStatusCmd(libsumo::CMD_SET_PERSON_VARIABLE, "Second parameter (duration) requires a double.", outputStorage);
218  }
219  std::string description;
220  if (!server.readTypeCheckingString(inputStorage, description)) {
221  return server.writeErrorStatusCmd(libsumo::CMD_SET_PERSON_VARIABLE, "Third parameter (description) requires a string.", outputStorage);
222  }
223  std::string stopID;
224  if (!server.readTypeCheckingString(inputStorage, stopID)) {
225  return server.writeErrorStatusCmd(libsumo::CMD_SET_PERSON_VARIABLE, "Fourth parameter (stopID) requires a string.", outputStorage);
226  }
227  libsumo::Person::appendWaitingStage(id, duration, description, stopID);
228  } else if (stageType == MSTransportable::MOVING_WITHOUT_VEHICLE) {
229  // append walking stage
230  if (numParameters != 6) {
231  return server.writeErrorStatusCmd(libsumo::CMD_SET_PERSON_VARIABLE, "Adding a walking stage needs six parameters.", outputStorage);
232  }
233  std::vector<std::string> edgeIDs;
234  if (!server.readTypeCheckingStringList(inputStorage, edgeIDs)) {
235  return server.writeErrorStatusCmd(libsumo::CMD_SET_VEHICLE_VARIABLE, "Second parameter (edges) route must be defined as a list of edge ids.", outputStorage);
236  }
237  double arrivalPos;
238  if (!server.readTypeCheckingDouble(inputStorage, arrivalPos)) {
239  return server.writeErrorStatusCmd(libsumo::CMD_SET_PERSON_VARIABLE, "Third parameter (arrivalPos) requires a double.", outputStorage);
240  }
241  double duration;
242  if (!server.readTypeCheckingDouble(inputStorage, duration)) {
243  return server.writeErrorStatusCmd(libsumo::CMD_SET_PERSON_VARIABLE, "Fourth parameter (duration) requires a double.", outputStorage);
244  }
245  double speed;
246  if (!server.readTypeCheckingDouble(inputStorage, speed)) {
247  return server.writeErrorStatusCmd(libsumo::CMD_SET_PERSON_VARIABLE, "Fifth parameter (speed) requires a double.", outputStorage);
248  }
249  std::string stopID;
250  if (!server.readTypeCheckingString(inputStorage, stopID)) {
251  return server.writeErrorStatusCmd(libsumo::CMD_SET_PERSON_VARIABLE, "Fourth parameter (stopID) requires a string.", outputStorage);
252  }
253  libsumo::Person::appendWalkingStage(id, edgeIDs, arrivalPos, duration, speed, stopID);
254  } else {
255  return server.writeErrorStatusCmd(libsumo::CMD_SET_PERSON_VARIABLE, "Invalid stage type for person '" + id + "'", outputStorage);
256  }
257  }
258 
259  }
260  break;
261 
262  case libsumo::REPLACE_STAGE : {
263  if (inputStorage.readUnsignedByte() != libsumo::TYPE_COMPOUND) {
264  return server.writeErrorStatusCmd(libsumo::CMD_SET_PERSON_VARIABLE, "Replacing a person stage requires a compound object.", outputStorage);
265  }
266  if (inputStorage.readInt() != 2) {
267  return server.writeErrorStatusCmd(libsumo::CMD_SET_PERSON_VARIABLE, "Replacing a person stage requires a compound object of size 2.", outputStorage);
268  }
269  int nextStageIndex = 0;
270  if (!server.readTypeCheckingInt(inputStorage, nextStageIndex)) {
271  return server.writeErrorStatusCmd(libsumo::CMD_SET_PERSON_VARIABLE, "First parameter of replace stage should be an integer", outputStorage);
272  }
273  if (inputStorage.readUnsignedByte() != libsumo::TYPE_COMPOUND) {
274  return server.writeErrorStatusCmd(libsumo::CMD_SET_PERSON_VARIABLE, "Second parameter of replace stage should be a compound object", outputStorage);
275  }
276  if (inputStorage.readInt() != 13) {
277  return server.writeErrorStatusCmd(libsumo::CMD_SET_PERSON_VARIABLE, "Second parameter of replace stage should be a compound object of size 13", outputStorage);
278  }
279  libsumo::Person::replaceStage(id, nextStageIndex, *TraCIServerAPI_Simulation::readStage(server, inputStorage));
280  }
281  break;
282 
283  case libsumo::REMOVE_STAGE: {
284  int nextStageIndex = 0;
285  if (!server.readTypeCheckingInt(inputStorage, nextStageIndex)) {
286  return server.writeErrorStatusCmd(libsumo::CMD_GET_PERSON_VARIABLE, "The message must contain the stage index.", outputStorage);
287  }
288  libsumo::Person::removeStage(id, nextStageIndex);
289  }
290  break;
292  if (inputStorage.readUnsignedByte() != libsumo::TYPE_COMPOUND) {
293  return server.writeErrorStatusCmd(libsumo::CMD_SET_PERSON_VARIABLE, "Rerouting requires a compound object.", outputStorage);
294  }
295  if (inputStorage.readInt() != 0) {
296  return server.writeErrorStatusCmd(libsumo::CMD_SET_PERSON_VARIABLE, "Rerouting should obtain an empty compound object.", outputStorage);
297  }
299  }
300  break;
301  case libsumo::MOVE_TO_XY: {
302  if (inputStorage.readUnsignedByte() != libsumo::TYPE_COMPOUND) {
303  return server.writeErrorStatusCmd(libsumo::CMD_SET_PERSON_VARIABLE, "MoveToXY person requires a compound object.", outputStorage);
304  }
305  const int numArgs = inputStorage.readInt();
306  if (numArgs != 5) {
307  return server.writeErrorStatusCmd(libsumo::CMD_SET_PERSON_VARIABLE, "MoveToXY person should obtain: edgeID, x, y, angle and keepRouteFlag.", outputStorage);
308  }
309  // edge ID
310  std::string edgeID;
311  if (!server.readTypeCheckingString(inputStorage, edgeID)) {
312  return server.writeErrorStatusCmd(libsumo::CMD_SET_PERSON_VARIABLE, "The first parameter for moveToXY must be the edge ID given as a string.", outputStorage);
313  }
314  // x
315  double x = 0;
316  if (!server.readTypeCheckingDouble(inputStorage, x)) {
317  return server.writeErrorStatusCmd(libsumo::CMD_SET_PERSON_VARIABLE, "The second parameter for moveToXY must be the x-position given as a double.", outputStorage);
318  }
319  // y
320  double y = 0;
321  if (!server.readTypeCheckingDouble(inputStorage, y)) {
322  return server.writeErrorStatusCmd(libsumo::CMD_SET_PERSON_VARIABLE, "The third parameter for moveToXY must be the y-position given as a double.", outputStorage);
323  }
324  // angle
325  double angle = 0;
326  if (!server.readTypeCheckingDouble(inputStorage, angle)) {
327  return server.writeErrorStatusCmd(libsumo::CMD_SET_PERSON_VARIABLE, "The fourth parameter for moveToXY must be the angle given as a double.", outputStorage);
328  }
329  int keepRouteFlag = 1;
330  if (!server.readTypeCheckingByte(inputStorage, keepRouteFlag)) {
331  return server.writeErrorStatusCmd(libsumo::CMD_SET_PERSON_VARIABLE, "The fifth parameter for moveToXY must be the keepRouteFlag given as a byte.", outputStorage);
332  }
333  libsumo::Person::moveToXY(id, edgeID, x, y, angle, keepRouteFlag);
334  }
335  break;
336  case libsumo::VAR_PARAMETER: {
337  if (inputStorage.readUnsignedByte() != libsumo::TYPE_COMPOUND) {
338  return server.writeErrorStatusCmd(libsumo::CMD_SET_PERSON_VARIABLE, "A compound object is needed for setting a parameter.", outputStorage);
339  }
340  //read itemNo
341  inputStorage.readInt();
342  std::string name;
343  if (!server.readTypeCheckingString(inputStorage, name)) {
344  return server.writeErrorStatusCmd(libsumo::CMD_SET_PERSON_VARIABLE, "The name of the parameter must be given as a string.", outputStorage);
345  }
346  std::string value;
347  if (!server.readTypeCheckingString(inputStorage, value)) {
348  return server.writeErrorStatusCmd(libsumo::CMD_SET_PERSON_VARIABLE, "The value of the parameter must be given as a string.", outputStorage);
349  }
350  libsumo::Person::setParameter(id, name, value);
351  }
352  break;
353  default:
354  try {
355  if (!TraCIServerAPI_VehicleType::setVariable(libsumo::CMD_SET_PERSON_VARIABLE, variable, p->getSingularType().getID(), server, inputStorage, outputStorage)) {
356  return false;
357  }
358  } catch (ProcessError& e) {
359  return server.writeErrorStatusCmd(libsumo::CMD_SET_PERSON_VARIABLE, e.what(), outputStorage);
360  }
361  break;
362  }
363  } catch (libsumo::TraCIException& e) {
364  return server.writeErrorStatusCmd(libsumo::CMD_SET_PERSON_VARIABLE, e.what(), outputStorage);
365  }
366  server.writeStatusCmd(libsumo::CMD_SET_PERSON_VARIABLE, libsumo::RTYPE_OK, warning, outputStorage);
367  return true;
368 }
369 
370 
371 /****************************************************************************/
libsumo::RTYPE_OK
TRACI_CONST int RTYPE_OK
Definition: TraCIConstants.h:352
tcpip::Storage::writeUnsignedByte
virtual void writeUnsignedByte(int)
Definition: storage.cpp:160
libsumo::VAR_HEIGHT
TRACI_CONST int VAR_HEIGHT
Definition: TraCIConstants.h:772
MSVehicleType::getID
const std::string & getID() const
Returns the name of the vehicle type.
Definition: MSVehicleType.h:93
MSNet.h
libsumo::Person::setSpeed
static void setSpeed(const std::string &personID, double speed)
Definition: Person.cpp:377
libsumo::VAR_MINGAP
TRACI_CONST int VAR_MINGAP
Definition: TraCIConstants.h:663
libsumo::REPLACE_STAGE
TRACI_CONST int REPLACE_STAGE
Definition: TraCIConstants.h:994
libsumo::VAR_COLOR
TRACI_CONST int VAR_COLOR
Definition: TraCIConstants.h:630
TraCIServer::readTypeCheckingColor
bool readTypeCheckingColor(tcpip::Storage &inputStorage, libsumo::TraCIColor &into)
Reads the value type and a color, verifying the type.
Definition: TraCIServer.cpp:1444
libsumo::CMD_GET_PERSON_VARIABLE
TRACI_CONST int CMD_GET_PERSON_VARIABLE
Definition: TraCIConstants.h:297
TraCIServerAPI_Simulation.h
TraCIServer::readTypeCheckingString
bool readTypeCheckingString(tcpip::Storage &inputStorage, std::string &into)
Reads the value type and a string, verifying the type.
Definition: TraCIServer.cpp:1414
libsumo::VAR_WIDTH
TRACI_CONST int VAR_WIDTH
Definition: TraCIConstants.h:666
TraCIServer::writeResponseWithLength
void writeResponseWithLength(tcpip::Storage &outputStorage, tcpip::Storage &tempMsg)
Definition: TraCIServer.cpp:1366
libsumo::VAR_PARAMETER
TRACI_CONST int VAR_PARAMETER
Definition: TraCIConstants.h:939
libsumo::VehicleType::handleVariable
static bool handleVariable(const std::string &objID, const int variable, VariableWrapper *wrapper)
Definition: VehicleType.cpp:365
MSEdge.h
libsumo::APPEND_STAGE
TRACI_CONST int APPEND_STAGE
Definition: TraCIConstants.h:991
VehicleType.h
libsumo::TraCIColor
A color.
Definition: TraCIDefs.h:135
MSTransportable
Definition: MSTransportable.h:58
libsumo::Person::getEdges
static std::vector< std::string > getEdges(const std::string &personID, int nextStageIndex=0)
Definition: Person.cpp:153
libsumo::Person::appendWalkingStage
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:591
TraCIServer::getWrapperStorage
tcpip::Storage & getWrapperStorage()
Definition: TraCIServer.cpp:174
TraCIServerAPI_VehicleType.h
TraCIServerAPI_Simulation::writeStage
static void writeStage(tcpip::Storage &outputStorage, const libsumo::TraCIStage &stage)
Definition: TraCIServerAPI_Simulation.cpp:363
libsumo::CMD_SET_VEHICLE_VARIABLE
TRACI_CONST int CMD_SET_VEHICLE_VARIABLE
Definition: TraCIConstants.h:153
libsumo::ADD
TRACI_CONST int ADD
Definition: TraCIConstants.h:943
TraCIServer::readTypeCheckingDouble
bool readTypeCheckingDouble(tcpip::Storage &inputStorage, double &into)
Reads the value type and a double, verifying the type.
Definition: TraCIServer.cpp:1404
TraCIServerAPI_Simulation::readStage
static libsumo::TraCIStage * readStage(TraCIServer &server, tcpip::Storage &inputStorage)
Definition: TraCIServerAPI_Simulation.cpp:395
MSTransportableControl
Definition: MSTransportableControl.h:51
TraCIServer::writeStatusCmd
void writeStatusCmd(int commandId, int status, const std::string &description, tcpip::Storage &outputStorage)
Writes a status command to the given storage.
Definition: TraCIServer.cpp:968
TraCIServerAPI_VehicleType::setVariable
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.
Definition: TraCIServerAPI_VehicleType.cpp:120
MSTransportableControl::get
MSTransportable * get(const std::string &id) const
Returns the named transportable, if existing.
Definition: MSTransportableControl.cpp:75
TraCIServer::initWrapper
void initWrapper(const int domainID, const int variable, const std::string &objID)
Definition: TraCIServer.cpp:102
Person.h
tcpip::Storage::writeString
virtual void writeString(const std::string &s)
Definition: storage.cpp:192
tcpip::Storage::readUnsignedByte
virtual int readUnsignedByte()
Definition: storage.cpp:150
TraCIConstants.h
TraCIServer::readTypeCheckingByte
bool readTypeCheckingByte(tcpip::Storage &inputStorage, int &into)
Reads the value type and a byte, verifying the type.
Definition: TraCIServer.cpp:1469
MSTransportable::WAITING
@ WAITING
Definition: MSTransportable.h:62
MSTransportableControl.h
tcpip::Storage::writeStringList
virtual void writeStringList(const std::vector< std::string > &s)
Definition: storage.cpp:242
libsumo::Person::handleVariable
static bool handleVariable(const std::string &objID, const int variable, VariableWrapper *wrapper)
Definition: Person.cpp:987
ProcessError
Definition: UtilExceptions.h:39
toHex
std::string toHex(const T i, std::streamsize numDigits=0)
Definition: ToString.h:57
libsumo::CMD_SET_PERSON_VARIABLE
TRACI_CONST int CMD_SET_PERSON_VARIABLE
Definition: TraCIConstants.h:301
MSTransportable::DRIVING
@ DRIVING
Definition: MSTransportable.h:64
TraCIServer::readTypeCheckingStringList
bool readTypeCheckingStringList(tcpip::Storage &inputStorage, std::vector< std::string > &into)
Reads the value type and a string list, verifying the type.
Definition: TraCIServer.cpp:1424
libsumo::Person::moveToXY
static void moveToXY(const std::string &personID, const std::string &edgeID, const double x, const double y, double angle=INVALID_DOUBLE_VALUE, const int keepRoute=1)
Definition: Person.cpp:713
libsumo::Person::getStage
static TraCIStage getStage(const std::string &personID, int nextStageIndex=0)
Definition: Person.cpp:172
libsumo::VAR_LENGTH
TRACI_CONST int VAR_LENGTH
Definition: TraCIConstants.h:627
libsumo::TraCIException
Definition: TraCIDefs.h:89
TraCIServerAPI_Person::processSet
static bool processSet(TraCIServer &server, tcpip::Storage &inputStorage, tcpip::Storage &outputStorage)
Processes a set value command (Command 0xce: Change Person State)
Definition: TraCIServerAPI_Person.cpp:91
libsumo::TYPE_STRINGLIST
TRACI_CONST int TYPE_STRINGLIST
Definition: TraCIConstants.h:339
MSPerson.h
libsumo::VAR_EDGES
TRACI_CONST int VAR_EDGES
Definition: TraCIConstants.h:687
libsumo::Person::getTypeID
static std::string getTypeID(const std::string &personID)
Definition: Person.cpp:135
libsumo::VAR_TYPE
TRACI_CONST int VAR_TYPE
Definition: TraCIConstants.h:672
libsumo::Person::add
static LIBSUMO_VEHICLE_TYPE_GETTER 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:393
TraCIServer::readTypeCheckingInt
bool readTypeCheckingInt(tcpip::Storage &inputStorage, int &into)
Reads the value type and an int, verifying the type.
Definition: TraCIServer.cpp:1394
MSNet::getInstance
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
Definition: MSNet.cpp:167
MSNet::getPersonControl
virtual MSTransportableControl & getPersonControl()
Returns the person control.
Definition: MSNet.cpp:810
libsumo::RESPONSE_GET_PERSON_VARIABLE
TRACI_CONST int RESPONSE_GET_PERSON_VARIABLE
Definition: TraCIConstants.h:299
libsumo::Person::setType
static void setType(const std::string &personID, const std::string &typeID)
Definition: Person.cpp:383
libsumo::TYPE_STRING
TRACI_CONST int TYPE_STRING
Definition: TraCIConstants.h:337
libsumo::Person::removeStage
static void removeStage(const std::string &personID, int nextStageIndex)
Definition: Person.cpp:623
libsumo::Person::appendStage
static void appendStage(const TraCIStage &stage, const std::string &personID)
Definition: Person.cpp:532
libsumo::Person::rerouteTraveltime
static void rerouteTraveltime(const std::string &personID)
Definition: Person.cpp:636
TraCIServer.h
libsumo::Person::replaceStage
static void replaceStage(const std::string &personID, const int stageIndex, const TraCIStage &stage)
Definition: Person.cpp:539
libsumo::MOVE_TO_XY
TRACI_CONST int MOVE_TO_XY
Definition: TraCIConstants.h:747
config.h
TraCIServerAPI_Person.h
MSTransportable::MOVING_WITHOUT_VEHICLE
@ MOVING_WITHOUT_VEHICLE
Definition: MSTransportable.h:63
tcpip::Storage::readString
virtual std::string readString()
Definition: storage.cpp:175
StringTokenizer.h
libsumo::VAR_SPEED
TRACI_CONST int VAR_SPEED
Definition: TraCIConstants.h:609
TraCIServer
TraCI server used to control sumo by a remote TraCI client.
Definition: TraCIServer.h:61
TraCIServerAPI_Person::processGet
static bool processGet(TraCIServer &server, tcpip::Storage &inputStorage, tcpip::Storage &outputStorage)
Processes a get value command (Command 0xae: Get Person Variable)
Definition: TraCIServerAPI_Person.cpp:42
libsumo::Person::appendWaitingStage
static void appendWaitingStage(const std::string &personID, double duration, const std::string &description="waiting", const std::string &stopID="")
Definition: Person.cpp:574
MSVehicleControl.h
libsumo::REMOVE_STAGE
TRACI_CONST int REMOVE_STAGE
Definition: TraCIConstants.h:997
libsumo::Person::setParameter
static void setParameter(const std::string &personID, const std::string &key, const std::string &value)
Definition: Person.cpp:833
tcpip::Storage
Definition: storage.h:38
libsumo::Person::appendDrivingStage
static void appendDrivingStage(const std::string &personID, const std::string &toEdge, const std::string &lines, const std::string &stopID="")
Definition: Person.cpp:553
libsumo::VAR_STAGE
TRACI_CONST int VAR_STAGE
Definition: TraCIConstants.h:979
libsumo::CMD_REROUTE_TRAVELTIME
TRACI_CONST int CMD_REROUTE_TRAVELTIME
Definition: TraCIConstants.h:970
tcpip::Storage::readInt
virtual int readInt()
Definition: storage.cpp:306
libsumo::Person::getParameter
static std::string getParameter(const std::string &routeID, const std::string &param)
Definition: Person.cpp:248
MSTransportable::getSingularType
MSVehicleType & getSingularType()
Replaces the current vehicle type with a new one used by this vehicle only.
Definition: MSTransportable.cpp:804
libsumo::TYPE_COMPOUND
TRACI_CONST int TYPE_COMPOUND
Definition: TraCIConstants.h:341
TraCIServer::writeErrorStatusCmd
bool writeErrorStatusCmd(int commandId, const std::string &description, tcpip::Storage &outputStorage)
Writes a status command to the given storage with status = RTYPE_ERR.
Definition: TraCIServer.cpp:982