ADORe
ADORe is a modular open source software library and toolkit for decision making, planning, control and simulation of automated vehicles
resetvehicledimensions.h
Go to the documentation of this file.
1 /********************************************************************************
2  * Copyright (C) 2017-2023 German Aerospace Center (DLR).
3  * Eclipse ADORe, Automated Driving Open Research https://eclipse.org/adore
4  *
5  * This program and the accompanying materials are made available under the
6  * terms of the Eclipse Public License 2.0 which is available at
7  * http://www.eclipse.org/legal/epl-2.0.
8  *
9  * SPDX-License-Identifier: EPL-2.0
10  *
11  * Contributors:
12  * Matthias Nichting - initial API and implementation
13  ********************************************************************************/
14 
15 #pragma once
16 
17 namespace adore
18 {
19  namespace sim
20  {
26  {
27  private:
28  double a_, b_, c_, d_, m_, bodyWidth_;
30 
31  public:
33  : a_valid_(false)
34  , b_valid_(false)
35  , c_valid_(false)
36  , d_valid_(false)
37  , m_valid_(false)
38  , bodyWidth_valid_(false)
39  {
40  }
41 
42  bool get_length(double& val) const
43  {
44  bool result = a_valid_ && b_valid_ && c_valid_ && d_valid_;
45  if (result)
46  {
47  val = a_ + b_ + c_ + d_;
48  }
49  return result;
50  }
51  bool get_a(double& val) const
52  {
53  if (a_valid_)
54  {
55  val = a_;
56  }
57  return a_valid_;
58  }
59  bool get_b(double& val) const
60  {
61  if (b_valid_)
62  {
63  val = b_;
64  }
65  return b_valid_;
66  }
67  bool get_c(double& val) const
68  {
69  if (c_valid_)
70  {
71  val = c_;
72  }
73  return c_valid_;
74  }
75  bool get_d(double& val) const
76  {
77  if (d_valid_)
78  {
79  val = d_;
80  }
81  return d_valid_;
82  }
83  bool get_m(double& val) const
84  {
85  if (m_valid_)
86  {
87  val = m_;
88  }
89  return m_valid_;
90  }
91  bool get_width(double& val) const
92  {
93  if (bodyWidth_valid_)
94  {
95  val = bodyWidth_;
96  }
97  return bodyWidth_valid_;
98  }
99  void set_a(double val)
100  {
101  a_valid_ = true;
102  a_ = val;
103  }
104  void set_b(double val)
105  {
106  b_valid_ = true;
107  b_ = val;
108  }
109  void set_c(double val)
110  {
111  c_valid_ = true;
112  c_ = val;
113  }
114  void set_d(double val)
115  {
116  d_valid_ = true;
117  d_ = val;
118  }
119  void set_m(double val)
120  {
121  m_valid_ = true;
122  m_ = val;
123  }
124  void set_width(double val)
125  {
126  bodyWidth_valid_ = true;
127  bodyWidth_ = val;
128  }
130  {
131  a_valid_=false;
132  }
134  {
135  b_valid_=false;
136  }
138  {
139  c_valid_=false;
140  }
142  {
143  d_valid_=false;
144  }
146  {
147  m_valid_=false;
148  }
150  {
151  bodyWidth_valid_=false;
152  }
153  };
154 
155  } // namespace sim
156 } // namespace adore
Definition: areaofeffectconverter.h:20
provides encapsulation of values needed to reset the vehicle dimensions in a simulation
Definition: resetvehicledimensions.h:26
void set_c(double val)
Definition: resetvehicledimensions.h:109
void invalidate_m()
Definition: resetvehicledimensions.h:145
bool get_d(double &val) const
Definition: resetvehicledimensions.h:75
void set_width(double val)
Definition: resetvehicledimensions.h:124
void set_b(double val)
Definition: resetvehicledimensions.h:104
void invalidate_a()
Definition: resetvehicledimensions.h:129
void invalidate_c()
Definition: resetvehicledimensions.h:137
void invalidate_d()
Definition: resetvehicledimensions.h:141
bool get_a(double &val) const
Definition: resetvehicledimensions.h:51
void invalidate_width()
Definition: resetvehicledimensions.h:149
bool a_valid_
Definition: resetvehicledimensions.h:29
double c_
Definition: resetvehicledimensions.h:28
void invalidate_b()
Definition: resetvehicledimensions.h:133
bool get_m(double &val) const
Definition: resetvehicledimensions.h:83
void set_d(double val)
Definition: resetvehicledimensions.h:114
double b_
Definition: resetvehicledimensions.h:28
bool m_valid_
Definition: resetvehicledimensions.h:29
bool get_c(double &val) const
Definition: resetvehicledimensions.h:67
void set_a(double val)
Definition: resetvehicledimensions.h:99
bool d_valid_
Definition: resetvehicledimensions.h:29
bool get_b(double &val) const
Definition: resetvehicledimensions.h:59
bool c_valid_
Definition: resetvehicledimensions.h:29
ResetVehicleDimensions()
Definition: resetvehicledimensions.h:32
bool bodyWidth_valid_
Definition: resetvehicledimensions.h:29
double d_
Definition: resetvehicledimensions.h:28
double bodyWidth_
Definition: resetvehicledimensions.h:28
bool get_length(double &val) const
Definition: resetvehicledimensions.h:42
bool get_width(double &val) const
Definition: resetvehicledimensions.h:91
void set_m(double val)
Definition: resetvehicledimensions.h:119
bool b_valid_
Definition: resetvehicledimensions.h:29
double a_
Definition: resetvehicledimensions.h:28
double m_
Definition: resetvehicledimensions.h:28