SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
TraCIServerAPI_Vehicle.h
Go to the documentation of this file.
1 /****************************************************************************/
8 // APIs for getting/setting vehicle values via TraCI
9 /****************************************************************************/
10 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
11 // Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors
12 /****************************************************************************/
13 //
14 // This file is part of SUMO.
15 // SUMO is free software: you can redistribute it and/or modify
16 // it under the terms of the GNU General Public License as published by
17 // the Free Software Foundation, either version 3 of the License, or
18 // (at your option) any later version.
19 //
20 /****************************************************************************/
21 #ifndef TraCIServerAPI_Vehicle_h
22 #define TraCIServerAPI_Vehicle_h
23 
24 
25 // ===========================================================================
26 // included modules
27 // ===========================================================================
28 #ifdef _MSC_VER
29 #include <windows_config.h>
30 #else
31 #include <config.h>
32 #endif
33 
34 #ifndef NO_TRACI
35 
36 #include "TraCIException.h"
38 #include "TraCIServer.h"
39 #include <foreign/tcpip/storage.h>
40 
41 
42 // ===========================================================================
43 // class definitions
44 // ===========================================================================
50 public:
57  static bool processGet(TraCIServer& server, tcpip::Storage& inputStorage,
58  tcpip::Storage& outputStorage);
59 
60 
67  static bool processSet(TraCIServer& server, tcpip::Storage& inputStorage,
68  tcpip::Storage& outputStorage);
69 
70 
76  static bool getPosition(const std::string& id, Position& p);
77 
78 
79 private:
80  static bool commandDistanceRequest(TraCIServer& server, tcpip::Storage& inputStorage,
81  tcpip::Storage& outputStorage, const MSVehicle* v);
82 
83  static MSVehicleType& getSingularType(SUMOVehicle* const veh);
84 
85 
86  static const std::map<std::string, std::vector<MSLane*> >& getOrBuildVTDMap();
87  static bool vtdMap(const Position& pos, SUMOReal maxRouteDistance, const std::string& origID, const SUMOReal angle, MSVehicle& v, TraCIServer& server,
88  SUMOReal& bestDistance, MSLane** lane, SUMOReal& lanePos, int& routeOffset, ConstMSEdgeVector& edges);
89 
90  static bool vtdMap_matchingRoutePosition(const Position& pos, const std::string& origID, MSVehicle& v,
91  SUMOReal& bestDistance, MSLane** lane, SUMOReal& lanePos, int& routeOffset, ConstMSEdgeVector& edges);
92 
93  static bool findCloserLane(const MSEdge* edge, const Position& pos, SUMOReal& bestDistance, MSLane** lane);
94 
95  static std::map<std::string, std::vector<MSLane*> > gVTDMap;
96 
97 
98  class LaneUtility {
99  public:
100  LaneUtility(SUMOReal dist_, SUMOReal angleDiff_, bool ID_, bool onRoute_, bool sameEdge_, const MSEdge* prevEdge_, const MSEdge* nextEdge_) :
101  dist(dist_), angleDiff(angleDiff_), ID(ID_), onRoute(onRoute_), sameEdge(sameEdge_), prevEdge(prevEdge_), nextEdge(nextEdge_) {}
104 
107  bool ID;
108  bool onRoute;
109  bool sameEdge;
110  const MSEdge* prevEdge;
111  const MSEdge* nextEdge;
112  };
113 
114 
115 private:
118 
121 
122 
123 };
124 
125 
126 #endif
127 
128 #endif
129 
130 /****************************************************************************/
APIs for getting/setting vehicle values via TraCI.
static bool commandDistanceRequest(TraCIServer &server, tcpip::Storage &inputStorage, tcpip::Storage &outputStorage, const MSVehicle *v)
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:82
static MSVehicleType & getSingularType(SUMOVehicle *const veh)
static std::map< std::string, std::vector< MSLane * > > gVTDMap
static bool processSet(TraCIServer &server, tcpip::Storage &inputStorage, tcpip::Storage &outputStorage)
Processes a set value command (Command 0xc4: Change Vehicle State)
static bool vtdMap(const Position &pos, SUMOReal maxRouteDistance, const std::string &origID, const SUMOReal angle, MSVehicle &v, TraCIServer &server, SUMOReal &bestDistance, MSLane **lane, SUMOReal &lanePos, int &routeOffset, ConstMSEdgeVector &edges)
TraCIServerAPI_Vehicle & operator=(const TraCIServerAPI_Vehicle &s)
invalidated assignment operator
static bool getPosition(const std::string &id, Position &p)
Returns the named vehicle's position.
std::vector< const MSEdge * > ConstMSEdgeVector
Definition: MSEdge.h:78
The car-following model and parameter.
Definition: MSVehicleType.h:74
static bool processGet(TraCIServer &server, tcpip::Storage &inputStorage, tcpip::Storage &outputStorage)
Processes a get value command (Command 0xa4: Get Vehicle Variable)
A road/street connecting two junctions.
Definition: MSEdge.h:80
Representation of a vehicle.
Definition: SUMOVehicle.h:66
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:46
TraCI server used to control sumo by a remote TraCI client.
Definition: TraCIServer.h:73
static bool findCloserLane(const MSEdge *edge, const Position &pos, SUMOReal &bestDistance, MSLane **lane)
TraCIServerAPI_Vehicle(const TraCIServerAPI_Vehicle &s)
invalidated copy constructor
LaneUtility(SUMOReal dist_, SUMOReal angleDiff_, bool ID_, bool onRoute_, bool sameEdge_, const MSEdge *prevEdge_, const MSEdge *nextEdge_)
#define SUMOReal
Definition: config.h:214
static const std::map< std::string, std::vector< MSLane * > > & getOrBuildVTDMap()
Representation of a lane in the micro simulation.
Definition: MSLane.h:79
static bool vtdMap_matchingRoutePosition(const Position &pos, const std::string &origID, MSVehicle &v, SUMOReal &bestDistance, MSLane **lane, SUMOReal &lanePos, int &routeOffset, ConstMSEdgeVector &edges)