SUMO - Simulation of Urban MObility
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-2017 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 "TraCIDefs.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 MSVehicleType& getSingularType(SUMOVehicle* const veh);
81 
82 
83  static bool vtdMap(const Position& pos, double maxRouteDistance, const std::string& origID, const double angle, MSVehicle& v, TraCIServer& server,
84  double& bestDistance, MSLane** lane, double& lanePos, int& routeOffset, ConstMSEdgeVector& edges);
85 
86  static bool vtdMap_matchingRoutePosition(const Position& pos, const std::string& origID, MSVehicle& v,
87  double& bestDistance, MSLane** lane, double& lanePos, int& routeOffset, ConstMSEdgeVector& edges);
88 
89  static bool findCloserLane(const MSEdge* edge, const Position& pos, double& bestDistance, MSLane** lane);
90 
91  static std::map<std::string, std::vector<MSLane*> > gVTDMap;
92 
93 
94  class LaneUtility {
95  public:
96  LaneUtility(double dist_, double angleDiff_, bool ID_, bool onRoute_, bool sameEdge_, const MSEdge* prevEdge_, const MSEdge* nextEdge_) :
97  dist(dist_), angleDiff(angleDiff_), ID(ID_), onRoute(onRoute_), sameEdge(sameEdge_), prevEdge(prevEdge_), nextEdge(nextEdge_) {}
100 
101  double dist;
102  double angleDiff;
103  bool ID;
104  bool onRoute;
105  bool sameEdge;
106  const MSEdge* prevEdge;
107  const MSEdge* nextEdge;
108  };
109 
110 
111 private:
114 
117 
118 
119 };
120 
121 
122 #endif
123 
124 #endif
125 
126 /****************************************************************************/
APIs for getting/setting vehicle values via TraCI.
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:83
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)
LaneUtility(double dist_, double angleDiff_, bool ID_, bool onRoute_, bool sameEdge_, const MSEdge *prevEdge_, const MSEdge *nextEdge_)
TraCIServerAPI_Vehicle & operator=(const TraCIServerAPI_Vehicle &s)
invalidated assignment operator
static bool getPosition(const std::string &id, Position &p)
Returns the named vehicle&#39;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:67
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:46
static bool vtdMap_matchingRoutePosition(const Position &pos, const std::string &origID, MSVehicle &v, double &bestDistance, MSLane **lane, double &lanePos, int &routeOffset, ConstMSEdgeVector &edges)
TraCI server used to control sumo by a remote TraCI client.
Definition: TraCIServer.h:74
TraCIServerAPI_Vehicle(const TraCIServerAPI_Vehicle &s)
invalidated copy constructor
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 findCloserLane(const MSEdge *edge, const Position &pos, double &bestDistance, MSLane **lane)
Representation of a lane in the micro simulation.
Definition: MSLane.h:79