ADORe
ADORe is a modular open source software library and toolkit for decision making, planning, control and simulation of automated vehicles
simresetvehicledimensionsconverter.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
17 #include <adore_if_ros_msg/SimResetVehicleDimensions.h>
18 namespace adore
19 {
20  namespace if_ROS
21  {
22 
24  {
25  void operator()(adore_if_ros_msg::SimResetVehicleDimensionsConstPtr msg, adore::sim::ResetVehicleDimensions& rvd)
26  {
27  toOBJ(*msg, rvd);
28  }
29  void operator()(const adore_if_ros_msg::SimResetVehicleDimensions& msg,
31  {
32  toOBJ(msg, rvd);
33  }
34  adore_if_ros_msg::SimResetVehicleDimensions operator()(const adore::sim::ResetVehicleDimensions& rvd)
35  {
36  adore_if_ros_msg::SimResetVehicleDimensions msg;
37  toMSG(rvd, msg);
38  return msg;
39  }
41  adore_if_ros_msg::SimResetVehicleDimensions& target)
42  {
43  double val;
44  if (source.get_a(val))
45  {
46  target.a = val;
47  target.a_valid = true;
48  }
49  else
50  {
51  target.a_valid = false;
52  }
53  if (source.get_b(val))
54  {
55  target.b = val;
56  target.b_valid = true;
57  }
58  else
59  {
60  target.b_valid = false;
61  }
62  if (source.get_c(val))
63  {
64  target.c = val;
65  target.c_valid = true;
66  }
67  else
68  {
69  target.c_valid = false;
70  }
71  if (source.get_d(val))
72  {
73  target.d = val;
74  target.d_valid = true;
75  }
76  else
77  {
78  target.d_valid = false;
79  }
80  if (source.get_m(val))
81  {
82  target.m = val;
83  target.m_valid = true;
84  }
85  else
86  {
87  target.m_valid = false;
88  }
89  if (source.get_width(val))
90  {
91  target.width = val;
92  target.width_valid = true;
93  }
94  else
95  {
96  target.width_valid = false;
97  }
98  }
99  void toOBJ(const adore_if_ros_msg::SimResetVehicleDimensions& source,
101  {
102  if (source.a_valid)
103  {
104  target.set_a(source.a);
105  }
106  else
107  {
108  target.invalidate_a();
109  }
110  if (source.b_valid)
111  {
112  target.set_b(source.b);
113  }
114  else
115  {
116  target.invalidate_b();
117  }
118  if (source.c_valid)
119  {
120  target.set_c(source.c);
121  }
122  else
123  {
124  target.invalidate_c();
125  }
126  if (source.d_valid)
127  {
128  target.set_d(source.d);
129  }
130  else
131  {
132  target.invalidate_d();
133  }
134  if (source.m_valid)
135  {
136  target.set_m(source.m);
137  }
138  else
139  {
140  target.invalidate_m();
141  }
142  if (source.width_valid)
143  {
144  target.set_width(source.width);
145  }
146  else
147  {
148  target.invalidate_width();
149  }
150  }
151  };
152  } // namespace if_ROS
153 } // namespace adore
Definition: areaofeffectconverter.h:20
Definition: simresetvehicledimensionsconverter.h:24
void toOBJ(const adore_if_ros_msg::SimResetVehicleDimensions &source, adore::sim::ResetVehicleDimensions &target)
Definition: simresetvehicledimensionsconverter.h:99
adore_if_ros_msg::SimResetVehicleDimensions operator()(const adore::sim::ResetVehicleDimensions &rvd)
Definition: simresetvehicledimensionsconverter.h:34
void toMSG(const adore::sim::ResetVehicleDimensions &source, adore_if_ros_msg::SimResetVehicleDimensions &target)
Definition: simresetvehicledimensionsconverter.h:40
void operator()(const adore_if_ros_msg::SimResetVehicleDimensions &msg, adore::sim::ResetVehicleDimensions &rvd)
Definition: simresetvehicledimensionsconverter.h:29
void operator()(adore_if_ros_msg::SimResetVehicleDimensionsConstPtr msg, adore::sim::ResetVehicleDimensions &rvd)
Definition: simresetvehicledimensionsconverter.h:25
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
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
bool get_c(double &val) const
Definition: resetvehicledimensions.h:67
void set_a(double val)
Definition: resetvehicledimensions.h:99
bool get_b(double &val) const
Definition: resetvehicledimensions.h:59
bool get_width(double &val) const
Definition: resetvehicledimensions.h:91
void set_m(double val)
Definition: resetvehicledimensions.h:119