SUMO - Simulation of Urban MObility
TraCIServerAPI_Vehicle Class Reference

APIs for getting/setting vehicle values via TraCI. More...

#include <TraCIServerAPI_Vehicle.h>

Collaboration diagram for TraCIServerAPI_Vehicle:
Collaboration graph

Data Structures

class  LaneUtility
 

Static Public Member Functions

static bool getPosition (const std::string &id, Position &p)
 Returns the named vehicle's position. More...
 
static bool processGet (TraCIServer &server, tcpip::Storage &inputStorage, tcpip::Storage &outputStorage)
 Processes a get value command (Command 0xa4: Get Vehicle Variable) More...
 
static bool processSet (TraCIServer &server, tcpip::Storage &inputStorage, tcpip::Storage &outputStorage)
 Processes a set value command (Command 0xc4: Change Vehicle State) More...
 

Private Member Functions

TraCIServerAPI_Vehicleoperator= (const TraCIServerAPI_Vehicle &s)
 invalidated assignment operator More...
 
 TraCIServerAPI_Vehicle (const TraCIServerAPI_Vehicle &s)
 invalidated copy constructor More...
 

Static Private Member Functions

static bool findCloserLane (const MSEdge *edge, const Position &pos, double &bestDistance, MSLane **lane)
 
static MSVehicleTypegetSingularType (SUMOVehicle *const veh)
 
static bool vtdMap (const Position &pos, double maxRouteDistance, const std::string &origID, const double angle, MSVehicle &v, TraCIServer &server, double &bestDistance, MSLane **lane, double &lanePos, int &routeOffset, ConstMSEdgeVector &edges)
 
static bool vtdMap_matchingRoutePosition (const Position &pos, const std::string &origID, MSVehicle &v, double &bestDistance, MSLane **lane, double &lanePos, int &routeOffset, ConstMSEdgeVector &edges)
 

Static Private Attributes

static std::map< std::string, std::vector< MSLane * > > gVTDMap
 

Detailed Description

APIs for getting/setting vehicle values via TraCI.

Definition at line 49 of file TraCIServerAPI_Vehicle.h.

Constructor & Destructor Documentation

◆ TraCIServerAPI_Vehicle()

TraCIServerAPI_Vehicle::TraCIServerAPI_Vehicle ( const TraCIServerAPI_Vehicle s)
private

invalidated copy constructor

Member Function Documentation

◆ findCloserLane()

bool TraCIServerAPI_Vehicle::findCloserLane ( const MSEdge edge,
const Position pos,
double &  bestDistance,
MSLane **  lane 
)
staticprivate

◆ getPosition()

bool TraCIServerAPI_Vehicle::getPosition ( const std::string &  id,
Position p 
)
static

Returns the named vehicle's position.

Parameters
[in]idThe id of the searched vehicle
[out]pThe position, if the vehicle is on the network
Returns
Whether the vehicle is known (and on road)

Definition at line 1739 of file TraCIServerAPI_Vehicle.cpp.

References MSNet::getInstance(), MSVehicle::getPosition(), MSVehicleControl::getVehicle(), and MSNet::getVehicleControl().

Referenced by TraCIServer::findObjectShape().

◆ getSingularType()

MSVehicleType & TraCIServerAPI_Vehicle::getSingularType ( SUMOVehicle *const  veh)
staticprivate

◆ operator=()

TraCIServerAPI_Vehicle& TraCIServerAPI_Vehicle::operator= ( const TraCIServerAPI_Vehicle s)
private

invalidated assignment operator

◆ processGet()

bool TraCIServerAPI_Vehicle::processGet ( TraCIServer server,
tcpip::Storage inputStorage,
tcpip::Storage outputStorage 
)
static

Processes a get value command (Command 0xa4: Get Vehicle Variable)

Parameters
[in]serverThe TraCI-server-instance which schedules this request
[in]inputStorageThe storage to read the command from
[out]outputStorageThe storage to write the result to

