41 #define DEFAULT_VIEW "View #0" 44 #define LIBSUMO_SUBSCRIPTION_API \ 45 static void subscribe(const std::string& objID, const std::vector<int>& vars = std::vector<int>(), double beginTime = INVALID_DOUBLE_VALUE, double endTime = INVALID_DOUBLE_VALUE); \ 46 static void subscribeContext(const std::string& objID, int domain, double range, const std::vector<int>& vars = std::vector<int>(), double beginTime = INVALID_DOUBLE_VALUE, double endTime = INVALID_DOUBLE_VALUE); \ 47 static const SubscriptionResults getAllSubscriptionResults(); \ 48 static const TraCIResults getSubscriptionResults(const std::string& objID); \ 49 static const ContextSubscriptionResults getAllContextSubscriptionResults(); \ 50 static const SubscriptionResults getContextSubscriptionResults(const std::string& objID); 52 #define LIBSUMO_SUBSCRIPTION_IMPLEMENTATION(CLASS, DOMAIN) \ 54 CLASS::subscribe(const std::string& objID, const std::vector<int>& vars, double beginTime, double endTime) { \ 55 libsumo::Helper::subscribe(CMD_SUBSCRIBE_##DOMAIN##_VARIABLE, objID, vars, beginTime, endTime); \ 58 CLASS::subscribeContext(const std::string& objID, int domain, double range, const std::vector<int>& vars, double beginTime, double endTime) { \ 59 libsumo::Helper::subscribe(CMD_SUBSCRIBE_##DOMAIN##_CONTEXT, objID, vars, beginTime, endTime, domain, range); \ 61 const SubscriptionResults \ 62 CLASS::getAllSubscriptionResults() { \ 63 return mySubscriptionResults; \ 66 CLASS::getSubscriptionResults(const std::string& objID) { \ 67 return mySubscriptionResults[objID]; \ 69 const ContextSubscriptionResults \ 70 CLASS::getAllContextSubscriptionResults() { \ 71 return myContextSubscriptionResults; \ 73 const SubscriptionResults \ 74 CLASS::getContextSubscriptionResults(const std::string& objID) { \ 75 return myContextSubscriptionResults[objID]; \ 91 : std::runtime_error(what) {}
109 std::ostringstream os;
110 os <<
"TraCIPosition(" << x <<
"," << y <<
"," << z <<
")";
121 std::ostringstream os;
122 os <<
"TraCIRoadPosition(" << edgeID <<
"_" << laneIndex <<
"," << pos <<
")";
135 std::ostringstream os;
136 os <<
"TraCIColor(" << r <<
"," << g <<
"," << b <<
"," << a <<
")";
139 unsigned char r, g, b, a;
152 std::ostringstream os;
164 std::ostringstream os;
184 std::ostringstream os;
186 for (std::string v : value) {
206 TraCIPhase(
const double _duration,
const double _duration1,
const double _duration2,
const std::string& _phase)
207 : duration(_duration), duration1(_duration1), duration2(_duration2), phase(_phase) {}
218 TraCILogic(
const std::string& _subID,
int _type,
int _currentPhaseIndex,
const std::vector<TraCIPhase>& _phases = std::vector<TraCIPhase>())
219 : subID(_subID), type(_type), currentPhaseIndex(_currentPhaseIndex), phases(_phases) {}
232 TraCILink(
const std::string& _from,
const std::string& _via,
const std::string& _to)
233 : fromLane(_from), viaLane(_via), toLane(_to) {}
244 TraCIConnection(
const std::string& _approachedLane,
const bool _hasPrio,
const bool _isOpen,
const bool _hasFoe,
245 const std::string _approachedInternal,
const std::string _state,
const std::string _direction,
const double _length)
246 : approachedLane(_approachedLane), hasPrio(_hasPrio), isOpen(_isOpen), hasFoe(_hasFoe),
247 approachedInternal(_approachedInternal), state(_state), direction(_direction), length(_length) {}
std::map< std::string, TraCIResults > SubscriptionResults
{object->{variable->value}}
TraCILogic(const std::string &_subID, int _type, int _currentPhaseIndex, const std::vector< TraCIPhase > &_phases=std::vector< TraCIPhase >())
std::string id
The id of the next tls.
int type
The type of stage (walking, driving, ...)
double leaveTime
Leave-time of the vehicle in [s].
double dist
The distance to the tls.
bool allowsContinuation
Whether this lane allows continuing the route.
std::string line
The line or the id of the vehicle type.
std::string typeID
Type of the vehicle in.
double until
The time at which the vehicle may continue its journey.
An edgeId, position and laneIndex.
mirrors MSInductLoop::VehicleData
TraCILink(const std::string &_from, const std::string &_via, const std::string &_to)
std::string destStop
The id of the destination stop.
std::map< int, std::shared_ptr< TraCIResult > > TraCIResults
{variable->value}
double occupation
The traffic density along length.
TraCIPhase(const double _duration, const double _duration1, const double _duration2, const std::string &_phase)
std::string laneID
The id of the lane.
std::map< std::string, std::string > subParameter
std::map< std::string, SubscriptionResults > ContextSubscriptionResults
TraCIConnection(const std::string &_approachedLane, const bool _hasPrio, const bool _isOpen, const bool _hasFoe, const std::string _approachedInternal, const std::string _state, const std::string _direction, const double _length)
double depart
intended depart time for public transport ride or -1
std::vector< TraCIPhase > phases
int bestLaneOffset
The offset of this lane from the best lane.
virtual std::string getString()
std::string approachedInternal
std::string stoppingPlaceID
Id assigned to the stop.
std::vector< std::string > edges
The sequence of edges to travel.
double length
Length of the vehicle.
std::string id
The id of the vehicle.
double endPos
The stopping position end.
std::string approachedLane
std::vector< std::string > value
std::vector< TraCIPosition > TraCIPositionVector
char state
The current state of the tls.
double travelTime
duration of the stage
TraCIException(std::string what)
double length
The length than can be driven from that lane without lane change.
std::string intended
id of the intended vehicle for public transport ride
double entryTime
Entry-time of the vehicle in [s].
TraCIString(std::string v)
int tlIndex
The tls index of the controlled link.
double duration
The stopping duration.
std::vector< std::string > continuationLanes
The sequence of lanes that best allows continuing the route without lane change.
std::string lane
The lane to stop at.