traci._vehicletype
1# -*- coding: utf-8 -*- 2# Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo 3# Copyright (C) 2008-2026 German Aerospace Center (DLR) and others. 4# This program and the accompanying materials are made available under the 5# terms of the Eclipse Public License 2.0 which is available at 6# https://www.eclipse.org/legal/epl-2.0/ 7# This Source Code may also be made available under the following Secondary 8# Licenses when the conditions for such availability set forth in the Eclipse 9# Public License 2.0 are satisfied: GNU General Public License, version 2 10# or later which is available at 11# https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html 12# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later 13 14# @file _vehicletype.py 15# @author Michael Behrisch 16# @author Lena Kalleske 17# @date 2008-10-09 18 19from __future__ import absolute_import 20from .domain import Domain 21from . import constants as tc 22from . import exceptions 23 24 25class VTypeDomain(Domain): 26 """This class contains all functions which are common to the vehicletype, vehicle and person domain""" 27 28 def __init__(self, name, cmdGetID, cmdSetID, 29 subscribeID, subscribeResponseID, 30 contextID, contextResponseID, 31 retValFunc=None, deprecatedFor=None, 32 subscriptionDefault=(tc.TRACI_ID_LIST,)): 33 Domain.__init__(self, name, cmdGetID, cmdSetID, 34 subscribeID, subscribeResponseID, contextID, contextResponseID, 35 retValFunc, deprecatedFor, subscriptionDefault) 36 37 def getLength(self, typeID): 38 """getLength(string) -> double 39 40 Returns the length in m of this type. 41 If called in the context of a person or vehicle, it will return the value for their current type. 42 Use the respective object ID as typeID value in said context. 43 """ 44 return self._getUniversal(tc.VAR_LENGTH, typeID) 45 46 def getMaxSpeed(self, typeID): 47 """getMaxSpeed(string) -> double 48 49 Returns the maximum speed in m/s of this type. 50 If called in the context of a person or vehicle, it will return the value for their current type. 51 Use the respective object ID as typeID value in said context. 52 """ 53 return self._getUniversal(tc.VAR_MAXSPEED, typeID) 54 55 def getActionStepLength(self, typeID): 56 """getActionStepLength(string) -> double 57 58 Returns the action step length for this type. 59 If called in the context of a person or vehicle, it will return the value for their current type. 60 Use the respective object ID as typeID value in said context. 61 """ 62 return self._getUniversal(tc.VAR_ACTIONSTEPLENGTH, typeID) 63 64 def getSpeedFactor(self, typeID): 65 """getSpeedFactor(string) -> double 66 67 Returns the speed factor of this type. 68 If called in the context of a person or vehicle, it will return the value for their current type. 69 Use the respective object ID as typeID value in said context. 70 """ 71 return self._getUniversal(tc.VAR_SPEED_FACTOR, typeID) 72 73 def getSpeedDeviation(self, typeID): 74 """getSpeedDeviation(string) -> double 75 76 Returns the maximum speed deviation of this type. 77 If called in the context of a person or vehicle, it will return the value for their current type. 78 Use the respective object ID as typeID value in said context. 79 """ 80 return self._getUniversal(tc.VAR_SPEED_DEVIATION, typeID) 81 82 def getAccel(self, typeID): 83 """getAccel(string) -> double 84 85 Returns the maximum acceleration in m/s^2 of this type. 86 If called in the context of a person or vehicle, it will return the value for their current type. 87 Use the respective object ID as typeID value in said context. 88 """ 89 return self._getUniversal(tc.VAR_ACCEL, typeID) 90 91 def getDecel(self, typeID): 92 """getDecel(string) -> double 93 94 Returns the maximal comfortable deceleration in m/s^2 of this type. 95 If called in the context of a person or vehicle, it will return the value for their current type. 96 Use the respective object ID as typeID value in said context. 97 """ 98 return self._getUniversal(tc.VAR_DECEL, typeID) 99 100 def getEmergencyDecel(self, typeID): 101 """getEmergencyDecel(string) -> double 102 103 Returns the maximal physically possible deceleration in m/s^2 of this type. 104 If called in the context of a person or vehicle, it will return the value for their current type. 105 Use the respective object ID as typeID value in said context. 106 """ 107 return self._getUniversal(tc.VAR_EMERGENCY_DECEL, typeID) 108 109 def getApparentDecel(self, typeID): 110 """getApparentDecel(string) -> double 111 112 Returns the apparent deceleration in m/s^2 of this type. 113 If called in the context of a person or vehicle, it will return the value for their current type. 114 Use the respective object ID as typeID value in said context. 115 """ 116 return self._getUniversal(tc.VAR_APPARENT_DECEL, typeID) 117 118 def getImperfection(self, typeID): 119 """getImperfection(string) -> double 120 121 Returns the driver's imperfection for this type. 122 If called in the context of a person or vehicle, it will return the value for their current type. 123 Use the respective object ID as typeID value in said context. 124 """ 125 return self._getUniversal(tc.VAR_IMPERFECTION, typeID) 126 127 def getTau(self, typeID): 128 """getTau(string) -> double 129 130 Returns the driver's desired headway in s for this type. 131 If called in the context of a person or vehicle, it will return the value for their current type. 132 Use the respective object ID as typeID value in said context. 133 """ 134 return self._getUniversal(tc.VAR_TAU, typeID) 135 136 def getVehicleClass(self, typeID): 137 """getVehicleClass(string) -> string 138 139 Returns the class of this type. 140 If called in the context of a person or vehicle, it will return the value for their current type. 141 Use the respective object ID as typeID value in said context. 142 """ 143 return self._getUniversal(tc.VAR_VEHICLECLASS, typeID) 144 145 def getEmissionClass(self, typeID): 146 """getEmissionClass(string) -> string 147 148 Returns the emission class of this type. 149 If called in the context of a person or vehicle, it will return the value for their current type. 150 Use the respective object ID as typeID value in said context. 151 """ 152 return self._getUniversal(tc.VAR_EMISSIONCLASS, typeID) 153 154 def getShapeClass(self, typeID): 155 """getShapeClass(string) -> string 156 157 Returns the shape class of this type. 158 If called in the context of a person or vehicle, it will return the value for their current type. 159 Use the respective object ID as typeID value in said context. 160 """ 161 return self._getUniversal(tc.VAR_SHAPECLASS, typeID) 162 163 def getMinGap(self, typeID): 164 """getMinGap(string) -> double 165 166 Returns the offset (gap to front vehicle if halting) of this type. 167 If called in the context of a person or vehicle, it will return the value for their current type. 168 Use the respective object ID as typeID value in said context. 169 """ 170 return self._getUniversal(tc.VAR_MINGAP, typeID) 171 172 def getWidth(self, typeID): 173 """getWidth(string) -> double 174 175 Returns the width in m of this type. 176 If called in the context of a person or vehicle, it will return the value for their current type. 177 Use the respective object ID as typeID value in said context. 178 """ 179 return self._getUniversal(tc.VAR_WIDTH, typeID) 180 181 def getHeight(self, typeID): 182 """getHeight(string) -> double 183 184 Returns the height in m of this type. 185 If called in the context of a person or vehicle, it will return the value for their current type. 186 Use the respective object ID as typeID value in said context. 187 """ 188 return self._getUniversal(tc.VAR_HEIGHT, typeID) 189 190 def getMass(self, typeID): 191 """getMass(string) -> double 192 193 Returns the mass in kg of this type. 194 If called in the context of a person or vehicle, it will return the value for their current type. 195 Use the respective object ID as typeID value in said context. 196 """ 197 return self._getUniversal(tc.VAR_MASS, typeID) 198 199 def getColor(self, typeID): 200 """getColor(string) -> (integer, integer, integer, integer) 201 202 Returns the color of this type. 203 If called in the context of a person or vehicle, it will return their specific color if it has been set. 204 Use the respective object ID as typeID value in said context. 205 """ 206 return self._getUniversal(tc.VAR_COLOR, typeID) 207 208 def getMinGapLat(self, typeID): 209 """getMinGapLat(string) -> double 210 211 Returns The desired lateral gap of this type at 50km/h in m 212 If called in the context of a person or vehicle, it will return the value for their current type. 213 Use the respective object ID as typeID value in said context. 214 """ 215 return self._getUniversal(tc.VAR_MINGAP_LAT, typeID) 216 217 def getMaxSpeedLat(self, typeID): 218 """getMaxSpeedLat(string) -> double 219 220 Returns the maximum lateral speed in m/s of this type. 221 If called in the context of a person or vehicle, it will return the value for their current type. 222 Use the respective object ID as typeID value in said context. 223 """ 224 return self._getUniversal(tc.VAR_MAXSPEED_LAT, typeID) 225 226 def getLateralAlignment(self, typeID): 227 """getLateralAlignment(string) -> string 228 229 Returns The preferred lateral alignment of the type. 230 If called in the context of a person or vehicle, it will return the value for their current type. 231 Use the respective object ID as typeID value in said context. 232 """ 233 return self._getUniversal(tc.VAR_LATALIGNMENT, typeID) 234 235 def getPersonCapacity(self, typeID): 236 """getPersonCapacity(string) -> int 237 238 Returns the person capacity of this type. 239 If called in the context of a person or vehicle, it will return the value for their current type. 240 Use the respective object ID as typeID value in said context. 241 """ 242 return self._getUniversal(tc.VAR_PERSON_CAPACITY, typeID) 243 244 def getBoardingDuration(self, typeID): 245 """getBoardingDuration(string) -> double 246 247 Returns the boarding duration of this type 248 """ 249 return self._getUniversal(tc.VAR_BOARDING_DURATION, typeID) 250 251 def getImpatience(self, typeID): 252 """getImpatience(string) -> double 253 254 Returns the Impatience of this type 255 """ 256 return self._getUniversal(tc.VAR_IMPATIENCE, typeID) 257 258 def setImpatience(self, typeID, impatience): 259 """setImpatience(string, double) -> None 260 261 Sets the impatience of the this type. 262 If called in the context of a person or vehicle, it will change the value just for the single instance. 263 Use the respective object ID as typeID value in said context. 264 """ 265 self._setCmd(tc.VAR_IMPATIENCE, typeID, "d", impatience) 266 267 def setBoardingDuration(self, typeID, boardingDuration): 268 """setBoardingDuration(string, double) -> None 269 270 Sets the boarding duration of the this type. 271 If called in the context of a person or vehicle, it will change the value just for the single instance. 272 Use the respective object ID as typeID value in said context. 273 """ 274 self._setCmd(tc.VAR_BOARDING_DURATION, typeID, "d", boardingDuration) 275 276 def setLength(self, typeID, length): 277 """setLength(string, double) -> None 278 279 Sets the length in m of the this type. 280 If called in the context of a person or vehicle, it will change the value just for the single instance. 281 Use the respective object ID as typeID value in said context. 282 """ 283 self._setCmd(tc.VAR_LENGTH, typeID, "d", length) 284 285 def setMaxSpeed(self, typeID, speed): 286 """setMaxSpeed(string, double) -> None 287 288 Sets the maximum speed in m/s of this type. 289 If called in the context of a person or vehicle, it will change the value just for the single instance. 290 Use the respective object ID as typeID value in said context. 291 """ 292 self._setCmd(tc.VAR_MAXSPEED, typeID, "d", speed) 293 294 def setVehicleClass(self, typeID, clazz): 295 """setVehicleClass(string, string) -> None 296 297 Sets the class of this type. 298 If called in the context of a person or vehicle, it will change the value just for the single instance. 299 Use the respective object ID as typeID value in said context. 300 """ 301 self._setCmd(tc.VAR_VEHICLECLASS, typeID, "s", clazz) 302 303 def setSpeedFactor(self, typeID, factor): 304 """setSpeedFactor(string, double) -> None 305 306 Sets the speed factor of this type. 307 If called in the context of a person or vehicle, it will change the value just for the single instance. 308 Use the respective object ID as typeID value in said context. 309 """ 310 self._setCmd(tc.VAR_SPEED_FACTOR, typeID, "d", factor) 311 312 def setEmissionClass(self, typeID, clazz): 313 """setEmissionClass(string, string) -> None 314 315 Sets the emission class of this type. 316 If called in the context of a person or vehicle, it will change the value just for the single instance. 317 Use the respective object ID as typeID value in said context. 318 """ 319 self._setCmd(tc.VAR_EMISSIONCLASS, typeID, "s", clazz) 320 321 def setShapeClass(self, typeID, shapeClass): 322 """setShapeClass(string, string) -> None 323 324 Sets the shape class of this type. 325 If called in the context of a person or vehicle, it will change the value just for the single instance. 326 Use the respective object ID as typeID value in said context. 327 """ 328 self._setCmd(tc.VAR_SHAPECLASS, typeID, "s", shapeClass) 329 330 def setWidth(self, typeID, width): 331 """setWidth(string, double) -> None 332 333 Sets the width in m of this type. 334 If called in the context of a person or vehicle, it will change the value just for the single instance. 335 Use the respective object ID as typeID value in said context. 336 """ 337 self._setCmd(tc.VAR_WIDTH, typeID, "d", width) 338 339 def setHeight(self, typeID, height): 340 """setHeight(string, double) -> None 341 342 Sets the height in m of this type. 343 If called in the context of a person or vehicle, it will change the value just for the single instance. 344 Use the respective object ID as typeID value in said context. 345 """ 346 self._setCmd(tc.VAR_HEIGHT, typeID, "d", height) 347 348 def setMass(self, typeID, mass): 349 """setMass(string, double) -> None 350 351 Sets the mass in kg of this type. 352 If called in the context of a person or vehicle, it will change the value just for the single instance. 353 Use the respective object ID as typeID value in said context. 354 """ 355 self._setCmd(tc.VAR_MASS, typeID, "d", mass) 356 357 def setMinGap(self, typeID, minGap): 358 """setMinGap(string, double) -> None 359 360 Sets the offset (gap to front vehicle if halting) of this type. 361 If called in the context of a person or vehicle, it will change the value just for the single instance. 362 Use the respective object ID as typeID value in said context. 363 """ 364 self._setCmd(tc.VAR_MINGAP, typeID, "d", minGap) 365 366 def setAccel(self, typeID, accel): 367 """setAccel(string, double) -> None 368 369 Sets the maximum acceleration in m/s^2 of this type. 370 If called in the context of a person or vehicle, it will change the value just for the single instance. 371 Use the respective object ID as typeID value in said context. 372 """ 373 self._setCmd(tc.VAR_ACCEL, typeID, "d", accel) 374 375 def setDecel(self, typeID, decel): 376 """setDecel(string, double) -> None 377 378 Sets the maximal comfortable deceleration in m/s^2 of this type. 379 If called in the context of a person or vehicle, it will change the value just for the single instance. 380 Use the respective object ID as typeID value in said context. 381 """ 382 self._setCmd(tc.VAR_DECEL, typeID, "d", decel) 383 384 def setEmergencyDecel(self, typeID, decel): 385 """setEmergencyDecel(string, double) -> None 386 387 Sets the maximal physically possible deceleration in m/s^2 of this type. 388 If called in the context of a person or vehicle, it will change the value just for the single instance. 389 Use the respective object ID as typeID value in said context. 390 """ 391 self._setCmd(tc.VAR_EMERGENCY_DECEL, typeID, "d", decel) 392 393 def setApparentDecel(self, typeID, decel): 394 """setApparentDecel(string, double) -> None 395 396 Sets the apparent deceleration in m/s^2 of this type. 397 If called in the context of a person or vehicle, it will change the value just for the single instance. 398 Use the respective object ID as typeID value in said context. 399 """ 400 self._setCmd(tc.VAR_APPARENT_DECEL, typeID, "d", decel) 401 402 def setImperfection(self, typeID, imperfection): 403 """setImperfection(string, double) -> None 404 405 Sets the driver imperfection of this type. 406 If called in the context of a person or vehicle, it will change the value just for the single instance. 407 Use the respective object ID as typeID value in said context. 408 """ 409 self._setCmd(tc.VAR_IMPERFECTION, typeID, "d", imperfection) 410 411 def setTau(self, typeID, tau): 412 """setTau(string, double) -> None 413 414 Sets the driver's tau-parameter (reaction time or anticipation time depending on the car-following model) in s 415 for this type. 416 If called in the context of a person or vehicle, it will change the value just for the single instance. 417 Use the respective object ID as typeID value in said context. 418 """ 419 self._setCmd(tc.VAR_TAU, typeID, "d", tau) 420 421 def setColor(self, typeID, color): 422 """setColor(string, (integer, integer, integer, integer)) -> None 423 424 Sets the color of this type. 425 If called in the context of a person or vehicle, it will change the value just for the single instance. 426 Use the respective object ID as typeID value in said context. 427 """ 428 self._setCmd(tc.VAR_COLOR, typeID, "c", color) 429 430 def setMinGapLat(self, typeID, minGapLat): 431 """setMinGapLat(string, double) -> None 432 433 Sets the minimum lateral gap at 50km/h of this type. 434 If called in the context of a person or vehicle, it will change the value just for the single instance. 435 Use the respective object ID as typeID value in said context. 436 """ 437 self._setCmd(tc.VAR_MINGAP_LAT, typeID, "d", minGapLat) 438 439 def setMaxSpeedLat(self, typeID, speed): 440 """setMaxSpeedLat(string, double) -> None 441 442 Sets the maximum lateral speed of this type. 443 If called in the context of a person or vehicle, it will change the value just for the single instance. 444 Use the respective object ID as typeID value in said context. 445 """ 446 self._setCmd(tc.VAR_MAXSPEED_LAT, typeID, "d", speed) 447 448 def setLateralAlignment(self, typeID, latAlignment): 449 """setLateralAlignment(string, string) -> None 450 451 Sets the preferred lateral alignment of this type. 452 If called in the context of a person or vehicle, it will change the value just for the single instance. 453 Use the respective object ID as typeID value in said context. 454 """ 455 self._setCmd(tc.VAR_LATALIGNMENT, typeID, "s", latAlignment) 456 457 def setActionStepLength(self, typeID, actionStepLength, resetActionOffset=True): 458 """setActionStepLength(string, double, bool) -> None 459 460 Sets the action step length for this type. If resetActionOffset == True (default), the 461 next action point is scheduled immediately for all vehicles of the type. 462 If resetActionOffset == False, the interval between the last and the next action point is 463 updated to match the given value for all vehicles of the type, or if the latter is smaller 464 than the time since the last action point, the next action follows immediately. 465 If called in the context of a person or vehicle, it will change the value just for the single instance. 466 Use the respective object ID as typeID value in said context. 467 """ 468 if actionStepLength < 0: 469 raise exceptions.TraCIException("Invalid value for actionStepLength. Given value must be non-negative.") 470 # Use negative value to indicate resetActionOffset == False 471 if not resetActionOffset: 472 actionStepLength *= -1 473 self._setCmd(tc.VAR_ACTIONSTEPLENGTH, typeID, "d", actionStepLength) 474 475 476class VehicleTypeDomain(VTypeDomain): 477 """This class contains all functions which are specific to the vehicletype domain""" 478 479 def __init__(self): 480 VTypeDomain.__init__(self, "vehicletype", tc.CMD_GET_VEHICLETYPE_VARIABLE, tc.CMD_SET_VEHICLETYPE_VARIABLE, 481 tc.CMD_SUBSCRIBE_VEHICLETYPE_VARIABLE, tc.RESPONSE_SUBSCRIBE_VEHICLETYPE_VARIABLE, 482 tc.CMD_SUBSCRIBE_VEHICLETYPE_CONTEXT, tc.RESPONSE_SUBSCRIBE_VEHICLETYPE_CONTEXT) 483 484 def getScale(self, typeID): 485 """getScale(string) -> double 486 Returns the traffic scaling factor 487 """ 488 return self._getUniversal(tc.VAR_SCALE, typeID) 489 490 def setSpeedDeviation(self, typeID, deviation): 491 """setSpeedDeviation(string, double) -> None 492 493 Sets the maximum speed deviation of this type. 494 """ 495 self._setCmd(tc.VAR_SPEED_DEVIATION, typeID, "d", deviation) 496 497 def setScale(self, typeID, value): 498 """setScale(string, double) -> None 499 Sets the traffic scaling factor 500 """ 501 self._setCmd(tc.VAR_SCALE, typeID, "d", value) 502 503 def copy(self, origTypeID, newTypeID): 504 """copy(string, string) -> None 505 506 Duplicates the vType with ID origTypeID. The newly created vType is assigned the ID newTypeID 507 """ 508 self._setCmd(tc.COPY, origTypeID, "s", newTypeID)
26class VTypeDomain(Domain): 27 """This class contains all functions which are common to the vehicletype, vehicle and person domain""" 28 29 def __init__(self, name, cmdGetID, cmdSetID, 30 subscribeID, subscribeResponseID, 31 contextID, contextResponseID, 32 retValFunc=None, deprecatedFor=None, 33 subscriptionDefault=(tc.TRACI_ID_LIST,)): 34 Domain.__init__(self, name, cmdGetID, cmdSetID, 35 subscribeID, subscribeResponseID, contextID, contextResponseID, 36 retValFunc, deprecatedFor, subscriptionDefault) 37 38 def getLength(self, typeID): 39 """getLength(string) -> double 40 41 Returns the length in m of this type. 42 If called in the context of a person or vehicle, it will return the value for their current type. 43 Use the respective object ID as typeID value in said context. 44 """ 45 return self._getUniversal(tc.VAR_LENGTH, typeID) 46 47 def getMaxSpeed(self, typeID): 48 """getMaxSpeed(string) -> double 49 50 Returns the maximum speed in m/s of this type. 51 If called in the context of a person or vehicle, it will return the value for their current type. 52 Use the respective object ID as typeID value in said context. 53 """ 54 return self._getUniversal(tc.VAR_MAXSPEED, typeID) 55 56 def getActionStepLength(self, typeID): 57 """getActionStepLength(string) -> double 58 59 Returns the action step length for this type. 60 If called in the context of a person or vehicle, it will return the value for their current type. 61 Use the respective object ID as typeID value in said context. 62 """ 63 return self._getUniversal(tc.VAR_ACTIONSTEPLENGTH, typeID) 64 65 def getSpeedFactor(self, typeID): 66 """getSpeedFactor(string) -> double 67 68 Returns the speed factor of this type. 69 If called in the context of a person or vehicle, it will return the value for their current type. 70 Use the respective object ID as typeID value in said context. 71 """ 72 return self._getUniversal(tc.VAR_SPEED_FACTOR, typeID) 73 74 def getSpeedDeviation(self, typeID): 75 """getSpeedDeviation(string) -> double 76 77 Returns the maximum speed deviation of this type. 78 If called in the context of a person or vehicle, it will return the value for their current type. 79 Use the respective object ID as typeID value in said context. 80 """ 81 return self._getUniversal(tc.VAR_SPEED_DEVIATION, typeID) 82 83 def getAccel(self, typeID): 84 """getAccel(string) -> double 85 86 Returns the maximum acceleration in m/s^2 of this type. 87 If called in the context of a person or vehicle, it will return the value for their current type. 88 Use the respective object ID as typeID value in said context. 89 """ 90 return self._getUniversal(tc.VAR_ACCEL, typeID) 91 92 def getDecel(self, typeID): 93 """getDecel(string) -> double 94 95 Returns the maximal comfortable deceleration in m/s^2 of this type. 96 If called in the context of a person or vehicle, it will return the value for their current type. 97 Use the respective object ID as typeID value in said context. 98 """ 99 return self._getUniversal(tc.VAR_DECEL, typeID) 100 101 def getEmergencyDecel(self, typeID): 102 """getEmergencyDecel(string) -> double 103 104 Returns the maximal physically possible deceleration in m/s^2 of this type. 105 If called in the context of a person or vehicle, it will return the value for their current type. 106 Use the respective object ID as typeID value in said context. 107 """ 108 return self._getUniversal(tc.VAR_EMERGENCY_DECEL, typeID) 109 110 def getApparentDecel(self, typeID): 111 """getApparentDecel(string) -> double 112 113 Returns the apparent deceleration in m/s^2 of this type. 114 If called in the context of a person or vehicle, it will return the value for their current type. 115 Use the respective object ID as typeID value in said context. 116 """ 117 return self._getUniversal(tc.VAR_APPARENT_DECEL, typeID) 118 119 def getImperfection(self, typeID): 120 """getImperfection(string) -> double 121 122 Returns the driver's imperfection for this type. 123 If called in the context of a person or vehicle, it will return the value for their current type. 124 Use the respective object ID as typeID value in said context. 125 """ 126 return self._getUniversal(tc.VAR_IMPERFECTION, typeID) 127 128 def getTau(self, typeID): 129 """getTau(string) -> double 130 131 Returns the driver's desired headway in s for this type. 132 If called in the context of a person or vehicle, it will return the value for their current type. 133 Use the respective object ID as typeID value in said context. 134 """ 135 return self._getUniversal(tc.VAR_TAU, typeID) 136 137 def getVehicleClass(self, typeID): 138 """getVehicleClass(string) -> string 139 140 Returns the class of this type. 141 If called in the context of a person or vehicle, it will return the value for their current type. 142 Use the respective object ID as typeID value in said context. 143 """ 144 return self._getUniversal(tc.VAR_VEHICLECLASS, typeID) 145 146 def getEmissionClass(self, typeID): 147 """getEmissionClass(string) -> string 148 149 Returns the emission class of this type. 150 If called in the context of a person or vehicle, it will return the value for their current type. 151 Use the respective object ID as typeID value in said context. 152 """ 153 return self._getUniversal(tc.VAR_EMISSIONCLASS, typeID) 154 155 def getShapeClass(self, typeID): 156 """getShapeClass(string) -> string 157 158 Returns the shape class of this type. 159 If called in the context of a person or vehicle, it will return the value for their current type. 160 Use the respective object ID as typeID value in said context. 161 """ 162 return self._getUniversal(tc.VAR_SHAPECLASS, typeID) 163 164 def getMinGap(self, typeID): 165 """getMinGap(string) -> double 166 167 Returns the offset (gap to front vehicle if halting) of this type. 168 If called in the context of a person or vehicle, it will return the value for their current type. 169 Use the respective object ID as typeID value in said context. 170 """ 171 return self._getUniversal(tc.VAR_MINGAP, typeID) 172 173 def getWidth(self, typeID): 174 """getWidth(string) -> double 175 176 Returns the width in m of this type. 177 If called in the context of a person or vehicle, it will return the value for their current type. 178 Use the respective object ID as typeID value in said context. 179 """ 180 return self._getUniversal(tc.VAR_WIDTH, typeID) 181 182 def getHeight(self, typeID): 183 """getHeight(string) -> double 184 185 Returns the height in m of this type. 186 If called in the context of a person or vehicle, it will return the value for their current type. 187 Use the respective object ID as typeID value in said context. 188 """ 189 return self._getUniversal(tc.VAR_HEIGHT, typeID) 190 191 def getMass(self, typeID): 192 """getMass(string) -> double 193 194 Returns the mass in kg of this type. 195 If called in the context of a person or vehicle, it will return the value for their current type. 196 Use the respective object ID as typeID value in said context. 197 """ 198 return self._getUniversal(tc.VAR_MASS, typeID) 199 200 def getColor(self, typeID): 201 """getColor(string) -> (integer, integer, integer, integer) 202 203 Returns the color of this type. 204 If called in the context of a person or vehicle, it will return their specific color if it has been set. 205 Use the respective object ID as typeID value in said context. 206 """ 207 return self._getUniversal(tc.VAR_COLOR, typeID) 208 209 def getMinGapLat(self, typeID): 210 """getMinGapLat(string) -> double 211 212 Returns The desired lateral gap of this type at 50km/h in m 213 If called in the context of a person or vehicle, it will return the value for their current type. 214 Use the respective object ID as typeID value in said context. 215 """ 216 return self._getUniversal(tc.VAR_MINGAP_LAT, typeID) 217 218 def getMaxSpeedLat(self, typeID): 219 """getMaxSpeedLat(string) -> double 220 221 Returns the maximum lateral speed in m/s of this type. 222 If called in the context of a person or vehicle, it will return the value for their current type. 223 Use the respective object ID as typeID value in said context. 224 """ 225 return self._getUniversal(tc.VAR_MAXSPEED_LAT, typeID) 226 227 def getLateralAlignment(self, typeID): 228 """getLateralAlignment(string) -> string 229 230 Returns The preferred lateral alignment of the type. 231 If called in the context of a person or vehicle, it will return the value for their current type. 232 Use the respective object ID as typeID value in said context. 233 """ 234 return self._getUniversal(tc.VAR_LATALIGNMENT, typeID) 235 236 def getPersonCapacity(self, typeID): 237 """getPersonCapacity(string) -> int 238 239 Returns the person capacity of this type. 240 If called in the context of a person or vehicle, it will return the value for their current type. 241 Use the respective object ID as typeID value in said context. 242 """ 243 return self._getUniversal(tc.VAR_PERSON_CAPACITY, typeID) 244 245 def getBoardingDuration(self, typeID): 246 """getBoardingDuration(string) -> double 247 248 Returns the boarding duration of this type 249 """ 250 return self._getUniversal(tc.VAR_BOARDING_DURATION, typeID) 251 252 def getImpatience(self, typeID): 253 """getImpatience(string) -> double 254 255 Returns the Impatience of this type 256 """ 257 return self._getUniversal(tc.VAR_IMPATIENCE, typeID) 258 259 def setImpatience(self, typeID, impatience): 260 """setImpatience(string, double) -> None 261 262 Sets the impatience of the this type. 263 If called in the context of a person or vehicle, it will change the value just for the single instance. 264 Use the respective object ID as typeID value in said context. 265 """ 266 self._setCmd(tc.VAR_IMPATIENCE, typeID, "d", impatience) 267 268 def setBoardingDuration(self, typeID, boardingDuration): 269 """setBoardingDuration(string, double) -> None 270 271 Sets the boarding duration of the this type. 272 If called in the context of a person or vehicle, it will change the value just for the single instance. 273 Use the respective object ID as typeID value in said context. 274 """ 275 self._setCmd(tc.VAR_BOARDING_DURATION, typeID, "d", boardingDuration) 276 277 def setLength(self, typeID, length): 278 """setLength(string, double) -> None 279 280 Sets the length in m of the this type. 281 If called in the context of a person or vehicle, it will change the value just for the single instance. 282 Use the respective object ID as typeID value in said context. 283 """ 284 self._setCmd(tc.VAR_LENGTH, typeID, "d", length) 285 286 def setMaxSpeed(self, typeID, speed): 287 """setMaxSpeed(string, double) -> None 288 289 Sets the maximum speed in m/s of this type. 290 If called in the context of a person or vehicle, it will change the value just for the single instance. 291 Use the respective object ID as typeID value in said context. 292 """ 293 self._setCmd(tc.VAR_MAXSPEED, typeID, "d", speed) 294 295 def setVehicleClass(self, typeID, clazz): 296 """setVehicleClass(string, string) -> None 297 298 Sets the class of this type. 299 If called in the context of a person or vehicle, it will change the value just for the single instance. 300 Use the respective object ID as typeID value in said context. 301 """ 302 self._setCmd(tc.VAR_VEHICLECLASS, typeID, "s", clazz) 303 304 def setSpeedFactor(self, typeID, factor): 305 """setSpeedFactor(string, double) -> None 306 307 Sets the speed factor of this type. 308 If called in the context of a person or vehicle, it will change the value just for the single instance. 309 Use the respective object ID as typeID value in said context. 310 """ 311 self._setCmd(tc.VAR_SPEED_FACTOR, typeID, "d", factor) 312 313 def setEmissionClass(self, typeID, clazz): 314 """setEmissionClass(string, string) -> None 315 316 Sets the emission class of this type. 317 If called in the context of a person or vehicle, it will change the value just for the single instance. 318 Use the respective object ID as typeID value in said context. 319 """ 320 self._setCmd(tc.VAR_EMISSIONCLASS, typeID, "s", clazz) 321 322 def setShapeClass(self, typeID, shapeClass): 323 """setShapeClass(string, string) -> None 324 325 Sets the shape class of this type. 326 If called in the context of a person or vehicle, it will change the value just for the single instance. 327 Use the respective object ID as typeID value in said context. 328 """ 329 self._setCmd(tc.VAR_SHAPECLASS, typeID, "s", shapeClass) 330 331 def setWidth(self, typeID, width): 332 """setWidth(string, double) -> None 333 334 Sets the width in m of this type. 335 If called in the context of a person or vehicle, it will change the value just for the single instance. 336 Use the respective object ID as typeID value in said context. 337 """ 338 self._setCmd(tc.VAR_WIDTH, typeID, "d", width) 339 340 def setHeight(self, typeID, height): 341 """setHeight(string, double) -> None 342 343 Sets the height in m of this type. 344 If called in the context of a person or vehicle, it will change the value just for the single instance. 345 Use the respective object ID as typeID value in said context. 346 """ 347 self._setCmd(tc.VAR_HEIGHT, typeID, "d", height) 348 349 def setMass(self, typeID, mass): 350 """setMass(string, double) -> None 351 352 Sets the mass in kg of this type. 353 If called in the context of a person or vehicle, it will change the value just for the single instance. 354 Use the respective object ID as typeID value in said context. 355 """ 356 self._setCmd(tc.VAR_MASS, typeID, "d", mass) 357 358 def setMinGap(self, typeID, minGap): 359 """setMinGap(string, double) -> None 360 361 Sets the offset (gap to front vehicle if halting) of this type. 362 If called in the context of a person or vehicle, it will change the value just for the single instance. 363 Use the respective object ID as typeID value in said context. 364 """ 365 self._setCmd(tc.VAR_MINGAP, typeID, "d", minGap) 366 367 def setAccel(self, typeID, accel): 368 """setAccel(string, double) -> None 369 370 Sets the maximum acceleration in m/s^2 of this type. 371 If called in the context of a person or vehicle, it will change the value just for the single instance. 372 Use the respective object ID as typeID value in said context. 373 """ 374 self._setCmd(tc.VAR_ACCEL, typeID, "d", accel) 375 376 def setDecel(self, typeID, decel): 377 """setDecel(string, double) -> None 378 379 Sets the maximal comfortable deceleration in m/s^2 of this type. 380 If called in the context of a person or vehicle, it will change the value just for the single instance. 381 Use the respective object ID as typeID value in said context. 382 """ 383 self._setCmd(tc.VAR_DECEL, typeID, "d", decel) 384 385 def setEmergencyDecel(self, typeID, decel): 386 """setEmergencyDecel(string, double) -> None 387 388 Sets the maximal physically possible deceleration in m/s^2 of this type. 389 If called in the context of a person or vehicle, it will change the value just for the single instance. 390 Use the respective object ID as typeID value in said context. 391 """ 392 self._setCmd(tc.VAR_EMERGENCY_DECEL, typeID, "d", decel) 393 394 def setApparentDecel(self, typeID, decel): 395 """setApparentDecel(string, double) -> None 396 397 Sets the apparent deceleration in m/s^2 of this type. 398 If called in the context of a person or vehicle, it will change the value just for the single instance. 399 Use the respective object ID as typeID value in said context. 400 """ 401 self._setCmd(tc.VAR_APPARENT_DECEL, typeID, "d", decel) 402 403 def setImperfection(self, typeID, imperfection): 404 """setImperfection(string, double) -> None 405 406 Sets the driver imperfection of this type. 407 If called in the context of a person or vehicle, it will change the value just for the single instance. 408 Use the respective object ID as typeID value in said context. 409 """ 410 self._setCmd(tc.VAR_IMPERFECTION, typeID, "d", imperfection) 411 412 def setTau(self, typeID, tau): 413 """setTau(string, double) -> None 414 415 Sets the driver's tau-parameter (reaction time or anticipation time depending on the car-following model) in s 416 for this type. 417 If called in the context of a person or vehicle, it will change the value just for the single instance. 418 Use the respective object ID as typeID value in said context. 419 """ 420 self._setCmd(tc.VAR_TAU, typeID, "d", tau) 421 422 def setColor(self, typeID, color): 423 """setColor(string, (integer, integer, integer, integer)) -> None 424 425 Sets the color of this type. 426 If called in the context of a person or vehicle, it will change the value just for the single instance. 427 Use the respective object ID as typeID value in said context. 428 """ 429 self._setCmd(tc.VAR_COLOR, typeID, "c", color) 430 431 def setMinGapLat(self, typeID, minGapLat): 432 """setMinGapLat(string, double) -> None 433 434 Sets the minimum lateral gap at 50km/h of this type. 435 If called in the context of a person or vehicle, it will change the value just for the single instance. 436 Use the respective object ID as typeID value in said context. 437 """ 438 self._setCmd(tc.VAR_MINGAP_LAT, typeID, "d", minGapLat) 439 440 def setMaxSpeedLat(self, typeID, speed): 441 """setMaxSpeedLat(string, double) -> None 442 443 Sets the maximum lateral speed of this type. 444 If called in the context of a person or vehicle, it will change the value just for the single instance. 445 Use the respective object ID as typeID value in said context. 446 """ 447 self._setCmd(tc.VAR_MAXSPEED_LAT, typeID, "d", speed) 448 449 def setLateralAlignment(self, typeID, latAlignment): 450 """setLateralAlignment(string, string) -> None 451 452 Sets the preferred lateral alignment of this type. 453 If called in the context of a person or vehicle, it will change the value just for the single instance. 454 Use the respective object ID as typeID value in said context. 455 """ 456 self._setCmd(tc.VAR_LATALIGNMENT, typeID, "s", latAlignment) 457 458 def setActionStepLength(self, typeID, actionStepLength, resetActionOffset=True): 459 """setActionStepLength(string, double, bool) -> None 460 461 Sets the action step length for this type. If resetActionOffset == True (default), the 462 next action point is scheduled immediately for all vehicles of the type. 463 If resetActionOffset == False, the interval between the last and the next action point is 464 updated to match the given value for all vehicles of the type, or if the latter is smaller 465 than the time since the last action point, the next action follows immediately. 466 If called in the context of a person or vehicle, it will change the value just for the single instance. 467 Use the respective object ID as typeID value in said context. 468 """ 469 if actionStepLength < 0: 470 raise exceptions.TraCIException("Invalid value for actionStepLength. Given value must be non-negative.") 471 # Use negative value to indicate resetActionOffset == False 472 if not resetActionOffset: 473 actionStepLength *= -1 474 self._setCmd(tc.VAR_ACTIONSTEPLENGTH, typeID, "d", actionStepLength)
This class contains all functions which are common to the vehicletype, vehicle and person domain
29 def __init__(self, name, cmdGetID, cmdSetID, 30 subscribeID, subscribeResponseID, 31 contextID, contextResponseID, 32 retValFunc=None, deprecatedFor=None, 33 subscriptionDefault=(tc.TRACI_ID_LIST,)): 34 Domain.__init__(self, name, cmdGetID, cmdSetID, 35 subscribeID, subscribeResponseID, contextID, contextResponseID, 36 retValFunc, deprecatedFor, subscriptionDefault)
38 def getLength(self, typeID): 39 """getLength(string) -> double 40 41 Returns the length in m of this type. 42 If called in the context of a person or vehicle, it will return the value for their current type. 43 Use the respective object ID as typeID value in said context. 44 """ 45 return self._getUniversal(tc.VAR_LENGTH, typeID)
getLength(string) -> double
Returns the length in m of this type. If called in the context of a person or vehicle, it will return the value for their current type. Use the respective object ID as typeID value in said context.
47 def getMaxSpeed(self, typeID): 48 """getMaxSpeed(string) -> double 49 50 Returns the maximum speed in m/s of this type. 51 If called in the context of a person or vehicle, it will return the value for their current type. 52 Use the respective object ID as typeID value in said context. 53 """ 54 return self._getUniversal(tc.VAR_MAXSPEED, typeID)
getMaxSpeed(string) -> double
Returns the maximum speed in m/s of this type. If called in the context of a person or vehicle, it will return the value for their current type. Use the respective object ID as typeID value in said context.
56 def getActionStepLength(self, typeID): 57 """getActionStepLength(string) -> double 58 59 Returns the action step length for this type. 60 If called in the context of a person or vehicle, it will return the value for their current type. 61 Use the respective object ID as typeID value in said context. 62 """ 63 return self._getUniversal(tc.VAR_ACTIONSTEPLENGTH, typeID)
getActionStepLength(string) -> double
Returns the action step length for this type. If called in the context of a person or vehicle, it will return the value for their current type. Use the respective object ID as typeID value in said context.
65 def getSpeedFactor(self, typeID): 66 """getSpeedFactor(string) -> double 67 68 Returns the speed factor of this type. 69 If called in the context of a person or vehicle, it will return the value for their current type. 70 Use the respective object ID as typeID value in said context. 71 """ 72 return self._getUniversal(tc.VAR_SPEED_FACTOR, typeID)
getSpeedFactor(string) -> double
Returns the speed factor of this type. If called in the context of a person or vehicle, it will return the value for their current type. Use the respective object ID as typeID value in said context.
74 def getSpeedDeviation(self, typeID): 75 """getSpeedDeviation(string) -> double 76 77 Returns the maximum speed deviation of this type. 78 If called in the context of a person or vehicle, it will return the value for their current type. 79 Use the respective object ID as typeID value in said context. 80 """ 81 return self._getUniversal(tc.VAR_SPEED_DEVIATION, typeID)
getSpeedDeviation(string) -> double
Returns the maximum speed deviation of this type. If called in the context of a person or vehicle, it will return the value for their current type. Use the respective object ID as typeID value in said context.
83 def getAccel(self, typeID): 84 """getAccel(string) -> double 85 86 Returns the maximum acceleration in m/s^2 of this type. 87 If called in the context of a person or vehicle, it will return the value for their current type. 88 Use the respective object ID as typeID value in said context. 89 """ 90 return self._getUniversal(tc.VAR_ACCEL, typeID)
getAccel(string) -> double
Returns the maximum acceleration in m/s^2 of this type. If called in the context of a person or vehicle, it will return the value for their current type. Use the respective object ID as typeID value in said context.
92 def getDecel(self, typeID): 93 """getDecel(string) -> double 94 95 Returns the maximal comfortable deceleration in m/s^2 of this type. 96 If called in the context of a person or vehicle, it will return the value for their current type. 97 Use the respective object ID as typeID value in said context. 98 """ 99 return self._getUniversal(tc.VAR_DECEL, typeID)
getDecel(string) -> double
Returns the maximal comfortable deceleration in m/s^2 of this type. If called in the context of a person or vehicle, it will return the value for their current type. Use the respective object ID as typeID value in said context.
101 def getEmergencyDecel(self, typeID): 102 """getEmergencyDecel(string) -> double 103 104 Returns the maximal physically possible deceleration in m/s^2 of this type. 105 If called in the context of a person or vehicle, it will return the value for their current type. 106 Use the respective object ID as typeID value in said context. 107 """ 108 return self._getUniversal(tc.VAR_EMERGENCY_DECEL, typeID)
getEmergencyDecel(string) -> double
Returns the maximal physically possible deceleration in m/s^2 of this type. If called in the context of a person or vehicle, it will return the value for their current type. Use the respective object ID as typeID value in said context.
110 def getApparentDecel(self, typeID): 111 """getApparentDecel(string) -> double 112 113 Returns the apparent deceleration in m/s^2 of this type. 114 If called in the context of a person or vehicle, it will return the value for their current type. 115 Use the respective object ID as typeID value in said context. 116 """ 117 return self._getUniversal(tc.VAR_APPARENT_DECEL, typeID)
getApparentDecel(string) -> double
Returns the apparent deceleration in m/s^2 of this type. If called in the context of a person or vehicle, it will return the value for their current type. Use the respective object ID as typeID value in said context.
119 def getImperfection(self, typeID): 120 """getImperfection(string) -> double 121 122 Returns the driver's imperfection for this type. 123 If called in the context of a person or vehicle, it will return the value for their current type. 124 Use the respective object ID as typeID value in said context. 125 """ 126 return self._getUniversal(tc.VAR_IMPERFECTION, typeID)
getImperfection(string) -> double
Returns the driver's imperfection for this type. If called in the context of a person or vehicle, it will return the value for their current type. Use the respective object ID as typeID value in said context.
128 def getTau(self, typeID): 129 """getTau(string) -> double 130 131 Returns the driver's desired headway in s for this type. 132 If called in the context of a person or vehicle, it will return the value for their current type. 133 Use the respective object ID as typeID value in said context. 134 """ 135 return self._getUniversal(tc.VAR_TAU, typeID)
getTau(string) -> double
Returns the driver's desired headway in s for this type. If called in the context of a person or vehicle, it will return the value for their current type. Use the respective object ID as typeID value in said context.
137 def getVehicleClass(self, typeID): 138 """getVehicleClass(string) -> string 139 140 Returns the class of this type. 141 If called in the context of a person or vehicle, it will return the value for their current type. 142 Use the respective object ID as typeID value in said context. 143 """ 144 return self._getUniversal(tc.VAR_VEHICLECLASS, typeID)
getVehicleClass(string) -> string
Returns the class of this type. If called in the context of a person or vehicle, it will return the value for their current type. Use the respective object ID as typeID value in said context.
146 def getEmissionClass(self, typeID): 147 """getEmissionClass(string) -> string 148 149 Returns the emission class of this type. 150 If called in the context of a person or vehicle, it will return the value for their current type. 151 Use the respective object ID as typeID value in said context. 152 """ 153 return self._getUniversal(tc.VAR_EMISSIONCLASS, typeID)
getEmissionClass(string) -> string
Returns the emission class of this type. If called in the context of a person or vehicle, it will return the value for their current type. Use the respective object ID as typeID value in said context.
155 def getShapeClass(self, typeID): 156 """getShapeClass(string) -> string 157 158 Returns the shape class of this type. 159 If called in the context of a person or vehicle, it will return the value for their current type. 160 Use the respective object ID as typeID value in said context. 161 """ 162 return self._getUniversal(tc.VAR_SHAPECLASS, typeID)
getShapeClass(string) -> string
Returns the shape class of this type. If called in the context of a person or vehicle, it will return the value for their current type. Use the respective object ID as typeID value in said context.
164 def getMinGap(self, typeID): 165 """getMinGap(string) -> double 166 167 Returns the offset (gap to front vehicle if halting) of this type. 168 If called in the context of a person or vehicle, it will return the value for their current type. 169 Use the respective object ID as typeID value in said context. 170 """ 171 return self._getUniversal(tc.VAR_MINGAP, typeID)
getMinGap(string) -> double
Returns the offset (gap to front vehicle if halting) of this type. If called in the context of a person or vehicle, it will return the value for their current type. Use the respective object ID as typeID value in said context.
173 def getWidth(self, typeID): 174 """getWidth(string) -> double 175 176 Returns the width in m of this type. 177 If called in the context of a person or vehicle, it will return the value for their current type. 178 Use the respective object ID as typeID value in said context. 179 """ 180 return self._getUniversal(tc.VAR_WIDTH, typeID)
getWidth(string) -> double
Returns the width in m of this type. If called in the context of a person or vehicle, it will return the value for their current type. Use the respective object ID as typeID value in said context.
182 def getHeight(self, typeID): 183 """getHeight(string) -> double 184 185 Returns the height in m of this type. 186 If called in the context of a person or vehicle, it will return the value for their current type. 187 Use the respective object ID as typeID value in said context. 188 """ 189 return self._getUniversal(tc.VAR_HEIGHT, typeID)
getHeight(string) -> double
Returns the height in m of this type. If called in the context of a person or vehicle, it will return the value for their current type. Use the respective object ID as typeID value in said context.
191 def getMass(self, typeID): 192 """getMass(string) -> double 193 194 Returns the mass in kg of this type. 195 If called in the context of a person or vehicle, it will return the value for their current type. 196 Use the respective object ID as typeID value in said context. 197 """ 198 return self._getUniversal(tc.VAR_MASS, typeID)
getMass(string) -> double
Returns the mass in kg of this type. If called in the context of a person or vehicle, it will return the value for their current type. Use the respective object ID as typeID value in said context.
200 def getColor(self, typeID): 201 """getColor(string) -> (integer, integer, integer, integer) 202 203 Returns the color of this type. 204 If called in the context of a person or vehicle, it will return their specific color if it has been set. 205 Use the respective object ID as typeID value in said context. 206 """ 207 return self._getUniversal(tc.VAR_COLOR, typeID)
getColor(string) -> (integer, integer, integer, integer)
Returns the color of this type. If called in the context of a person or vehicle, it will return their specific color if it has been set. Use the respective object ID as typeID value in said context.
209 def getMinGapLat(self, typeID): 210 """getMinGapLat(string) -> double 211 212 Returns The desired lateral gap of this type at 50km/h in m 213 If called in the context of a person or vehicle, it will return the value for their current type. 214 Use the respective object ID as typeID value in said context. 215 """ 216 return self._getUniversal(tc.VAR_MINGAP_LAT, typeID)
getMinGapLat(string) -> double
Returns The desired lateral gap of this type at 50km/h in m If called in the context of a person or vehicle, it will return the value for their current type. Use the respective object ID as typeID value in said context.
218 def getMaxSpeedLat(self, typeID): 219 """getMaxSpeedLat(string) -> double 220 221 Returns the maximum lateral speed in m/s of this type. 222 If called in the context of a person or vehicle, it will return the value for their current type. 223 Use the respective object ID as typeID value in said context. 224 """ 225 return self._getUniversal(tc.VAR_MAXSPEED_LAT, typeID)
getMaxSpeedLat(string) -> double
Returns the maximum lateral speed in m/s of this type. If called in the context of a person or vehicle, it will return the value for their current type. Use the respective object ID as typeID value in said context.
227 def getLateralAlignment(self, typeID): 228 """getLateralAlignment(string) -> string 229 230 Returns The preferred lateral alignment of the type. 231 If called in the context of a person or vehicle, it will return the value for their current type. 232 Use the respective object ID as typeID value in said context. 233 """ 234 return self._getUniversal(tc.VAR_LATALIGNMENT, typeID)
getLateralAlignment(string) -> string
Returns The preferred lateral alignment of the type. If called in the context of a person or vehicle, it will return the value for their current type. Use the respective object ID as typeID value in said context.
236 def getPersonCapacity(self, typeID): 237 """getPersonCapacity(string) -> int 238 239 Returns the person capacity of this type. 240 If called in the context of a person or vehicle, it will return the value for their current type. 241 Use the respective object ID as typeID value in said context. 242 """ 243 return self._getUniversal(tc.VAR_PERSON_CAPACITY, typeID)
getPersonCapacity(string) -> int
Returns the person capacity of this type. If called in the context of a person or vehicle, it will return the value for their current type. Use the respective object ID as typeID value in said context.
245 def getBoardingDuration(self, typeID): 246 """getBoardingDuration(string) -> double 247 248 Returns the boarding duration of this type 249 """ 250 return self._getUniversal(tc.VAR_BOARDING_DURATION, typeID)
getBoardingDuration(string) -> double
Returns the boarding duration of this type
252 def getImpatience(self, typeID): 253 """getImpatience(string) -> double 254 255 Returns the Impatience of this type 256 """ 257 return self._getUniversal(tc.VAR_IMPATIENCE, typeID)
getImpatience(string) -> double
Returns the Impatience of this type
259 def setImpatience(self, typeID, impatience): 260 """setImpatience(string, double) -> None 261 262 Sets the impatience of the this type. 263 If called in the context of a person or vehicle, it will change the value just for the single instance. 264 Use the respective object ID as typeID value in said context. 265 """ 266 self._setCmd(tc.VAR_IMPATIENCE, typeID, "d", impatience)
setImpatience(string, double) -> None
Sets the impatience of the this type. If called in the context of a person or vehicle, it will change the value just for the single instance. Use the respective object ID as typeID value in said context.
268 def setBoardingDuration(self, typeID, boardingDuration): 269 """setBoardingDuration(string, double) -> None 270 271 Sets the boarding duration of the this type. 272 If called in the context of a person or vehicle, it will change the value just for the single instance. 273 Use the respective object ID as typeID value in said context. 274 """ 275 self._setCmd(tc.VAR_BOARDING_DURATION, typeID, "d", boardingDuration)
setBoardingDuration(string, double) -> None
Sets the boarding duration of the this type. If called in the context of a person or vehicle, it will change the value just for the single instance. Use the respective object ID as typeID value in said context.
277 def setLength(self, typeID, length): 278 """setLength(string, double) -> None 279 280 Sets the length in m of the this type. 281 If called in the context of a person or vehicle, it will change the value just for the single instance. 282 Use the respective object ID as typeID value in said context. 283 """ 284 self._setCmd(tc.VAR_LENGTH, typeID, "d", length)
setLength(string, double) -> None
Sets the length in m of the this type. If called in the context of a person or vehicle, it will change the value just for the single instance. Use the respective object ID as typeID value in said context.
286 def setMaxSpeed(self, typeID, speed): 287 """setMaxSpeed(string, double) -> None 288 289 Sets the maximum speed in m/s of this type. 290 If called in the context of a person or vehicle, it will change the value just for the single instance. 291 Use the respective object ID as typeID value in said context. 292 """ 293 self._setCmd(tc.VAR_MAXSPEED, typeID, "d", speed)
setMaxSpeed(string, double) -> None
Sets the maximum speed in m/s of this type. If called in the context of a person or vehicle, it will change the value just for the single instance. Use the respective object ID as typeID value in said context.
295 def setVehicleClass(self, typeID, clazz): 296 """setVehicleClass(string, string) -> None 297 298 Sets the class of this type. 299 If called in the context of a person or vehicle, it will change the value just for the single instance. 300 Use the respective object ID as typeID value in said context. 301 """ 302 self._setCmd(tc.VAR_VEHICLECLASS, typeID, "s", clazz)
setVehicleClass(string, string) -> None
Sets the class of this type. If called in the context of a person or vehicle, it will change the value just for the single instance. Use the respective object ID as typeID value in said context.
304 def setSpeedFactor(self, typeID, factor): 305 """setSpeedFactor(string, double) -> None 306 307 Sets the speed factor of this type. 308 If called in the context of a person or vehicle, it will change the value just for the single instance. 309 Use the respective object ID as typeID value in said context. 310 """ 311 self._setCmd(tc.VAR_SPEED_FACTOR, typeID, "d", factor)
setSpeedFactor(string, double) -> None
Sets the speed factor of this type. If called in the context of a person or vehicle, it will change the value just for the single instance. Use the respective object ID as typeID value in said context.
313 def setEmissionClass(self, typeID, clazz): 314 """setEmissionClass(string, string) -> None 315 316 Sets the emission class of this type. 317 If called in the context of a person or vehicle, it will change the value just for the single instance. 318 Use the respective object ID as typeID value in said context. 319 """ 320 self._setCmd(tc.VAR_EMISSIONCLASS, typeID, "s", clazz)
setEmissionClass(string, string) -> None
Sets the emission class of this type. If called in the context of a person or vehicle, it will change the value just for the single instance. Use the respective object ID as typeID value in said context.
322 def setShapeClass(self, typeID, shapeClass): 323 """setShapeClass(string, string) -> None 324 325 Sets the shape class of this type. 326 If called in the context of a person or vehicle, it will change the value just for the single instance. 327 Use the respective object ID as typeID value in said context. 328 """ 329 self._setCmd(tc.VAR_SHAPECLASS, typeID, "s", shapeClass)
setShapeClass(string, string) -> None
Sets the shape class of this type. If called in the context of a person or vehicle, it will change the value just for the single instance. Use the respective object ID as typeID value in said context.
331 def setWidth(self, typeID, width): 332 """setWidth(string, double) -> None 333 334 Sets the width in m of this type. 335 If called in the context of a person or vehicle, it will change the value just for the single instance. 336 Use the respective object ID as typeID value in said context. 337 """ 338 self._setCmd(tc.VAR_WIDTH, typeID, "d", width)
setWidth(string, double) -> None
Sets the width in m of this type. If called in the context of a person or vehicle, it will change the value just for the single instance. Use the respective object ID as typeID value in said context.
340 def setHeight(self, typeID, height): 341 """setHeight(string, double) -> None 342 343 Sets the height in m of this type. 344 If called in the context of a person or vehicle, it will change the value just for the single instance. 345 Use the respective object ID as typeID value in said context. 346 """ 347 self._setCmd(tc.VAR_HEIGHT, typeID, "d", height)
setHeight(string, double) -> None
Sets the height in m of this type. If called in the context of a person or vehicle, it will change the value just for the single instance. Use the respective object ID as typeID value in said context.
349 def setMass(self, typeID, mass): 350 """setMass(string, double) -> None 351 352 Sets the mass in kg of this type. 353 If called in the context of a person or vehicle, it will change the value just for the single instance. 354 Use the respective object ID as typeID value in said context. 355 """ 356 self._setCmd(tc.VAR_MASS, typeID, "d", mass)
setMass(string, double) -> None
Sets the mass in kg of this type. If called in the context of a person or vehicle, it will change the value just for the single instance. Use the respective object ID as typeID value in said context.
358 def setMinGap(self, typeID, minGap): 359 """setMinGap(string, double) -> None 360 361 Sets the offset (gap to front vehicle if halting) of this type. 362 If called in the context of a person or vehicle, it will change the value just for the single instance. 363 Use the respective object ID as typeID value in said context. 364 """ 365 self._setCmd(tc.VAR_MINGAP, typeID, "d", minGap)
setMinGap(string, double) -> None
Sets the offset (gap to front vehicle if halting) of this type. If called in the context of a person or vehicle, it will change the value just for the single instance. Use the respective object ID as typeID value in said context.
367 def setAccel(self, typeID, accel): 368 """setAccel(string, double) -> None 369 370 Sets the maximum acceleration in m/s^2 of this type. 371 If called in the context of a person or vehicle, it will change the value just for the single instance. 372 Use the respective object ID as typeID value in said context. 373 """ 374 self._setCmd(tc.VAR_ACCEL, typeID, "d", accel)
setAccel(string, double) -> None
Sets the maximum acceleration in m/s^2 of this type. If called in the context of a person or vehicle, it will change the value just for the single instance. Use the respective object ID as typeID value in said context.
376 def setDecel(self, typeID, decel): 377 """setDecel(string, double) -> None 378 379 Sets the maximal comfortable deceleration in m/s^2 of this type. 380 If called in the context of a person or vehicle, it will change the value just for the single instance. 381 Use the respective object ID as typeID value in said context. 382 """ 383 self._setCmd(tc.VAR_DECEL, typeID, "d", decel)
setDecel(string, double) -> None
Sets the maximal comfortable deceleration in m/s^2 of this type. If called in the context of a person or vehicle, it will change the value just for the single instance. Use the respective object ID as typeID value in said context.
385 def setEmergencyDecel(self, typeID, decel): 386 """setEmergencyDecel(string, double) -> None 387 388 Sets the maximal physically possible deceleration in m/s^2 of this type. 389 If called in the context of a person or vehicle, it will change the value just for the single instance. 390 Use the respective object ID as typeID value in said context. 391 """ 392 self._setCmd(tc.VAR_EMERGENCY_DECEL, typeID, "d", decel)
setEmergencyDecel(string, double) -> None
Sets the maximal physically possible deceleration in m/s^2 of this type. If called in the context of a person or vehicle, it will change the value just for the single instance. Use the respective object ID as typeID value in said context.
394 def setApparentDecel(self, typeID, decel): 395 """setApparentDecel(string, double) -> None 396 397 Sets the apparent deceleration in m/s^2 of this type. 398 If called in the context of a person or vehicle, it will change the value just for the single instance. 399 Use the respective object ID as typeID value in said context. 400 """ 401 self._setCmd(tc.VAR_APPARENT_DECEL, typeID, "d", decel)
setApparentDecel(string, double) -> None
Sets the apparent deceleration in m/s^2 of this type. If called in the context of a person or vehicle, it will change the value just for the single instance. Use the respective object ID as typeID value in said context.
403 def setImperfection(self, typeID, imperfection): 404 """setImperfection(string, double) -> None 405 406 Sets the driver imperfection of this type. 407 If called in the context of a person or vehicle, it will change the value just for the single instance. 408 Use the respective object ID as typeID value in said context. 409 """ 410 self._setCmd(tc.VAR_IMPERFECTION, typeID, "d", imperfection)
setImperfection(string, double) -> None
Sets the driver imperfection of this type. If called in the context of a person or vehicle, it will change the value just for the single instance. Use the respective object ID as typeID value in said context.
412 def setTau(self, typeID, tau): 413 """setTau(string, double) -> None 414 415 Sets the driver's tau-parameter (reaction time or anticipation time depending on the car-following model) in s 416 for this type. 417 If called in the context of a person or vehicle, it will change the value just for the single instance. 418 Use the respective object ID as typeID value in said context. 419 """ 420 self._setCmd(tc.VAR_TAU, typeID, "d", tau)
setTau(string, double) -> None
Sets the driver's tau-parameter (reaction time or anticipation time depending on the car-following model) in s for this type. If called in the context of a person or vehicle, it will change the value just for the single instance. Use the respective object ID as typeID value in said context.
422 def setColor(self, typeID, color): 423 """setColor(string, (integer, integer, integer, integer)) -> None 424 425 Sets the color of this type. 426 If called in the context of a person or vehicle, it will change the value just for the single instance. 427 Use the respective object ID as typeID value in said context. 428 """ 429 self._setCmd(tc.VAR_COLOR, typeID, "c", color)
setColor(string, (integer, integer, integer, integer)) -> None
Sets the color of this type. If called in the context of a person or vehicle, it will change the value just for the single instance. Use the respective object ID as typeID value in said context.
431 def setMinGapLat(self, typeID, minGapLat): 432 """setMinGapLat(string, double) -> None 433 434 Sets the minimum lateral gap at 50km/h of this type. 435 If called in the context of a person or vehicle, it will change the value just for the single instance. 436 Use the respective object ID as typeID value in said context. 437 """ 438 self._setCmd(tc.VAR_MINGAP_LAT, typeID, "d", minGapLat)
setMinGapLat(string, double) -> None
Sets the minimum lateral gap at 50km/h of this type. If called in the context of a person or vehicle, it will change the value just for the single instance. Use the respective object ID as typeID value in said context.
440 def setMaxSpeedLat(self, typeID, speed): 441 """setMaxSpeedLat(string, double) -> None 442 443 Sets the maximum lateral speed of this type. 444 If called in the context of a person or vehicle, it will change the value just for the single instance. 445 Use the respective object ID as typeID value in said context. 446 """ 447 self._setCmd(tc.VAR_MAXSPEED_LAT, typeID, "d", speed)
setMaxSpeedLat(string, double) -> None
Sets the maximum lateral speed of this type. If called in the context of a person or vehicle, it will change the value just for the single instance. Use the respective object ID as typeID value in said context.
449 def setLateralAlignment(self, typeID, latAlignment): 450 """setLateralAlignment(string, string) -> None 451 452 Sets the preferred lateral alignment of this type. 453 If called in the context of a person or vehicle, it will change the value just for the single instance. 454 Use the respective object ID as typeID value in said context. 455 """ 456 self._setCmd(tc.VAR_LATALIGNMENT, typeID, "s", latAlignment)
setLateralAlignment(string, string) -> None
Sets the preferred lateral alignment of this type. If called in the context of a person or vehicle, it will change the value just for the single instance. Use the respective object ID as typeID value in said context.
458 def setActionStepLength(self, typeID, actionStepLength, resetActionOffset=True): 459 """setActionStepLength(string, double, bool) -> None 460 461 Sets the action step length for this type. If resetActionOffset == True (default), the 462 next action point is scheduled immediately for all vehicles of the type. 463 If resetActionOffset == False, the interval between the last and the next action point is 464 updated to match the given value for all vehicles of the type, or if the latter is smaller 465 than the time since the last action point, the next action follows immediately. 466 If called in the context of a person or vehicle, it will change the value just for the single instance. 467 Use the respective object ID as typeID value in said context. 468 """ 469 if actionStepLength < 0: 470 raise exceptions.TraCIException("Invalid value for actionStepLength. Given value must be non-negative.") 471 # Use negative value to indicate resetActionOffset == False 472 if not resetActionOffset: 473 actionStepLength *= -1 474 self._setCmd(tc.VAR_ACTIONSTEPLENGTH, typeID, "d", actionStepLength)
setActionStepLength(string, double, bool) -> None
Sets the action step length for this type. If resetActionOffset == True (default), the next action point is scheduled immediately for all vehicles of the type. If resetActionOffset == False, the interval between the last and the next action point is updated to match the given value for all vehicles of the type, or if the latter is smaller than the time since the last action point, the next action follows immediately. If called in the context of a person or vehicle, it will change the value just for the single instance. Use the respective object ID as typeID value in said context.
477class VehicleTypeDomain(VTypeDomain): 478 """This class contains all functions which are specific to the vehicletype domain""" 479 480 def __init__(self): 481 VTypeDomain.__init__(self, "vehicletype", tc.CMD_GET_VEHICLETYPE_VARIABLE, tc.CMD_SET_VEHICLETYPE_VARIABLE, 482 tc.CMD_SUBSCRIBE_VEHICLETYPE_VARIABLE, tc.RESPONSE_SUBSCRIBE_VEHICLETYPE_VARIABLE, 483 tc.CMD_SUBSCRIBE_VEHICLETYPE_CONTEXT, tc.RESPONSE_SUBSCRIBE_VEHICLETYPE_CONTEXT) 484 485 def getScale(self, typeID): 486 """getScale(string) -> double 487 Returns the traffic scaling factor 488 """ 489 return self._getUniversal(tc.VAR_SCALE, typeID) 490 491 def setSpeedDeviation(self, typeID, deviation): 492 """setSpeedDeviation(string, double) -> None 493 494 Sets the maximum speed deviation of this type. 495 """ 496 self._setCmd(tc.VAR_SPEED_DEVIATION, typeID, "d", deviation) 497 498 def setScale(self, typeID, value): 499 """setScale(string, double) -> None 500 Sets the traffic scaling factor 501 """ 502 self._setCmd(tc.VAR_SCALE, typeID, "d", value) 503 504 def copy(self, origTypeID, newTypeID): 505 """copy(string, string) -> None 506 507 Duplicates the vType with ID origTypeID. The newly created vType is assigned the ID newTypeID 508 """ 509 self._setCmd(tc.COPY, origTypeID, "s", newTypeID)
This class contains all functions which are specific to the vehicletype domain
485 def getScale(self, typeID): 486 """getScale(string) -> double 487 Returns the traffic scaling factor 488 """ 489 return self._getUniversal(tc.VAR_SCALE, typeID)
getScale(string) -> double Returns the traffic scaling factor
491 def setSpeedDeviation(self, typeID, deviation): 492 """setSpeedDeviation(string, double) -> None 493 494 Sets the maximum speed deviation of this type. 495 """ 496 self._setCmd(tc.VAR_SPEED_DEVIATION, typeID, "d", deviation)
setSpeedDeviation(string, double) -> None
Sets the maximum speed deviation of this type.
498 def setScale(self, typeID, value): 499 """setScale(string, double) -> None 500 Sets the traffic scaling factor 501 """ 502 self._setCmd(tc.VAR_SCALE, typeID, "d", value)
setScale(string, double) -> None Sets the traffic scaling factor
504 def copy(self, origTypeID, newTypeID): 505 """copy(string, string) -> None 506 507 Duplicates the vType with ID origTypeID. The newly created vType is assigned the ID newTypeID 508 """ 509 self._setCmd(tc.COPY, origTypeID, "s", newTypeID)
copy(string, string) -> None
Duplicates the vType with ID origTypeID. The newly created vType is assigned the ID newTypeID
Inherited Members
- VTypeDomain
- getLength
- getMaxSpeed
- getActionStepLength
- getSpeedFactor
- getSpeedDeviation
- getAccel
- getDecel
- getEmergencyDecel
- getApparentDecel
- getImperfection
- getTau
- getVehicleClass
- getEmissionClass
- getShapeClass
- getMinGap
- getWidth
- getHeight
- getMass
- getColor
- getMinGapLat
- getMaxSpeedLat
- getLateralAlignment
- getPersonCapacity
- getBoardingDuration
- getImpatience
- setImpatience
- setBoardingDuration
- setLength
- setMaxSpeed
- setVehicleClass
- setSpeedFactor
- setEmissionClass
- setShapeClass
- setWidth
- setHeight
- setMass
- setMinGap
- setAccel
- setDecel
- setEmergencyDecel
- setApparentDecel
- setImperfection
- setTau
- setColor
- setMinGapLat
- setMaxSpeedLat
- setLateralAlignment
- setActionStepLength