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-2015 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, 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 std::map<std::string, std::vector<MSLane*> > gVTDMap;
91 
92 
93  class LaneUtility {
94  public:
95  LaneUtility(SUMOReal dist_, SUMOReal angleDiff_, bool ID_, bool onRoute_, bool sameEdge_, const MSEdge* prevEdge_, const MSEdge* nextEdge_) :
96  dist(dist_), angleDiff(angleDiff_), ID(ID_), onRoute(onRoute_), sameEdge(sameEdge_), prevEdge(prevEdge_), nextEdge(nextEdge_) {}
99 
102  bool ID;
103  bool onRoute;
104  bool sameEdge;
105  const MSEdge* prevEdge;
106  const MSEdge* nextEdge;
107  };
108 
109 
110 private:
113 
116 
117 
118 };
119 
120 
121 #endif
122 
123 #endif
124 
125 /****************************************************************************/
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:80
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)
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:79
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:81
static bool vtdMap(const Position &pos, const std::string &origID, const SUMOReal angle, MSVehicle &v, TraCIServer &server, SUMOReal &bestDistance, MSLane **lane, SUMOReal &lanePos, int &routeOffset, ConstMSEdgeVector &edges)
Representation of a vehicle.
Definition: SUMOVehicle.h:65
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:74
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:218
static const std::map< std::string, std::vector< MSLane * > > & getOrBuildVTDMap()
Representation of a lane in the micro simulation.
Definition: MSLane.h:77