CARLA
Signal.h
Go to the documentation of this file.
1 // Copyright (c) 2020 Computer Vision Center (CVC) at the Universitat Autonoma
2 // de Barcelona (UAB).
3 //
4 // This work is licensed under the terms of the MIT license.
5 // For a copy; see <https://opensource.org/licenses/MIT>.
6 
7 #pragma once
8 
9 #include "carla/Memory.h"
10 #include "carla/NonCopyable.h"
11 #include "carla/road/RoadTypes.h"
13 #include "carla/geom/Transform.h"
14 
15 #include <string>
16 #include <vector>
17 
18 namespace carla {
19 namespace road {
20 
25  };
26 
28  public:
29 
30  SignalDependency( std::string dependency_id, std::string type)
31  : _dependency_id(dependency_id), _type(type) {}
32 
33  std::string _dependency_id;
34 
35  std::string _type;
36 
37  };
38 
39  class Signal : private MovableNonCopyable {
40  public:
42  RoadId road_id,
43  SignId signal_id,
44  double s,
45  double t,
46  std::string name,
47  std::string dynamic,
48  std::string orientation,
49  double zOffset,
50  std::string country,
51  std::string type,
52  std::string subtype,
53  double value,
54  std::string unit,
55  double height,
56  double width,
57  std::string text,
58  double hOffset,
59  double pitch,
60  double roll)
61  : _road_id(road_id),
62  _signal_id(signal_id),
63  _s(s),
64  _t(t),
65  _name(name),
66  _dynamic(dynamic),
67  _orientation(orientation),
68  _zOffset(zOffset),
69  _country(country),
70  _type(type),
71  _subtype(subtype),
72  _value(value),
73  _unit(unit),
74  _height(height),
75  _width(width),
76  _text(text),
77  _hOffset(hOffset),
78  _pitch(pitch),
79  _roll(roll) {}
80 
81  RoadId GetRoadId() const {
82  return _road_id;
83  }
84 
85  const SignId &GetSignalId() const {
86  return _signal_id;
87  }
88 
89  double GetS() const {
90  return _s;
91  }
92 
93  double GetT() const {
94  return _t;
95  }
96 
97  bool GetDynamic() const {
98  if(_dynamic == "yes") {
99  return true;
100  }else {
101  return false;
102  }
103  }
104 
105  const std::string &GetName() const {
106  return _name;
107  }
108 
110  if(_orientation == "+") {
112  } else if(_orientation == "-") {
114  } else {
116  }
117  }
118 
119  double GetZOffset() const {
120  return _zOffset;
121  }
122 
123  const std::string &GetCountry() const {
124  return _country;
125  }
126 
127  const std::string &GetType() const {
128  return _type;
129  }
130 
131  const std::string &GetSubtype() const {
132  return _subtype;
133  }
134 
135  double GetValue() const {
136  return _value;
137  }
138 
139  const std::string &GetUnit() const {
140  return _unit;
141  }
142 
143  double GetHeight() const {
144  return _height;
145  }
146 
147  double GetWidth() const {
148  return _width;
149  }
150 
151  const std::string &GetText() const {
152  return _text;
153  }
154 
155  double GetHOffset() const {
156  return _hOffset;
157  }
158 
159  double GetPitch() const {
160  return _pitch;
161  }
162 
163  double GetRoll() const {
164  return _roll;
165  }
166 
167  const std::vector<SignalDependency> &
169  return _dependencies;
170  }
171 
172  const geom::Transform &GetTransform() const {
173  return _transform;
174  }
175 
176  const std::set<ContId>& GetControllers() const {
177  return _controllers;
178  }
179 
180  private:
181  friend MapBuilder;
182 
184 
186 
187  double _s;
188 
189  double _t;
190 
191  std::string _name;
192 
193  std::string _dynamic;
194 
195  std::string _orientation;
196 
197  double _zOffset;
198 
199  std::string _country;
200 
201  std::string _type;
202 
203  std::string _subtype;
204 
205  double _value;
206 
207  std::string _unit;
208 
209  double _height;
210 
211  double _width;
212 
213  std::string _text;
214 
215  double _hOffset;
216 
217  double _pitch;
218 
219  double _roll;
220 
221  std::vector<SignalDependency> _dependencies;
222 
224 
225  std::set<ContId> _controllers;
226 
227  bool _using_inertial_position = false;
228  };
229 
230 } // road
231 } // carla
std::string SignId
Definition: RoadTypes.h:25
friend MapBuilder
Definition: Signal.h:181
uint32_t RoadId
Definition: RoadTypes.h:15
const std::string & GetUnit() const
Definition: Signal.h:139
double GetHOffset() const
Definition: Signal.h:155
double GetValue() const
Definition: Signal.h:135
std::string _type
Definition: Signal.h:201
double GetT() const
Definition: Signal.h:93
const SignId & GetSignalId() const
Definition: Signal.h:85
SignalOrientation
Definition: Signal.h:21
std::string _name
Definition: Signal.h:191
std::string _text
Definition: Signal.h:213
std::string _dependency_id
Definition: Signal.h:33
std::vector< SignalDependency > _dependencies
Definition: Signal.h:221
SignId _signal_id
Definition: Signal.h:185
This file contains definitions of common data structures used in traffic manager. ...
Definition: Carla.cpp:133
double GetZOffset() const
Definition: Signal.h:119
RoadId GetRoadId() const
Definition: Signal.h:81
const std::string & GetText() const
Definition: Signal.h:151
Inherit (privately) to suppress copy construction and assignment.
const std::vector< SignalDependency > & GetDependencies()
Definition: Signal.h:168
std::string _subtype
Definition: Signal.h:203
const std::string & GetType() const
Definition: Signal.h:127
const std::set< ContId > & GetControllers() const
Definition: Signal.h:176
geom::Transform _transform
Definition: Signal.h:223
std::string _unit
Definition: Signal.h:207
Signal(RoadId road_id, SignId signal_id, double s, double t, std::string name, std::string dynamic, std::string orientation, double zOffset, std::string country, std::string type, std::string subtype, double value, std::string unit, double height, double width, std::string text, double hOffset, double pitch, double roll)
Definition: Signal.h:41
bool GetDynamic() const
Definition: Signal.h:97
std::string _dynamic
Definition: Signal.h:193
double GetPitch() const
Definition: Signal.h:159
const geom::Transform & GetTransform() const
Definition: Signal.h:172
const std::string & GetName() const
Definition: Signal.h:105
SignalDependency(std::string dependency_id, std::string type)
Definition: Signal.h:30
std::string _country
Definition: Signal.h:199
double GetWidth() const
Definition: Signal.h:147
const std::string & GetSubtype() const
Definition: Signal.h:131
double GetRoll() const
Definition: Signal.h:163
const std::string & GetCountry() const
Definition: Signal.h:123
std::string _orientation
Definition: Signal.h:195
double GetHeight() const
Definition: Signal.h:143
std::set< ContId > _controllers
Definition: Signal.h:225
SignalOrientation GetOrientation() const
Definition: Signal.h:109
double GetS() const
Definition: Signal.h:89