78 std::vector<std::string> ids;
81 ids.push_back(i->first);
141 tempMsg.
writeString(dynamic_cast<MSPerson*>(p)->getNextEdge());
144 int nextStageIndex = 0;
156 tempMsg.
writeInt((
int)edges.size());
157 for (ConstMSEdgeVector::const_iterator i = edges.begin(); i != edges.end(); ++i) {
163 int nextStageIndex = 0;
188 std::string paramName =
"";
209 std::string warning =
"";
230 const bool shouldExist = variable !=
ADD;
232 if (p == 0 && shouldExist) {
254 if (vehicleType == 0) {
267 if (inputStorage.
readInt() != 4) {
271 vehicleParams.
id = id;
295 const int proc = -depart;
303 WRITE_WARNING(
"Departure time for person '" +
id +
"' is in the past; using current time instead.");
305 vehicleParams.
depart = depart;
339 int numParameters = inputStorage.
readInt();
346 if (numParameters != 4) {
361 if (lines.size() == 0) {
379 if (numParameters != 4) {
389 std::string description;
408 if (numParameters != 6) {
411 std::vector<std::string> edgeIDs;
428 if (fabs(arrivalPos) > edges.back()->getLength()) {
431 if (arrivalPos < 0) {
432 arrivalPos += edges.back()->getLength();
465 int nextStageIndex = 0;
472 if (nextStageIndex < 0) {
482 if (inputStorage.
readInt() != 0) {
496 if (newEdges.empty()) {
500 assert(!oldEdges.empty());
502 oldEdges.erase(oldEdges.begin());
504 if (newEdges == oldEdges) {
507 if (newEdges.front() != from) {
509 newEdges.insert(newEdges.begin(), from);
double getLength() const
return the length of the edge
double z() const
Returns the z-position.
RGBColor color
The vehicle's color, TraCI may change this.
virtual double getAngle() const
return the current angle of the transportable
virtual double getEdgePos() const
Return the position on the edge.
std::map< std::string, MSTransportable * >::const_iterator constVehIt
Definition of the internal transportables map iterator.
A lane area vehicles can halt at.
virtual double getWaitingSeconds() const
the time this transportable spent waiting in seconds
void setSpeed(double speed)
sets the walking speed (ignored in other stages)
const SUMOVehicleParameter & getParameter() const
double x() const
Returns the x-position.
#define CMD_GET_PERSON_VARIABLE
SUMOVehicle * getVehicle() const
The vehicle associated with this transportable.
int getNumRemainingStages() const
Return the number of remaining stages (including the current)
MSPedestrianRouterDijkstra & getPedestrianRouter(const MSEdgeVector &prohibited=MSEdgeVector()) const
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).
double getMaxSpeed() const
Get vehicle's maximum speed [m/s].
bool readTypeCheckingString(tcpip::Storage &inputStorage, std::string &into)
Reads the value type and a string, verifying the type.
bool readTypeCheckingDouble(tcpip::Storage &inputStorage, double &into)
Reads the value type and a double, verifying the type.
virtual MSTransportable * buildPerson(const SUMOVehicleParameter *pars, MSVehicleType *vtype, MSTransportable::MSTransportablePlan *plan) const
Builds a new person.
static bool dictionary(const std::string &id, MSEdge *edge)
Inserts edge into the static dictionary Returns true if the key id isn't already in the dictionary...
std::vector< const MSEdge * > ConstMSEdgeVector
virtual void writeUnsignedByte(int)
const std::string & getParameter(const std::string &key, const std::string &defaultValue) const
Returns the value for a given key.
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
bool writeErrorStatusCmd(int commandId, const std::string &description, tcpip::Storage &outputStorage)
Writes a status command to the given storage with status = RTYPE_ERR.
Tag for the last element in the enum for safe int casting.
static bool getVariable(const int variable, const std::string &v, tcpip::Storage &tempMsg)
Processes a value request for the given type.
virtual void writeInt(int)
#define WRITE_WARNING(msg)
The car-following model and parameter.
virtual int readUnsignedByte()
virtual double getSpeed() const
the current speed of the transportable
static bool getPosition(const std::string &id, Position &p)
Returns the named persons's position.
int size() const
Returns the number of known transportables.
unsigned char blue() const
Returns the blue-amount of the color.
void removeStage(int next)
removes the nth next stage
MSVehicleType & getSingularType()
Replaces the current vehicle type with a new one used by this vehicle only.
const std::string & getID() const
Returns the id.
A road/street connecting two junctions.
std::vector< MSTransportable::Stage * > MSTransportablePlan
the structure holding the plan of a transportable
static double naviDegree(const double angle)
const MSVehicleType & getVehicleType() const
MSStoppingPlace * getBusStop(const std::string &id) const
Returns the named bus stop.
const MSEdge * getEdge() const
Returns the current edge.
static bool processSet(TraCIServer &server, tcpip::Storage &inputStorage, tcpip::Storage &outputStorage)
Processes a set value command (Command 0xce: Change Person State)
Representation of a vehicle.
MSTransportable * get(const std::string &id) const
Returns the named transportable, if existing.
DepartPosDefinition departPosProcedure
Information how the vehicle shall choose the departure position.
virtual MSTransportableControl & getPersonControl()
Returns the person control.
A point in 2D or 3D with translation and scaling methods.
StageType getCurrentStageType() const
the current stage type of the transportable
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
unsigned char alpha() const
Returns the alpha-amount of the color.
double y() const
Returns the y-position.
bool readTypeCheckingStringList(tcpip::Storage &inputStorage, std::vector< std::string > &into)
Reads the value type and a string list, verifying the type.
virtual void writeStringList(const std::vector< std::string > &s)
SUMOTime depart
The vehicle's departure time.
DepartDefinition departProcedure
Information how the vehicle shall choose the depart time.
#define CMD_SET_VEHICLE_VARIABLE
virtual std::string readString()
TraCI server used to control sumo by a remote TraCI client.
static bool processGet(TraCIServer &server, tcpip::Storage &inputStorage, tcpip::Storage &outputStorage)
Processes a get value command (Command 0xae: Get Person Variable)
bool compute(const E *from, const E *to, double departPos, double arrivalPos, double speed, SUMOTime msTime, const N *onlyNode, std::vector< const E * > &into, bool allEdges=false)
Builds the route between the given edges using the minimum effort at the given time The definition of...
void writeResponseWithLength(tcpip::Storage &outputStorage, tcpip::Storage &tempMsg)
MSVehicleType * getVType(const std::string &id=DEFAULT_VTYPE_ID, std::mt19937 *rng=0)
Returns the named vehicle type or a sample from the named distribution.
constVehIt loadedEnd() const
Returns the end of the internal transportables map.
void appendStage(Stage *stage, int next=-1)
Appends the given stage to the current plan.
double departPos
(optional) The position the vehicle shall depart from
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)
Structure representing possible vehicle parameter.
std::string toHex(const T i, std::streamsize numDigits=0)
#define CMD_REROUTE_TRAVELTIME
StageType getStageType(int next) const
the stage type for the nth next stage
bool add(MSTransportable *transportable)
Adds a single transportable, returns false if an id clash occured.
#define RESPONSE_GET_PERSON_VARIABLE
ConstMSEdgeVector getEdges(int next) const
Return the edges of the nth next stage.
const std::string & getID() const
Returns the name of the vehicle type.
virtual const std::string & getID() const =0
Get the vehicle's ID.
void replaceVehicleType(MSVehicleType *type)
Replaces the current vehicle type by the one given.
virtual Position getPosition() const
Return the Network coordinate of the transportable.
virtual void writeDouble(double)
double getArrivalPos() const
returns the final arrival pos
unsigned char green() const
Returns the green-amount of the color.
int getNumStages() const
Return the total number stages in this persons plan.
void writeStatusCmd(int commandId, int status, const std::string &description, tcpip::Storage &outputStorage)
Writes a status command to the given storage.
constVehIt loadedBegin() const
Returns the begin of the internal transportables map.
#define CMD_SET_PERSON_VARIABLE
unsigned char red() const
Returns the red-amount of the color.
#define VAR_STAGES_REMAINING
const MSEdge * getArrivalEdge() const
returns the final arrival edge
static void parseEdgesList(const std::string &desc, ConstMSEdgeVector &into, const std::string &rid)
Parses the given string assuming it contains a list of edge ids divided by spaces.
DepartDefinition
Possible ways to depart.
std::string id
The vehicle's id.