 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
44 const std::string
id = inputStorage.
readString();
50 std::string paramName =
"";
53 "Retrieval of a parameter requires its name.", outputStorage);
61 "Get Vehicle Type Variable: unsupported variable " +
toHex(variable, 2)
62 +
" specified", outputStorage);
77 std::string warning =
"";
94 "Change Vehicle Type State: unsupported variable " +
toHex(variable, 2)
95 +
" specified", outputStorage);
127 return server.
writeErrorStatusCmd(cmd,
"Setting length requires a double.", outputStorage);
129 if (value <= 0.0 || fabs(value) == std::numeric_limits<double>::infinity()) {
132 libsumo::VehicleType::setLength(
id, value);
138 return server.
writeErrorStatusCmd(cmd,
"Setting height requires a double.", outputStorage);
140 if (value <= 0.0 || fabs(value) == std::numeric_limits<double>::infinity()) {
143 libsumo::VehicleType::setHeight(
id, value);
149 return server.
writeErrorStatusCmd(cmd,
"Setting maximum speed requires a double.", outputStorage);
151 if (value <= 0.0 || fabs(value) == std::numeric_limits<double>::infinity()) {
154 libsumo::VehicleType::setMaxSpeed(
id, value);
160 return server.
writeErrorStatusCmd(cmd,
"Setting vehicle class requires a string.", outputStorage);
163 libsumo::VehicleType::setVehicleClass(
id, vclass);
165 return server.
writeErrorStatusCmd(cmd,
"Unknown vehicle class '" + vclass +
"'.", outputStorage);
172 return server.
writeErrorStatusCmd(cmd,
"Setting speed factor requires a double.", outputStorage);
174 if (value <= 0.0 || fabs(value) == std::numeric_limits<double>::infinity()) {
177 libsumo::VehicleType::setSpeedFactor(
id, value);
183 return server.
writeErrorStatusCmd(cmd,
"Setting speed deviation requires a double.", outputStorage);
185 if (value < 0.0 || fabs(value) == std::numeric_limits<double>::infinity()) {
194 return server.
writeErrorStatusCmd(cmd,
"Setting emission class requires a string.", outputStorage);
197 libsumo::VehicleType::setEmissionClass(
id, eclass);
208 if (value <= 0.0 || fabs(value) == std::numeric_limits<double>::infinity()) {
211 libsumo::VehicleType::setWidth(
id, value);
217 return server.
writeErrorStatusCmd(cmd,
"Setting minimum gap requires a double.", outputStorage);
219 if (value < 0.0 || fabs(value) == std::numeric_limits<double>::infinity()) {
222 libsumo::VehicleType::setMinGap(
id, value);
228 return server.
writeErrorStatusCmd(cmd,
"Setting minimum lateral gap requires a double.", outputStorage);
230 if (value < 0.0 || fabs(value) == std::numeric_limits<double>::infinity()) {
233 libsumo::VehicleType::setMinGapLat(
id, value);
239 return server.
writeErrorStatusCmd(cmd,
"Setting maximum lateral speed requires a double.", outputStorage);
241 if (value < 0.0 || fabs(value) == std::numeric_limits<double>::infinity()) {
244 libsumo::VehicleType::setMaxSpeedLat(
id, value);
248 std::string latAlign;
250 return server.
writeErrorStatusCmd(cmd,
"Setting preferred lateral alignment requires a string.",
254 libsumo::VehicleType::setLateralAlignment(
id, latAlign);
256 return server.
writeErrorStatusCmd(cmd,
"Unknown lateral alignment " + latAlign +
"'.", outputStorage);
263 return server.
writeErrorStatusCmd(cmd,
"Setting vehicle shape requires a string.", outputStorage);
266 libsumo::VehicleType::setShapeClass(
id, sclass);
275 return server.
writeErrorStatusCmd(cmd,
"Setting acceleration requires a double.", outputStorage);
277 if (value < 0.0 || fabs(value) == std::numeric_limits<double>::infinity()) {
280 libsumo::VehicleType::setAccel(
id, value);
286 return server.
writeErrorStatusCmd(cmd,
"Setting deceleration requires a double.", outputStorage);
288 if (value < 0.0 || fabs(value) == std::numeric_limits<double>::infinity()) {
291 libsumo::VehicleType::setDecel(
id, value);
297 return server.
writeErrorStatusCmd(cmd,
"Setting deceleration requires a double.", outputStorage);
299 if (value < 0.0 || fabs(value) == std::numeric_limits<double>::infinity()) {
302 libsumo::VehicleType::setEmergencyDecel(
id, value);
308 return server.
writeErrorStatusCmd(cmd,
"Setting deceleration requires a double.", outputStorage);
310 if (value < 0.0 || fabs(value) == std::numeric_limits<double>::infinity()) {
313 libsumo::VehicleType::setApparentDecel(
id, value);
321 if (fabs(value) == std::numeric_limits<double>::infinity()) {
324 bool resetActionOffset = value >= 0.0;
325 libsumo::VehicleType::setActionStepLength(
id, fabs(value), resetActionOffset);
331 return server.
writeErrorStatusCmd(cmd,
"Setting driver imperfection requires a double.", outputStorage);
333 if (value < 0.0 || fabs(value) == std::numeric_limits<double>::infinity()) {
336 libsumo::VehicleType::setImperfection(
id, value);
342 return server.
writeErrorStatusCmd(cmd,
"Setting headway time requires a double.", outputStorage);
344 if (value < 0.0 || fabs(value) == std::numeric_limits<double>::infinity()) {
347 libsumo::VehicleType::setTau(
id, value);
353 return server.
writeErrorStatusCmd(cmd,
"The color must be given using the according type.", outputStorage);
355 libsumo::VehicleType::setColor(
id, col);
359 std::string newTypeID;
369 return server.
writeErrorStatusCmd(cmd,
"A compound object is needed for setting a parameter.",
376 return server.
writeErrorStatusCmd(cmd,
"The name of the parameter must be given as a string.",
381 return server.
writeErrorStatusCmd(cmd,
"The value of the parameter must be given as a string.",
virtual void writeUnsignedByte(int)
TRACI_CONST int VAR_HEIGHT
TRACI_CONST int VAR_EMISSIONCLASS
static bool processGet(TraCIServer &server, tcpip::Storage &inputStorage, tcpip::Storage &outputStorage)
Processes a get value command (Command 0xa5: Get Vehicle Type Variable)
TRACI_CONST int VAR_MINGAP
TRACI_CONST int VAR_MAXSPEED
TRACI_CONST int VAR_COLOR
bool readTypeCheckingColor(tcpip::Storage &inputStorage, libsumo::TraCIColor &into)
Reads the value type and a color, verifying the type.
static LIBSUMO_VEHICLE_TYPE_GETTER std::string getParameter(const std::string &typeID, const std::string &key)
bool readTypeCheckingString(tcpip::Storage &inputStorage, std::string &into)
Reads the value type and a string, verifying the type.
TRACI_CONST int VAR_WIDTH
void writeResponseWithLength(tcpip::Storage &outputStorage, tcpip::Storage &tempMsg)
TRACI_CONST int VAR_VEHICLECLASS
TRACI_CONST int VAR_PARAMETER
TRACI_CONST int VAR_ACCEL
static bool handleVariable(const std::string &objID, const int variable, VariableWrapper *wrapper)
tcpip::Storage & getWrapperStorage()
TRACI_CONST int CMD_SET_VEHICLE_VARIABLE
TRACI_CONST int CMD_GET_VEHICLETYPE_VARIABLE
bool readTypeCheckingDouble(tcpip::Storage &inputStorage, double &into)
Reads the value type and a double, verifying the type.
void writeStatusCmd(int commandId, int status, const std::string &description, tcpip::Storage &outputStorage)
Writes a status command to the given storage.
static LIBSUMO_VEHICLE_TYPE_SETTER void copy(const std::string &origTypeID, const std::string &newTypeID)
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.
void initWrapper(const int domainID, const int variable, const std::string &objID)
TRACI_CONST int VAR_MINGAP_LAT
virtual void writeString(const std::string &s)
TRACI_CONST int VAR_LATALIGNMENT
virtual int readUnsignedByte()
TRACI_CONST int CMD_SET_VEHICLETYPE_VARIABLE
std::string toHex(const T i, std::streamsize numDigits=0)
static void setSpeedDeviation(const std::string &typeID, double deviation)
static bool processSet(TraCIServer &server, tcpip::Storage &inputStorage, tcpip::Storage &outputStorage)
Processes a set value command (Command 0xc5: Change Vehicle Type State)
TRACI_CONST int VAR_SPEED_FACTOR
TRACI_CONST int VAR_SPEED_DEVIATION
TRACI_CONST int VAR_LENGTH
TRACI_CONST int VAR_EMERGENCY_DECEL
TRACI_CONST int VAR_SHAPECLASS
TRACI_CONST int TYPE_STRING
TRACI_CONST int VAR_DECEL
TRACI_CONST int RESPONSE_GET_VEHICLETYPE_VARIABLE
static void setParameter(const std::string &id, const std::string &name, const std::string &value)
TRACI_CONST int VAR_IMPERFECTION
virtual std::string readString()
TRACI_CONST int VAR_APPARENT_DECEL
static StringBijection< LateralAlignment > LateralAlignments
lateral alignments
TraCI server used to control sumo by a remote TraCI client.
TRACI_CONST int VAR_MAXSPEED_LAT
TRACI_CONST int VAR_ACTIONSTEPLENGTH
TRACI_CONST int TYPE_COMPOUND
bool writeErrorStatusCmd(int commandId, const std::string &description, tcpip::Storage &outputStorage)
Writes a status command to the given storage with status = RTYPE_ERR.