XXX replace by a TraCI_VehicleType function

Definition at line 73 of file TraCIServerAPI_Vehicle.cpp.

References TraCIColor::a, TraCI_Vehicle::BestLanesData::allowsContinuation, TraCIColor::b, TraCI_Vehicle::BestLanesData::bestLaneOffset, CMD_CHANGELANE, CMD_GET_VEHICLE_VARIABLE, TraCI_Vehicle::BestLanesData::continuationLanes, DISTANCE_REQUEST, TraCIColor::g, TraCI_Vehicle::getAdaptedTraveltime(), TraCI_Vehicle::getAllowedSpeed(), TraCI_Vehicle::getAngle(), TraCI_Vehicle::getBestLanes(), TraCI_Vehicle::getCO2Emission(), TraCI_Vehicle::getCOEmission(), TraCI_Vehicle::getColor(), TraCI_Vehicle::getDistance(), TraCI_Vehicle::getDrivingDistance(), TraCI_Vehicle::getDrivingDistance2D(), TraCI_Vehicle::getEdges(), TraCI_Vehicle::getEffort(), TraCI_Vehicle::getElectricityConsumption(), TraCI_Vehicle::getFuelConsumption(), TraCI_Vehicle::getHCEmission(), TraCI_Vehicle::getIDCount(), TraCI_Vehicle::getIDList(), TraCI_Vehicle::getLaneChangeState(), TraCI_Vehicle::getLaneID(), TraCI_Vehicle::getLaneIndex(), TraCI_Vehicle::getLanePosition(), TraCI_Vehicle::getLateralLanePosition(), TraCI_Vehicle::getLeader(), TraCI_Vehicle::getLine(), TraCI_Vehicle::getNextTLS(), TraCI_Vehicle::getNoiseEmission(), TraCI_Vehicle::getNOxEmission(), TraCI_Vehicle::getParameter(), TraCI_Vehicle::getPersonNumber(), TraCI_Vehicle::getPMxEmission(), TraCI_Vehicle::getPosition(), TraCI_Vehicle::getRoadID(), TraCI_Vehicle::getRouteID(), TraCI_Vehicle::getRouteIndex(), TraCI_Vehicle::getSignalStates(), TraCI_Vehicle::getSlope(), TraCI_Vehicle::getSpeed(), TraCI_Vehicle::getSpeedFactor(), TraCI_Vehicle::getSpeedMode(), TraCI_Vehicle::getSpeedWithoutTraCI(), TraCI_Vehicle::getStopState(), TraCI_Vehicle::getTypeID(), TraCIServerAPI_VehicleType::getVariable(), TraCI_Vehicle::getVehicleType(), TraCI_Vehicle::getVia(), TraCI_Vehicle::getWaitingTime(), ID_COUNT, ID_LIST, TraCI_Vehicle::isRouteValid(), TraCI_Vehicle::BestLanesData::laneID, TraCI_Vehicle::BestLanesData::length, TraCI_Vehicle::BestLanesData::nextOccupation, POSITION_2D, POSITION_3D, POSITION_ROADMAP, TraCIColor::r, tcpip::Storage::readDouble(), tcpip::Storage::readInt(), tcpip::Storage::readString(), TraCIServer::readTypeCheckingDouble(), TraCIServer::readTypeCheckingInt(), TraCIServer::readTypeCheckingString(), tcpip::Storage::readUnsignedByte(), REQUEST_DRIVINGDIST, RESPONSE_GET_VEHICLE_VARIABLE, RTYPE_OK, toHex(), TYPE_BYTE, TYPE_COLOR, TYPE_COMPOUND, TYPE_DOUBLE, TYPE_INTEGER, TYPE_STRING, TYPE_STRINGLIST, TYPE_UBYTE, VAR_ACCEL, VAR_ALLOWED_SPEED, VAR_ANGLE, VAR_BEST_LANES, VAR_CO2EMISSION, VAR_COEMISSION, VAR_COLOR, VAR_DECEL, VAR_DISTANCE, VAR_EDGE_EFFORT, VAR_EDGE_TRAVELTIME, VAR_EDGES, VAR_ELECTRICITYCONSUMPTION, VAR_EMISSIONCLASS, VAR_FUELCONSUMPTION, VAR_HCEMISSION, VAR_HEIGHT, VAR_IMPERFECTION, VAR_LANE_ID, VAR_LANE_INDEX, VAR_LANEPOSITION, VAR_LANEPOSITION_LAT, VAR_LATALIGNMENT, VAR_LEADER, VAR_LENGTH, VAR_LINE, VAR_MAXSPEED, VAR_MAXSPEED_LAT, VAR_MINGAP, VAR_MINGAP_LAT, VAR_NEXT_TLS, VAR_NOISEEMISSION, VAR_NOXEMISSION, VAR_PARAMETER, VAR_PERSON_NUMBER, VAR_PMXEMISSION, VAR_POSITION, VAR_POSITION3D, VAR_ROAD_ID, VAR_ROUTE_ID, VAR_ROUTE_INDEX, VAR_ROUTE_VALID, VAR_SHAPECLASS, VAR_SIGNALS, VAR_SLOPE, VAR_SPEED, VAR_SPEED_DEVIATION, VAR_SPEED_FACTOR, VAR_SPEED_WITHOUT_TRACI, VAR_SPEEDSETMODE, VAR_STOPSTATE, VAR_TAU, VAR_TYPE, VAR_VEHICLECLASS, VAR_VIA, VAR_WAITING_TIME, VAR_WIDTH, tcpip::Storage::writeByte(), tcpip::Storage::writeDouble(), TraCIServer::writeErrorStatusCmd(), tcpip::Storage::writeInt(), TraCIServer::writeResponseWithLength(), TraCIServer::writeStatusCmd(), tcpip::Storage::writeStorage(), tcpip::Storage::writeString(), tcpip::Storage::writeStringList(), tcpip::Storage::writeUnsignedByte(), TraCIPosition::x, TraCIPosition::y, and TraCIPosition::z.

