43 std::string warning =
"";
64 "Change Vehicle Type State: unsupported variable " +
toHex(variable, 2)
65 +
" specified", outputStorage);
96 if (
value <= 0.0 || fabs(
value) == std::numeric_limits<double>::infinity()) {
99 libsumo::VehicleType::setLength(
id,
value);
104 if (
value <= 0.0 || fabs(
value) == std::numeric_limits<double>::infinity()) {
107 libsumo::VehicleType::setHeight(
id,
value);
112 if (
value <= 0.0 || fabs(
value) == std::numeric_limits<double>::infinity()) {
115 libsumo::VehicleType::setMass(
id,
value);
120 if (
value <= 0.0 || fabs(
value) == std::numeric_limits<double>::infinity()) {
123 libsumo::VehicleType::setMaxSpeed(
id,
value);
127 libsumo::VehicleType::setVehicleClass(
id,
StoHelp::readTypedString(inputStorage,
"Setting vehicle class requires a string."));
132 if (
value <= 0.0 || fabs(
value) == std::numeric_limits<double>::infinity()) {
135 libsumo::VehicleType::setSpeedFactor(
id,
value);
140 if (
value < 0.0 || fabs(
value) == std::numeric_limits<double>::infinity()) {
143 libsumo::VehicleType::setSpeedDeviation(
id,
value);
147 libsumo::VehicleType::setEmissionClass(
id,
StoHelp::readTypedString(inputStorage,
"Setting emission class requires a string."));
152 if (
value <= 0.0 || fabs(
value) == std::numeric_limits<double>::infinity()) {
155 libsumo::VehicleType::setWidth(
id,
value);
160 if (
value < 0.0 || fabs(
value) == std::numeric_limits<double>::infinity()) {
163 libsumo::VehicleType::setMinGap(
id,
value);
168 if (
value < 0.0 || fabs(
value) == std::numeric_limits<double>::infinity()) {
171 libsumo::VehicleType::setMinGapLat(
id,
value);
176 if (
value < 0.0 || fabs(
value) == std::numeric_limits<double>::infinity()) {
179 libsumo::VehicleType::setMaxSpeedLat(
id,
value);
183 libsumo::VehicleType::setLateralAlignment(
id,
StoHelp::readTypedString(inputStorage,
"Setting preferred lateral alignment requires a string."));
187 libsumo::VehicleType::setShapeClass(
id,
StoHelp::readTypedString(inputStorage,
"Setting vehicle shape requires a string."));
192 if (
value < 0.0 || fabs(
value) == std::numeric_limits<double>::infinity()) {
195 libsumo::VehicleType::setAccel(
id,
value);
200 if (
value < 0.0 || fabs(
value) == std::numeric_limits<double>::infinity()) {
203 libsumo::VehicleType::setDecel(
id,
value);
208 if (
value < 0.0 || fabs(
value) == std::numeric_limits<double>::infinity()) {
211 libsumo::VehicleType::setEmergencyDecel(
id,
value);
216 if (
value < 0.0 || fabs(
value) == std::numeric_limits<double>::infinity()) {
219 libsumo::VehicleType::setApparentDecel(
id,
value);
227 libsumo::VehicleType::setScale(
id,
value);
232 if (fabs(
value) == std::numeric_limits<double>::infinity()) {
235 bool resetActionOffset =
value >= 0.0;
236 libsumo::VehicleType::setActionStepLength(
id, fabs(
value), resetActionOffset);
241 if (
value < 0.0 || fabs(
value) == std::numeric_limits<double>::infinity()) {
244 libsumo::VehicleType::setImperfection(
id,
value);
249 if (
value < 0.0 || fabs(
value) == std::numeric_limits<double>::infinity()) {
252 libsumo::VehicleType::setTau(
id,
value);
256 libsumo::VehicleType::setImpatience(
id,
StoHelp::readTypedDouble(inputStorage,
"Setting impatience requires a double."));
260 libsumo::VehicleType::setBoardingDuration(
id,
StoHelp::readTypedDouble(inputStorage,
"Setting boarding duration requires a double."));
264 libsumo::VehicleType::setColor(
id,
StoHelp::readTypedColor(inputStorage,
"The color must be given using the according type."));
268 libsumo::VehicleType::copy(
id,
StoHelp::readTypedString(inputStorage,
"Copying a vehicle type requires a string."));
272 StoHelp::readCompound(inputStorage, 2,
"A compound object of size 2 is needed for setting a parameter.");
273 const std::string name =
StoHelp::readTypedString(inputStorage,
"The name of the parameter must be given as a string.");
275 libsumo::VehicleType::setParameter(
id, name,
value);
const std::string invalid_return< std::string >::value
std::string toHex(const T i, std::streamsize numDigits=0)
static bool processSet(TraCIServer &server, tcpip::Storage &inputStorage, tcpip::Storage &outputStorage)
Processes a set value command (Command 0xc5: Change Vehicle Type State).
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.
TraCI server used to control sumo by a remote TraCI client.
void writeStatusCmd(int commandId, int status, const std::string &description, tcpip::Storage &outputStorage)
Writes a status command to the given storage.
bool writeErrorStatusCmd(int commandId, const std::string &description, tcpip::Storage &outputStorage)
Writes a status command to the given storage with status = RTYPE_ERR.
static int readCompound(tcpip::Storage &ret, int expectedSize=-1, const std::string &error="")
static std::string readTypedString(tcpip::Storage &ret, const std::string &error="")
static const libsumo::TraCIColor readTypedColor(tcpip::Storage &ret, const std::string &error="")
static double readTypedDouble(tcpip::Storage &ret, const std::string &error="")
An error which allows to continue.
virtual std::string readString()
virtual int readUnsignedByte()
TRACI_CONST int VAR_VEHICLECLASS
TRACI_CONST int VAR_IMPATIENCE
TRACI_CONST int VAR_LATALIGNMENT
TRACI_CONST int VAR_SCALE
TRACI_CONST int VAR_MINGAP
TRACI_CONST int VAR_SHAPECLASS
TRACI_CONST int VAR_ACTIONSTEPLENGTH
TRACI_CONST int VAR_SPEED_FACTOR
TRACI_CONST int VAR_BOARDING_DURATION
TRACI_CONST int VAR_COLOR
TRACI_CONST int VAR_WIDTH
TRACI_CONST int VAR_MAXSPEED
TRACI_CONST int CMD_SET_VEHICLE_VARIABLE
TRACI_CONST int VAR_LENGTH
TRACI_CONST int VAR_MAXSPEED_LAT
TRACI_CONST int VAR_PARAMETER
TRACI_CONST int CMD_SET_VEHICLETYPE_VARIABLE
TRACI_CONST int VAR_IMPERFECTION
TRACI_CONST int VAR_HEIGHT
TRACI_CONST int VAR_APPARENT_DECEL
TRACI_CONST int VAR_DECEL
TRACI_CONST int VAR_MINGAP_LAT
TRACI_CONST int VAR_EMERGENCY_DECEL
TRACI_CONST int VAR_EMISSIONCLASS
TRACI_CONST int VAR_ACCEL
TRACI_CONST int VAR_SPEED_DEVIATION