ad_rss_map_integration
RssObjectAdapterData.hpp
Go to the documentation of this file.
1 /*
2  * ----------------- BEGIN LICENSE BLOCK ---------------------------------
3  *
4  * Copyright (C) 2018-2022 Intel Corporation
5  *
6  * SPDX-License-Identifier: LGPL-2.1-only
7  *
8  * ----------------- END LICENSE BLOCK -----------------------------------
9  */
10 
18 #pragma once
19 
20 #include <iostream>
21 #include <limits>
22 #include <memory>
23 #include <sstream>
24 #include "ad/map/point/ENUHeading.hpp"
25 #include "ad/map/point/ENUPoint.hpp"
26 #include "ad/physics/Angle.hpp"
27 #include "ad/physics/AngularVelocity.hpp"
28 #include "ad/physics/Dimension2D.hpp"
29 #include "ad/physics/Dimension3D.hpp"
30 #include "ad/physics/Probability.hpp"
31 #include "ad/physics/SpeedRange.hpp"
32 #include "ad/rss/world/ObjectId.hpp"
33 #include "ad/rss/world/ObjectType.hpp"
34 
38 namespace ad {
42 namespace rss {
46 namespace map {
47 
54 {
58  typedef std::shared_ptr<RssObjectAdapterData> Ptr;
59 
63  typedef std::shared_ptr<RssObjectAdapterData const> ConstPtr;
64 
69  {
70  // initialize confidence to 'ground truth' while 0.01 is the minimum what ETSI defines for smalles valid value
71  // SemiAxisLength in ETSI-ITS-CDD.asn standard message descriptions, a value of zero shall not be used
72  position_confidence_ellipse_half_axis_dimension.length = ad::physics::Distance(0.01);
73  position_confidence_ellipse_half_axis_dimension.width = ad::physics::Distance(0.01);
74  position_confidence_ellipse_confidence_level = ad::physics::Probability(1.);
75  }
76 
80  virtual ~RssObjectAdapterData() = default;
81 
85  RssObjectAdapterData(const RssObjectAdapterData &other) = default;
86 
91 
100 
109 
117  bool operator==(const RssObjectAdapterData &other) const
118  {
119  return (id == other.id) && (object_type == other.object_type) && (center_point == other.center_point)
120  && (position_confidence_ellipse_half_axis_dimension == other.position_confidence_ellipse_half_axis_dimension)
121  && (position_confidence_ellipse_confidence_level == other.position_confidence_ellipse_confidence_level)
122  && (heading == other.heading) && (dimension == other.dimension) && (speed_range == other.speed_range)
123  && (yaw_rate == other.yaw_rate) && (steering_angle == other.steering_angle);
124  }
125 
133  bool operator!=(const RssObjectAdapterData &other) const
134  {
135  return !operator==(other);
136  }
137 
140  ::ad::rss::world::ObjectId getObjectId() const
141  {
142  return id;
143  }
144 
147  ::ad::rss::world::ObjectType getObjectType() const
148  {
149  return object_type;
150  }
151 
154  ::ad::map::point::ENUPoint getCenterPoint() const
155  {
156  return center_point;
157  }
158 
161  ::ad::physics::Dimension2D getPositionConfidence() const
162  {
163  return position_confidence_ellipse_half_axis_dimension;
164  }
165 
168  ::ad::physics::Probability getPositionConfidenceLevel() const
169  {
170  return position_confidence_ellipse_confidence_level;
171  }
172 
175  ::ad::map::point::ENUHeading getHeading() const
176  {
177  return heading;
178  }
179 
182  virtual ::ad::physics::Dimension3D getDimensions() const
183  {
184  return dimension;
185  }
186 
189  ::ad::physics::SpeedRange getSpeedRange() const
190  {
191  return speed_range;
192  }
193 
196  ::ad::physics::AngularVelocity getYawRate() const
197  {
198  return yaw_rate;
199  }
200 
203  ::ad::physics::Angle getSteeringAngle() const
204  {
205  return steering_angle;
206  }
207 
211  ::ad::rss::world::ObjectId id{0};
212 
216  ::ad::rss::world::ObjectType object_type{::ad::rss::world::ObjectType::Invalid};
217 
221  ::ad::map::point::ENUPoint center_point;
222 
223  // Indicates the position confidence value which represents the estimated absolute position accuracy, in the
224  // respective axis direction as defined in a shape of ellipse with a confidence level of
225  // mPositionConfidenceEllipseConfidence. the value represents the half axis length and is added to the respective
226  // vehicle dimensions in RSS calcualation
227  ::ad::physics::Dimension2D position_confidence_ellipse_half_axis_dimension;
228  ::ad::physics::Probability position_confidence_ellipse_confidence_level;
229 
233  ::ad::map::point::ENUHeading heading{std::numeric_limits<double>::quiet_NaN()};
234 
238  ::ad::physics::Dimension3D dimension;
239 
243  ::ad::physics::SpeedRange speed_range;
244 
248  ::ad::physics::AngularVelocity yaw_rate;
249 
258  ::ad::physics::Angle steering_angle{std::numeric_limits<double>::quiet_NaN()};
259 };
260 
261 } // namespace map
262 } // namespace rss
263 } // namespace ad
264 
268 #ifndef GEN_GUARD_AD_RSS_MAP_RSSObjectAdapterData
269 #define GEN_GUARD_AD_RSS_MAP_RSSObjectAdapterData
273 namespace ad {
277 namespace rss {
281 namespace map {
282 
292 inline std::ostream &operator<<(std::ostream &os, RssObjectAdapterData const &_value)
293 {
294  os << "RssObjectAdapterData(";
295  os << "id:";
296  os << _value.id;
297  os << ",";
298  os << "object_type:";
299  os << _value.object_type;
300  os << ",";
301  os << "center_point:";
302  os << _value.center_point;
303  os << ",";
304  os << "center_point_confidence:";
305  os << _value.position_confidence_ellipse_half_axis_dimension;
306  os << ",";
307  os << "center_point_confidence_level:";
308  os << _value.position_confidence_ellipse_confidence_level;
309  os << ",";
310  os << "heading:";
311  os << _value.heading;
312  os << ",";
313  os << "dimension:";
314  os << _value.dimension;
315  os << ",";
316  os << "speed_range:";
317  os << _value.speed_range;
318  os << ",";
319  os << "yaw_rate:";
320  os << _value.yaw_rate;
321  os << ",";
322  os << "steering_angle:";
323  os << _value.steering_angle;
324  os << ")";
325  return os;
326 }
327 
328 } // namespace map
329 } // namespace rss
330 } // namespace ad
331 
332 namespace std {
336 inline std::string to_string(::ad::rss::map::RssObjectAdapterData const &value)
337 {
338  stringstream sstream;
339  sstream << value;
340  return sstream.str();
341 }
342 } // namespace std
343 
347 template <> struct fmt::formatter<::ad::rss::map::RssObjectAdapterData> : formatter<string_view>
348 {
349  template <typename FormatContext> auto format(::ad::rss::map::RssObjectAdapterData const &value, FormatContext &ctx)
350  {
351  return formatter<string_view>::format(std::to_string(value), ctx);
352  }
353 };
354 #endif // GEN_GUARD_AD_RSS_MAP_RSSObjectAdapterData
std::string to_string(::ad::rss::map::RouteAccelerations const &value)
overload of the std::to_string for RouteAccelerations
Definition: RouteAccelerations.hpp:229
std::ostream & operator<<(std::ostream &os, RouteAccelerations const &_value)
standard ostream operator
Definition: RouteAccelerations.hpp:194
namespace ad
Definition: RouteAccelerations.hpp:33
DataType RssObjectAdapterData.
Definition: RssObjectAdapterData.hpp:54
virtual ~RssObjectAdapterData()=default
standard destructor
::ad::physics::Dimension2D getPositionConfidence() const
get the position confidence of the center point
Definition: RssObjectAdapterData.hpp:161
::ad::physics::Angle steering_angle
Definition: RssObjectAdapterData.hpp:258
::ad::rss::world::ObjectId getObjectId() const
get the id of the object
Definition: RssObjectAdapterData.hpp:140
RssObjectAdapterData & operator=(const RssObjectAdapterData &other)=default
standard assignment operator
RssObjectAdapterData & operator=(RssObjectAdapterData &&other)=default
standard move operator
::ad::map::point::ENUHeading getHeading() const
get the heading of the object
Definition: RssObjectAdapterData.hpp:175
virtual ::ad::physics::Dimension3D getDimensions() const
get the dimensions of the object to be considered
Definition: RssObjectAdapterData.hpp:182
::ad::physics::AngularVelocity getYawRate() const
get the change of the heading (which is the yaw rate) of the object
Definition: RssObjectAdapterData.hpp:196
bool operator==(const RssObjectAdapterData &other) const
standard comparison operator
Definition: RssObjectAdapterData.hpp:117
bool operator!=(const RssObjectAdapterData &other) const
standard comparison operator
Definition: RssObjectAdapterData.hpp:133
::ad::rss::world::ObjectType getObjectType() const
get the type of the object
Definition: RssObjectAdapterData.hpp:147
::ad::physics::SpeedRange speed_range
Definition: RssObjectAdapterData.hpp:243
RssObjectAdapterData(const RssObjectAdapterData &other)=default
standard copy constructor
::ad::map::point::ENUHeading heading
Definition: RssObjectAdapterData.hpp:233
::ad::physics::Dimension3D dimension
Definition: RssObjectAdapterData.hpp:238
::ad::rss::world::ObjectType object_type
Definition: RssObjectAdapterData.hpp:216
::ad::physics::SpeedRange getSpeedRange() const
get the speed of the object
Definition: RssObjectAdapterData.hpp:189
std::shared_ptr< RssObjectAdapterData > Ptr
Smart pointer on RssObjectAdapterData.
Definition: RssObjectAdapterData.hpp:58
::ad::map::point::ENUPoint center_point
Definition: RssObjectAdapterData.hpp:221
RssObjectAdapterData()
standard constructor
Definition: RssObjectAdapterData.hpp:68
RssObjectAdapterData(RssObjectAdapterData &&other)=default
standard move constructor
::ad::physics::Angle getSteeringAngle() const
get the steering angle of the vehicle. Might be invalid if not available.
Definition: RssObjectAdapterData.hpp:203
::ad::map::point::ENUPoint getCenterPoint() const
get the center point of the object
Definition: RssObjectAdapterData.hpp:154
::ad::rss::world::ObjectId id
Definition: RssObjectAdapterData.hpp:211
std::shared_ptr< RssObjectAdapterData const > ConstPtr
Smart pointer on constant RssObjectAdapterData.
Definition: RssObjectAdapterData.hpp:63
::ad::physics::Probability getPositionConfidenceLevel() const
get the position confidence level of the center point
Definition: RssObjectAdapterData.hpp:168
::ad::physics::AngularVelocity yaw_rate
Definition: RssObjectAdapterData.hpp:248