Referenced by TraCIServer::TraCIServer().

◆ processSet()

bool TraCIServerAPI_Vehicle::processSet ( TraCIServer server,
tcpip::Storage inputStorage,
tcpip::Storage outputStorage 
)
static

Processes a set value command (Command 0xc4: Change Vehicle State)

Parameters
[in]serverThe TraCI-server-instance which schedules this request
[in]inputStorageThe storage to read the command from
[out]outputStorageThe storage to write the result to

XXX but a big try/catch around all retrieval cases

Definition at line 478 of file TraCIServerAPI_Vehicle.cpp.

References TraCIColor::a, MSInsertionControl::add(), ADD, ADD_FULL, MSEdgeWeightsStorage::addEffort(), MSEdgeWeightsStorage::addTravelTime(), MSVehicleControl::addVehicle(), MSInsertionControl::alreadyDeparted(), Position::angleTo2D(), SUMOVehicleParameter::arrivalLane, SUMOVehicleParameter::arrivalLaneProcedure, SUMOVehicleParameter::arrivalPos, SUMOVehicleParameter::arrivalPosProcedure, SUMOVehicleParameter::arrivalSpeed, SUMOVehicleParameter::arrivalSpeedProcedure, TraCIColor::b, MSVehicleControl::buildVehicle(), CMD_CHANGELANE, CMD_CHANGESUBLANE, CMD_CHANGETARGET, CMD_GET_VEHICLE_VARIABLE, CMD_REROUTE_EFFORT, CMD_REROUTE_TRAVELTIME, CMD_RESUME, CMD_SET_VEHICLE_VARIABLE, CMD_SLOWDOWN, CMD_STOP, SUMOVehicleParameter::color, SUMOAbstractRouter< E, V >::compute(), MSVehicleControl::deleteVehicle(), DELTA_T, SUMOVehicleParameter::depart, DEPART_DEF_MAX, DEPART_GIVEN, DEPART_LANE_DEF_MAX, DEPART_LANE_GIVEN, DEPART_POS_DEF_MAX, DEPART_POS_GIVEN, DEPART_SPEED_DEF_MAX, DEPART_SPEED_GIVEN, SUMOVehicleParameter::departLane, SUMOVehicleParameter::departLaneProcedure, SUMOVehicleParameter::departPos, SUMOVehicleParameter::departPosProcedure, SUMOVehicleParameter::departProcedure, SUMOVehicleParameter::departSpeed, SUMOVehicleParameter::departSpeedProcedure, MSRoute::dictionary(), MSLane::dictionary(), MSEdge::dictionary(), PositionVector::distance2D(), MSVehicle::enterLaneAtMove(), MSLane::forceVehicleInsertion(), SUMOVehicleParameter::fromTaz, TraCIColor::g, MSGlobals::gCheckRoutes, MSNet::getCurrentTimeStep(), MSBaseVehicle::getEdge(), MSLane::getEdge(), Named::getID(), MSBaseVehicle::getID(), MSVehicleType::getID(), Named::getIDSecure(), MSVehicle::getInfluencer(), MSNet::getInsertionControl(), MSNet::getInstance(), MSVehicle::getLane(), MSEdge::getLanes(), MSBaseVehicle::getParameter(), MSVehicle::getPosition(), MSVehicle::getRerouteOrigin(), MSNet::getRouterTT(), MSLane::getShape(), getSingularType(), MSVehicle::getSpeed(), MSVehicleControl::getVehicle(), MSNet::getVehicleControl(), MSBaseVehicle::getVehicleType(), MSVehicleControl::getVType(), MSVehicle::getWeightsStorage(), MSVehicleType::getWidth(), MSLane::getWidth(), MSGlobals::gLateralResolution, MSBaseVehicle::hasDeparted(), MSBaseVehicle::hasValidRoute(), SUMOVehicleParameter::id, INVALID_DOUBLE_VALUE, GeomHelper::INVALID_OFFSET, MSVehicle::isOnRoad(), MSEdgeWeightsStorage::knowsEffort(), MSEdgeWeightsStorage::knowsTravelTime(), SUMOVehicleParameter::line, max, MIN2(), PositionVector::move2side(), MOVE_TO_XY, GeomHelper::naviDegree(), MSMoveReminder::NOTIFICATION_ARRIVED, MSMoveReminder::NOTIFICATION_TELEPORT, MSMoveReminder::NOTIFICATION_TELEPORT_ARRIVED, MSMoveReminder::NOTIFICATION_VAPORIZED, NUMERICAL_EPS, MSVehicle::onRemovalFromNet(), SUMOVehicleParameter::parseArrivalLane(), SUMOVehicleParameter::parseArrivalPos(), SUMOVehicleParameter::parseArrivalSpeed(), SUMOVehicleParameter::parseDepart(), SUMOVehicleParameter::parseDepartLane(), SUMOVehicleParameter::parseDepartPos(), SUMOVehicleParameter::parseDepartSpeed(), MSEdge::parseEdgesList(), SUMOVehicleParameter::personNumber, POSITION_EPS, TraCIColor::r, tcpip::Storage::readInt(), tcpip::Storage::readString(), TraCIServer::readTypeCheckingByte(), TraCIServer::readTypeCheckingColor(), TraCIServer::readTypeCheckingDouble(), TraCIServer::readTypeCheckingInt(), TraCIServer::readTypeCheckingString(), TraCIServer::readTypeCheckingStringList(), tcpip::Storage::readUnsignedByte(), REMOVE, REMOVE_ARRIVED, REMOVE_PARKING, REMOVE_TELEPORT, REMOVE_TELEPORT_ARRIVED, REMOVE_VAPORIZED, MSEdgeWeightsStorage::removeEffort(), MSEdgeWeightsStorage::removeTravelTime(), MSLane::removeVehicle(), MSVehicle::replaceRoute(), MSBaseVehicle::replaceRouteEdges(), MSVehicle::replaceVehicleType(), MSBaseVehicle::reroute(), TraCI_Vehicle::resume(), PositionVector::rotationAtOffset(), RTYPE_ERR, RTYPE_OK, MSVehicleControl::scheduleVehicleRemoval(), RGBColor::set(), MSBaseVehicle::setChosenSpeedFactor(), MSVehicle::Influencer::setLaneChangeMode(), MSVehicle::Influencer::setLaneTimeLine(), TraCI_Vehicle::setParameter(), SUMOVehicleParameter::setParameter, MSVehicle::Influencer::setSignals(), MSVehicle::Influencer::setSpeedMode(), MSVehicle::Influencer::setSpeedTimeLine(), TraCI_Vehicle::setStop(), MSVehicle::Influencer::setSublaneChange(), MSVehicle::setTentativeLaneAndPosition(), TraCIServerAPI_VehicleType::setVariable(), TraCIServer::setVTDControlled(), SIMTIME, STEPS2TIME, MSBaseVehicle::succEdge(), SUMOTime_MAX, MSVehicle::switchOffSignal(), MSVehicle::switchOnSignal(), toHex(), toString(), SUMOVehicleParameter::toTaz, TYPE_COMPOUND, VAR_ACCEL, VAR_COLOR, VAR_DECEL, VAR_EDGE_EFFORT, VAR_EDGE_TRAVELTIME, VAR_EMISSIONCLASS, VAR_HEIGHT, VAR_IMPERFECTION, VAR_LANECHANGE_MODE, VAR_LATALIGNMENT, VAR_LENGTH, VAR_LINE, VAR_MAXSPEED, VAR_MAXSPEED_LAT, VAR_MINGAP, VAR_MINGAP_LAT, VAR_MOVE_TO, VAR_PARAMETER, VAR_ROUTE, VAR_ROUTE_ID, VAR_SHAPECLASS, VAR_SIGNALS, VAR_SPEED, VAR_SPEED_FACTOR, VAR_SPEEDSETMODE, VAR_TAU, VAR_TYPE, VAR_VEHICLECLASS, VAR_VIA, VAR_WIDTH, VEHPARS_COLOR_SET, SUMOVehicleParameter::via, vtdMap(), vtdMap_matchingRoutePosition(), MSVehicle::willPass(), WRITE_WARNING, TraCIServer::writeErrorStatusCmd(), and TraCIServer::writeStatusCmd().

Referenced by TraCIServer::TraCIServer().

◆ vtdMap()

bool TraCIServerAPI_Vehicle::vtdMap ( const Position pos,
double  maxRouteDistance,
const std::string &  origID,
const double  angle,
MSVehicle v,
TraCIServer server,
double &  bestDistance,
MSLane **  lane,
double &  lanePos,
int &  routeOffset,
ConstMSEdgeVector edges 
)
staticprivate

◆ vtdMap_matchingRoutePosition()

bool TraCIServerAPI_Vehicle::vtdMap_matchingRoutePosition ( const Position pos,
const std::string &  origID,
MSVehicle v,
double &  bestDistance,
MSLane **  lane,
double &  lanePos,
int &  routeOffset,
ConstMSEdgeVector edges 
)
staticprivate

Field Documentation

◆ gVTDMap

std::map< std::string, std::vector< MSLane * > > TraCIServerAPI_Vehicle::gVTDMap
staticprivate

Definition at line 91 of file TraCIServerAPI_Vehicle.h.


The documentation for this class was generated from the following files: