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 bool vtdMap(const Position& pos, double maxRouteDistance, bool mayLeaveNetwork, const std::string& origID, const double angle, MSVehicle& v, TraCIServer& server,
81  double& bestDistance, MSLane** lane, double& lanePos, int& routeOffset, ConstMSEdgeVector& edges);
82 
83  static bool vtdMap_matchingRoutePosition(const Position& pos, const std::string& origID, MSVehicle& v,
84  double& bestDistance, MSLane** lane, double& lanePos, int& routeOffset, ConstMSEdgeVector& edges);
85 
86  static bool findCloserLane(const MSEdge* edge, const Position& pos, double& bestDistance, MSLane** lane);
87 
88  static std::map<std::string, std::vector<MSLane*> > gVTDMap;
89 
90 
91  class LaneUtility {
92  public:
93  LaneUtility(double dist_, double perpendicularDist_, double lanePos_, double angleDiff_, bool ID_,
94  bool onRoute_, bool sameEdge_, const MSEdge* prevEdge_, const MSEdge* nextEdge_) :
95  dist(dist_), perpendicularDist(perpendicularDist_), lanePos(lanePos_), angleDiff(angleDiff_), ID(ID_),
96  onRoute(onRoute_), sameEdge(sameEdge_), prevEdge(prevEdge_), nextEdge(nextEdge_) {}
99 
100  double dist;
102  double lanePos;
103  double angleDiff;
104  bool ID;
105  bool onRoute;
106  bool sameEdge;
107  const MSEdge* prevEdge;
108  const MSEdge* nextEdge;
109  };
110 
111 
112 private:
115 
118 
119 
120 };
121 
122 
123 #endif
124 
125 #endif
126 
127 /****************************************************************************/
APIs for getting/setting vehicle values via TraCI.
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:83
static std::map< std::string, std::vector< MSLane * > > gVTDMap
LaneUtility(double dist_, double perpendicularDist_, double lanePos_, double angleDiff_, bool ID_, bool onRoute_, bool sameEdge_, const MSEdge *prevEdge_, const MSEdge *nextEdge_)
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&#39;s position.
std::vector< const MSEdge * > ConstMSEdgeVector
Definition: MSEdge.h:79
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
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, bool mayLeaveNetwork, 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