ad_rss
ObjectStateValidInputRange.hpp
Go to the documentation of this file.
1 /*
2  * ----------------- BEGIN LICENSE BLOCK ---------------------------------
3  *
4  * Copyright (C) 2018-2020 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/SpeedValidInputRange.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.yawRate, logErrors) && withinValidInputRange(input.centerPoint, logErrors)
47  && withinValidInputRange(input.speed, logErrors) && withinValidInputRange(input.steeringAngle, 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 }
ad::rss::world::ObjectState::centerPoint
::ad::physics::Distance2D centerPoint
Definition: ObjectState.hpp:144
ad::rss::world::ObjectState::yaw
::ad::physics::Angle yaw
Definition: ObjectState.hpp:129
ad::rss::world::ObjectState::steeringAngle
::ad::physics::Angle steeringAngle
Definition: ObjectState.hpp:154
ad::rss::world::ObjectState::dimension
::ad::physics::Dimension2D dimension
Definition: ObjectState.hpp:134
withinValidInputRange
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
ObjectState.hpp
ad::rss::world::ObjectState
DataType ObjectState.
Definition: ObjectState.hpp:51
ad::rss::world::ObjectState::speed
::ad::physics::Speed speed
Definition: ObjectState.hpp:149
ad::rss::world::ObjectState::yawRate
::ad::physics::AngularVelocity yawRate
Definition: ObjectState.hpp:139