![]() |
SUMO - Simulation of Urban MObility
|
Scope for interaction with vehicles. More...
#include <TraCIAPI.h>
Data Structures | |
struct | NextTLSData |
Public Member Functions | |
void | add (const std::string &vehicleID, const std::string &routeID, const std::string &typeID="DEFAULT_VEHTYPE", std::string depart="-1", const std::string &departLane="first", const std::string &departPos="base", const std::string &departSpeed="0", const std::string &arrivalLane="current", const std::string &arrivalPos="max", const std::string &arrivalSpeed="current", const std::string &fromTaz="", const std::string &toTaz="", const std::string &line="", int personCapacity=0, int personNumber=0) const |
void | changeTarget (const std::string &vehicleID, const std::string &edgeID) const |
double | getAngle (const std::string &vehicleID) const |
double | getCO2Emission (const std::string &vehicleID) const |
double | getCOEmission (const std::string &vehicleID) const |
TraCIColor | getColor (const std::string &vehicleID) const |
std::vector< std::string > | getEdges (const std::string &vehicleID) const |
double | getElectricityConsumption (const std::string &vehicleID) const |
std::string | getEmissionClass (const std::string &vehicleID) const |
double | getFuelConsumption (const std::string &vehicleID) const |
double | getHCEmission (const std::string &vehicleID) const |
int | getIDCount () const |
std::vector< std::string > | getIDList () const |
std::string | getLaneID (const std::string &vehicleID) const |
int | getLaneIndex (const std::string &vehicleID) const |
double | getLanePosition (const std::string &vehicleID) const |
double | getLateralLanePosition (const std::string &vehicleID) const |
std::string | getLine (const std::string &vehicleID) const |
double | getMaxSpeed (const std::string &vehicleID) const |
std::vector< NextTLSData > | getNextTLS (const std::string &vehID) const |
double | getNoiseEmission (const std::string &vehicleID) const |
double | getNOxEmission (const std::string &vehicleID) const |
double | getPMxEmission (const std::string &vehicleID) const |
TraCIPosition | getPosition (const std::string &vehicleID) const |
std::string | getRoadID (const std::string &vehicleID) const |
std::string | getRouteID (const std::string &vehicleID) const |
int | getRouteIndex (const std::string &vehicleID) const |
std::string | getShapeClass (const std::string &vehicleID) const |
int | getSignalStates (const std::string &vehicleID) const |
double | getSlope (const std::string &vehicleID) const |
double | getSpeed (const std::string &vehicleID) const |
int | getSpeedMode (const std::string &vehicleID) const |
std::string | getTypeID (const std::string &vehicleID) const |
std::vector< std::string > | getVia (const std::string &vehicleID) const |
double | getWaitingTime (const std::string &vehicleID) const |
void | moveTo (const std::string &vehicleID, const std::string &laneID, double position) const |
void | moveToXY (const std::string &vehicleID, const std::string &edgeID, const int lane, const double x, const double y, const double angle, const int keepRoute) const |
void | remove (const std::string &vehicleID, char reason=REMOVE_VAPORIZED) const |
void | setColor (const std::string &vehicleID, const TraCIColor &c) const |
void | setEmissionClass (const std::string &vehicleID, const std::string &clazz) const |
void | setLine (const std::string &vehicleID, const std::string &line) const |
void | setMaxSpeed (const std::string &vehicleID, double speed) const |
void | setShapeClass (const std::string &vehicleID, const std::string &clazz) const |
void | setSpeed (const std::string &vehicleID, double speed) const |
void | setVia (const std::string &vehicleID, const std::vector< std::string > &via) const |
void | slowDown (const std::string &vehicleID, double speed, int duration) const |
VehicleScope (TraCIAPI &parent) | |
virtual | ~VehicleScope () |
Protected Attributes | |
TraCIAPI & | myParent |
The parent TraCI client which offers the connection. More... | |
Private Member Functions | |
VehicleScope & | operator= (const VehicleScope &src) |
invalidated assignment operator More... | |
VehicleScope (const VehicleScope &src) | |
invalidated copy constructor More... | |
Scope for interaction with vehicles.
Definition at line 614 of file TraCIAPI.h.
|
inline |
Definition at line 616 of file TraCIAPI.h.
|
inlinevirtual |
Definition at line 617 of file TraCIAPI.h.
|
private |
invalidated copy constructor
void TraCIAPI::VehicleScope::add | ( | const std::string & | vehicleID, |
const std::string & | routeID, | ||
const std::string & | typeID = "DEFAULT_VEHTYPE" , |
||
std::string | depart = "-1" , |
||
const std::string & | departLane = "first" , |
||
const std::string & | departPos = "base" , |
||
const std::string & | departSpeed = "0" , |
||
const std::string & | arrivalLane = "current" , |
||
const std::string & | arrivalPos = "max" , |
||
const std::string & | arrivalSpeed = "current" , |
||
const std::string & | fromTaz = "" , |
||
const std::string & | toTaz = "" , |
||
const std::string & | line = "" , |
||
int | personCapacity = 0 , |
||
int | personNumber = 0 |
||
) | const |
Definition at line 2140 of file TraCIAPI.cpp.
References ADD_FULL, CMD_SET_VEHICLE_VARIABLE, TraCIAPI::toString(), TYPE_COMPOUND, TYPE_INTEGER, TYPE_STRING, tcpip::Storage::writeInt(), tcpip::Storage::writeString(), and tcpip::Storage::writeUnsignedByte().
Referenced by TraCITestClient::testAPI().
void TraCIAPI::VehicleScope::changeTarget | ( | const std::string & | vehicleID, |
const std::string & | edgeID | ||
) | const |
Definition at line 2212 of file TraCIAPI.cpp.
References CMD_CHANGETARGET, CMD_SET_VEHICLE_VARIABLE, TYPE_STRING, tcpip::Storage::writeString(), and tcpip::Storage::writeUnsignedByte().
Referenced by TraCITestClient::testAPI().
double TraCIAPI::VehicleScope::getAngle | ( | const std::string & | vehicleID | ) | const |
Definition at line 1977 of file TraCIAPI.cpp.
References CMD_GET_VEHICLE_VARIABLE, and VAR_ANGLE.
double TraCIAPI::VehicleScope::getCO2Emission | ( | const std::string & | vehicleID | ) | const |
Definition at line 2032 of file TraCIAPI.cpp.
References CMD_GET_VEHICLE_VARIABLE, and VAR_CO2EMISSION.
double TraCIAPI::VehicleScope::getCOEmission | ( | const std::string & | vehicleID | ) | const |
Definition at line 2037 of file TraCIAPI.cpp.
References CMD_GET_VEHICLE_VARIABLE, and VAR_COEMISSION.
TraCIColor TraCIAPI::VehicleScope::getColor | ( | const std::string & | vehicleID | ) | const |
Definition at line 2017 of file TraCIAPI.cpp.
References CMD_GET_VEHICLE_VARIABLE, and VAR_COLOR.
Referenced by TraCITestClient::testAPI().
std::vector< std::string > TraCIAPI::VehicleScope::getEdges | ( | const std::string & | vehicleID | ) | const |
Definition at line 2012 of file TraCIAPI.cpp.
References CMD_GET_VEHICLE_VARIABLE, and VAR_EDGES.
Referenced by TraCITestClient::testAPI().
double TraCIAPI::VehicleScope::getElectricityConsumption | ( | const std::string & | vehicleID | ) | const |
Definition at line 2067 of file TraCIAPI.cpp.
References CMD_GET_VEHICLE_VARIABLE, and VAR_ELECTRICITYCONSUMPTION.
std::string TraCIAPI::VehicleScope::getEmissionClass | ( | const std::string & | vehicleID | ) | const |
Definition at line 2100 of file TraCIAPI.cpp.
References CMD_GET_VEHICLE_VARIABLE, and VAR_EMISSIONCLASS.
double TraCIAPI::VehicleScope::getFuelConsumption | ( | const std::string & | vehicleID | ) | const |
Definition at line 2057 of file TraCIAPI.cpp.
References CMD_GET_VEHICLE_VARIABLE, and VAR_FUELCONSUMPTION.
double TraCIAPI::VehicleScope::getHCEmission | ( | const std::string & | vehicleID | ) | const |
Definition at line 2042 of file TraCIAPI.cpp.
References CMD_GET_VEHICLE_VARIABLE, and VAR_HCEMISSION.
int TraCIAPI::VehicleScope::getIDCount | ( | ) | const |
Definition at line 1957 of file TraCIAPI.cpp.
References CMD_GET_VEHICLE_VARIABLE, and ID_COUNT.
Referenced by TraCITestClient::testAPI().
std::vector< std::string > TraCIAPI::VehicleScope::getIDList | ( | ) | const |
Definition at line 1952 of file TraCIAPI.cpp.
References CMD_GET_VEHICLE_VARIABLE, and ID_LIST.
Referenced by TraCITestClient::testAPI().
std::string TraCIAPI::VehicleScope::getLaneID | ( | const std::string & | vehicleID | ) | const |
Definition at line 1987 of file TraCIAPI.cpp.
References CMD_GET_VEHICLE_VARIABLE, and VAR_LANE_ID.
Referenced by TraCITestClient::testAPI().
int TraCIAPI::VehicleScope::getLaneIndex | ( | const std::string & | vehicleID | ) | const |
Definition at line 1992 of file TraCIAPI.cpp.
References CMD_GET_VEHICLE_VARIABLE, and VAR_LANE_INDEX.
double TraCIAPI::VehicleScope::getLanePosition | ( | const std::string & | vehicleID | ) | const |
Definition at line 2022 of file TraCIAPI.cpp.
References CMD_GET_VEHICLE_VARIABLE, and VAR_LANEPOSITION.
Referenced by TraCITestClient::testAPI().
double TraCIAPI::VehicleScope::getLateralLanePosition | ( | const std::string & | vehicleID | ) | const |
Definition at line 2027 of file TraCIAPI.cpp.
References CMD_GET_VEHICLE_VARIABLE, and VAR_LANEPOSITION_LAT.
Referenced by TraCITestClient::testAPI().
std::string TraCIAPI::VehicleScope::getLine | ( | const std::string & | vehicleID | ) | const |
Definition at line 2090 of file TraCIAPI.cpp.
References CMD_GET_VEHICLE_VARIABLE, and VAR_LINE.
Referenced by TraCITestClient::testAPI().
double TraCIAPI::VehicleScope::getMaxSpeed | ( | const std::string & | vehicleID | ) | const |
Definition at line 1967 of file TraCIAPI.cpp.
References CMD_GET_VEHICLE_VARIABLE, and VAR_MAXSPEED.
Referenced by TraCITestClient::testAPI().
std::vector< TraCIAPI::VehicleScope::NextTLSData > TraCIAPI::VehicleScope::getNextTLS | ( | const std::string & | vehID | ) | const |
Definition at line 2110 of file TraCIAPI.cpp.
References CMD_GET_VEHICLE_VARIABLE, TraCIAPI::VehicleScope::NextTLSData::dist, TraCIAPI::VehicleScope::NextTLSData::id, tcpip::Storage::readByte(), tcpip::Storage::readDouble(), tcpip::Storage::readInt(), tcpip::Storage::readString(), tcpip::Storage::readUnsignedByte(), TraCIAPI::VehicleScope::NextTLSData::state, TraCIAPI::VehicleScope::NextTLSData::tlIndex, TYPE_COMPOUND, and VAR_NEXT_TLS.
Referenced by TraCITestClient::testAPI().
double TraCIAPI::VehicleScope::getNoiseEmission | ( | const std::string & | vehicleID | ) | const |
Definition at line 2062 of file TraCIAPI.cpp.
References CMD_GET_VEHICLE_VARIABLE, and VAR_NOISEEMISSION.
double TraCIAPI::VehicleScope::getNOxEmission | ( | const std::string & | vehicleID | ) | const |
Definition at line 2052 of file TraCIAPI.cpp.
References CMD_GET_VEHICLE_VARIABLE, and VAR_NOXEMISSION.
double TraCIAPI::VehicleScope::getPMxEmission | ( | const std::string & | vehicleID | ) | const |
Definition at line 2047 of file TraCIAPI.cpp.
References CMD_GET_VEHICLE_VARIABLE, and VAR_PMXEMISSION.
TraCIPosition TraCIAPI::VehicleScope::getPosition | ( | const std::string & | vehicleID | ) | const |
Definition at line 1972 of file TraCIAPI.cpp.
References CMD_GET_VEHICLE_VARIABLE, and VAR_POSITION.
std::string TraCIAPI::VehicleScope::getRoadID | ( | const std::string & | vehicleID | ) | const |
Definition at line 1982 of file TraCIAPI.cpp.
References CMD_GET_VEHICLE_VARIABLE, and VAR_ROAD_ID.
Referenced by TraCITestClient::testAPI().
std::string TraCIAPI::VehicleScope::getRouteID | ( | const std::string & | vehicleID | ) | const |
Definition at line 2002 of file TraCIAPI.cpp.
References CMD_GET_VEHICLE_VARIABLE, and VAR_ROAD_ID.
int TraCIAPI::VehicleScope::getRouteIndex | ( | const std::string & | vehicleID | ) | const |
Definition at line 2007 of file TraCIAPI.cpp.
References CMD_GET_VEHICLE_VARIABLE, and VAR_ROUTE_INDEX.
std::string TraCIAPI::VehicleScope::getShapeClass | ( | const std::string & | vehicleID | ) | const |
Definition at line 2105 of file TraCIAPI.cpp.
References CMD_GET_VEHICLE_VARIABLE, and VAR_SHAPECLASS.
Referenced by TraCITestClient::testAPI().
int TraCIAPI::VehicleScope::getSignalStates | ( | const std::string & | vehicleID | ) | const |
double TraCIAPI::VehicleScope::getSlope | ( | const std::string & | vehicleID | ) | const |
Definition at line 2084 of file TraCIAPI.cpp.
References CMD_GET_VEHICLE_VARIABLE, and VAR_SLOPE.
Referenced by TraCITestClient::testAPI().
double TraCIAPI::VehicleScope::getSpeed | ( | const std::string & | vehicleID | ) | const |
Definition at line 1962 of file TraCIAPI.cpp.
References CMD_GET_VEHICLE_VARIABLE, and VAR_SPEED.
int TraCIAPI::VehicleScope::getSpeedMode | ( | const std::string & | vehicleID | ) | const |
Definition at line 2078 of file TraCIAPI.cpp.
References CMD_GET_VEHICLE_VARIABLE, and VAR_SPEEDSETMODE.
Referenced by TraCITestClient::testAPI().
std::string TraCIAPI::VehicleScope::getTypeID | ( | const std::string & | vehicleID | ) | const |
Definition at line 1997 of file TraCIAPI.cpp.
References CMD_GET_VEHICLE_VARIABLE, and VAR_TYPE.
std::vector< std::string > TraCIAPI::VehicleScope::getVia | ( | const std::string & | vehicleID | ) | const |
Definition at line 2095 of file TraCIAPI.cpp.
References CMD_GET_VEHICLE_VARIABLE, and VAR_VIA.
Referenced by TraCITestClient::testAPI().
double TraCIAPI::VehicleScope::getWaitingTime | ( | const std::string & | vehicleID | ) | const |
Definition at line 2072 of file TraCIAPI.cpp.
References CMD_GET_VEHICLE_VARIABLE, and VAR_WAITING_TIME.
Referenced by TraCITestClient::testAPI().
void TraCIAPI::VehicleScope::moveTo | ( | const std::string & | vehicleID, |
const std::string & | laneID, | ||
double | position | ||
) | const |
Definition at line 2222 of file TraCIAPI.cpp.
References CMD_SET_VEHICLE_VARIABLE, TYPE_COMPOUND, TYPE_DOUBLE, TYPE_STRING, VAR_MOVE_TO, tcpip::Storage::writeDouble(), tcpip::Storage::writeInt(), tcpip::Storage::writeString(), and tcpip::Storage::writeUnsignedByte().
void TraCIAPI::VehicleScope::moveToXY | ( | const std::string & | vehicleID, |
const std::string & | edgeID, | ||
const int | lane, | ||
const double | x, | ||
const double | y, | ||
const double | angle, | ||
const int | keepRoute | ||
) | const |
Definition at line 2236 of file TraCIAPI.cpp.
References CMD_SET_VEHICLE_VARIABLE.
Referenced by TraCITestClient::testAPI().
|
private |
invalidated assignment operator
void TraCIAPI::VehicleScope::remove | ( | const std::string & | vehicleID, |
char | reason = REMOVE_VAPORIZED |
||
) | const |
Definition at line 2201 of file TraCIAPI.cpp.
References CMD_SET_VEHICLE_VARIABLE, REMOVE, TYPE_BYTE, and tcpip::Storage::writeUnsignedByte().
Referenced by TraCITestClient::testAPI().
void TraCIAPI::VehicleScope::setColor | ( | const std::string & | vehicleID, |
const TraCIColor & | c | ||
) | const |
Definition at line 2278 of file TraCIAPI.cpp.
References TraCIColor::a, TraCIColor::b, CMD_SET_VEHICLE_VARIABLE, TraCIColor::g, TraCIColor::r, TYPE_COLOR, VAR_COLOR, and tcpip::Storage::writeUnsignedByte().
Referenced by TraCITestClient::testAPI().
void TraCIAPI::VehicleScope::setEmissionClass | ( | const std::string & | vehicleID, |
const std::string & | clazz | ||
) | const |
Definition at line 2326 of file TraCIAPI.cpp.
References CMD_SET_VEHICLE_VARIABLE, TYPE_STRING, VAR_EMISSIONCLASS, tcpip::Storage::writeString(), and tcpip::Storage::writeUnsignedByte().
void TraCIAPI::VehicleScope::setLine | ( | const std::string & | vehicleID, |
const std::string & | line | ||
) | const |
Definition at line 2291 of file TraCIAPI.cpp.
References CMD_SET_VEHICLE_VARIABLE, TYPE_STRING, VAR_LINE, tcpip::Storage::writeString(), and tcpip::Storage::writeUnsignedByte().
Referenced by TraCITestClient::testAPI().
void TraCIAPI::VehicleScope::setMaxSpeed | ( | const std::string & | vehicleID, |
double | speed | ||
) | const |
Definition at line 2268 of file TraCIAPI.cpp.
References CMD_SET_VEHICLE_VARIABLE, TYPE_DOUBLE, VAR_MAXSPEED, tcpip::Storage::writeDouble(), and tcpip::Storage::writeUnsignedByte().
Referenced by TraCITestClient::testAPI().
void TraCIAPI::VehicleScope::setShapeClass | ( | const std::string & | vehicleID, |
const std::string & | clazz | ||
) | const |
Definition at line 2315 of file TraCIAPI.cpp.
References CMD_SET_VEHICLE_VARIABLE, TYPE_STRING, VAR_SHAPECLASS, tcpip::Storage::writeString(), and tcpip::Storage::writeUnsignedByte().
Referenced by TraCITestClient::testAPI().
void TraCIAPI::VehicleScope::setSpeed | ( | const std::string & | vehicleID, |
double | speed | ||
) | const |
Definition at line 2258 of file TraCIAPI.cpp.
References CMD_SET_VEHICLE_VARIABLE, TYPE_DOUBLE, VAR_SPEED, tcpip::Storage::writeDouble(), and tcpip::Storage::writeUnsignedByte().
void TraCIAPI::VehicleScope::setVia | ( | const std::string & | vehicleID, |
const std::vector< std::string > & | via | ||
) | const |
Definition at line 2301 of file TraCIAPI.cpp.
References CMD_SET_VEHICLE_VARIABLE, TYPE_STRINGLIST, VAR_VIA, tcpip::Storage::writeInt(), tcpip::Storage::writeString(), and tcpip::Storage::writeUnsignedByte().
Referenced by TraCITestClient::testAPI().
void TraCIAPI::VehicleScope::slowDown | ( | const std::string & | vehicleID, |
double | speed, | ||
int | duration | ||
) | const |
Definition at line 2244 of file TraCIAPI.cpp.
References CMD_SET_VEHICLE_VARIABLE, CMD_SLOWDOWN, TYPE_COMPOUND, TYPE_DOUBLE, TYPE_INTEGER, tcpip::Storage::writeDouble(), tcpip::Storage::writeInt(), and tcpip::Storage::writeUnsignedByte().
|
protectedinherited |
The parent TraCI client which offers the connection.
Definition at line 131 of file TraCIAPI.h.