ad_rss
ObjectStateValidInputRange.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 <cmath>
21 #include <limits>
22 #include "ad/physics/AngleValidInputRange.hpp"
23 #include "ad/physics/AngularVelocityValidInputRange.hpp"
24 #include "ad/physics/Dimension2DValidInputRange.hpp"
25 #include "ad/physics/Distance2DValidInputRange.hpp"
26 #include "ad/physics/SpeedRangeValidInputRange.hpp"
28 #include "spdlog/fmt/ostr.h"
29 #include "spdlog/spdlog.h"
30 
41 inline bool withinValidInputRange(::ad::rss::world::ObjectState const &input, bool const logErrors = true)
42 {
43  // check for generic member input ranges
44  bool inValidInputRange = true;
45  inValidInputRange = withinValidInputRange(input.yaw, logErrors) && withinValidInputRange(input.dimension, logErrors)
46  && withinValidInputRange(input.yaw_rate, logErrors) && withinValidInputRange(input.center_point, logErrors)
47  && withinValidInputRange(input.speed_range, logErrors) && withinValidInputRange(input.steering_angle, logErrors);
48  if (!inValidInputRange && logErrors)
49  {
50  spdlog::error("withinValidInputRange(::ad::rss::world::ObjectState)>> {} has invalid member",
51  input); // LCOV_EXCL_BR_LINE
52  }
53 
54  return inValidInputRange;
55 }
bool withinValidInputRange(::ad::rss::world::ObjectState const &input, bool const logErrors=true)
check if the given ObjectState is within valid input range
Definition: ObjectStateValidInputRange.hpp:41
DataType ObjectState.
Definition: ObjectState.hpp:52
::ad::physics::Dimension2D dimension
Definition: ObjectState.hpp:135
::ad::physics::Angle yaw
Definition: ObjectState.hpp:130
::ad::physics::AngularVelocity yaw_rate
Definition: ObjectState.hpp:140
::ad::physics::Distance2D center_point
Definition: ObjectState.hpp:145
::ad::physics::SpeedRange speed_range
Definition: ObjectState.hpp:150
::ad::physics::Angle steering_angle
Definition: ObjectState.hpp:155