CARLA
Imu.cpp
Go to the documentation of this file.
1 // Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima).
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 /*!
16  * @file Imu.cpp
17  * This source file contains the definition of the described types in the IDL file.
18  *
19  * This file was generated by the tool gen.
20  */
21 
22 #ifdef _WIN32
23 // Remove linker warning LNK4221 on Visual Studio
24 namespace {
25 char dummy;
26 } // namespace
27 #endif // _WIN32
28 
29 #include "Imu.h"
30 #include <fastcdr/Cdr.h>
31 
32 #include <fastcdr/exceptions/BadParamException.h>
33 using namespace eprosima::fastcdr::exception;
34 
35 #include <utility>
36 
37 #define geometry_msgs_msg_Vector3_max_cdr_typesize 24ULL;
38 #define std_msgs_msg_Time_max_cdr_typesize 8ULL;
39 
40 #define geometry_msgs_msg_Quaternion_max_cdr_typesize 32ULL;
41 #define std_msgs_msg_Header_max_cdr_typesize 268ULL;
42 #define sensor_msgs_msg_Imu_max_cdr_typesize 568ULL;
43 #define geometry_msgs_msg_Vector3_max_key_cdr_typesize 0ULL;
44 #define std_msgs_msg_Time_max_key_cdr_typesize 0ULL;
45 
46 #define geometry_msgs_msg_Quaternion_max_key_cdr_typesize 0ULL;
47 #define std_msgs_msg_Header_max_key_cdr_typesize 0ULL;
48 #define sensor_msgs_msg_Imu_max_key_cdr_typesize 0ULL;
49 
51 {
52  // std_msgs::msg::Header m_header
53 
54  // geometry_msgs::msg::Quaternion m_orientation
55 
56  // sensor_msgs::msg::sensor_msgs__Imu__double_array_9 m_orientation_covariance
57  memset(&m_orientation_covariance, 0, (9) * 8);
58  // geometry_msgs::msg::Vector3 m_angular_velocity
59 
60  // sensor_msgs::msg::sensor_msgs__Imu__double_array_9 m_angular_velocity_covariance
61  memset(&m_angular_velocity_covariance, 0, (9) * 8);
62  // geometry_msgs::msg::Vector3 m_linear_acceleration
63 
64  // sensor_msgs::msg::sensor_msgs__Imu__double_array_9 m_linear_acceleration_covariance
65  memset(&m_linear_acceleration_covariance, 0, (9) * 8);
66 }
67 
69 {
70 }
71 
73  const Imu& x)
74 {
75  m_header = x.m_header;
76  m_orientation = x.m_orientation;
77  m_orientation_covariance = x.m_orientation_covariance;
78  m_angular_velocity = x.m_angular_velocity;
79  m_angular_velocity_covariance = x.m_angular_velocity_covariance;
80  m_linear_acceleration = x.m_linear_acceleration;
81  m_linear_acceleration_covariance = x.m_linear_acceleration_covariance;
82 }
83 
85  Imu&& x) noexcept
86 {
87  m_header = std::move(x.m_header);
88  m_orientation = std::move(x.m_orientation);
89  m_orientation_covariance = std::move(x.m_orientation_covariance);
90  m_angular_velocity = std::move(x.m_angular_velocity);
91  m_angular_velocity_covariance = std::move(x.m_angular_velocity_covariance);
92  m_linear_acceleration = std::move(x.m_linear_acceleration);
93  m_linear_acceleration_covariance = std::move(x.m_linear_acceleration_covariance);
94 }
95 
97  const Imu& x)
98 {
99  m_header = x.m_header;
100  m_orientation = x.m_orientation;
101  m_orientation_covariance = x.m_orientation_covariance;
102  m_angular_velocity = x.m_angular_velocity;
103  m_angular_velocity_covariance = x.m_angular_velocity_covariance;
104  m_linear_acceleration = x.m_linear_acceleration;
105  m_linear_acceleration_covariance = x.m_linear_acceleration_covariance;
106 
107  return *this;
108 }
109 
111  Imu&& x) noexcept
112 {
113  m_header = std::move(x.m_header);
114  m_orientation = std::move(x.m_orientation);
115  m_orientation_covariance = std::move(x.m_orientation_covariance);
116  m_angular_velocity = std::move(x.m_angular_velocity);
117  m_angular_velocity_covariance = std::move(x.m_angular_velocity_covariance);
118  m_linear_acceleration = std::move(x.m_linear_acceleration);
119  m_linear_acceleration_covariance = std::move(x.m_linear_acceleration_covariance);
120 
121  return *this;
122 }
123 
125  const Imu& x) const
126 {
127  return (m_header == x.m_header && m_orientation == x.m_orientation && m_orientation_covariance == x.m_orientation_covariance && m_angular_velocity == x.m_angular_velocity && m_angular_velocity_covariance == x.m_angular_velocity_covariance && m_linear_acceleration == x.m_linear_acceleration && m_linear_acceleration_covariance == x.m_linear_acceleration_covariance);
128 }
129 
131  const Imu& x) const
132 {
133  return !(*this == x);
134 }
135 
137  size_t current_alignment)
138 {
139  static_cast<void>(current_alignment);
141 }
142 
144  const sensor_msgs::msg::Imu& data,
145  size_t current_alignment)
146 {
147  size_t initial_alignment = current_alignment;
148  current_alignment += std_msgs::msg::Header::getCdrSerializedSize(data.header(), current_alignment);
149  current_alignment += geometry_msgs::msg::Quaternion::getCdrSerializedSize(data.orientation(), current_alignment);
150  current_alignment += ((9) * 8) + eprosima::fastcdr::Cdr::alignment(current_alignment, 8);
151  current_alignment += geometry_msgs::msg::Vector3::getCdrSerializedSize(data.angular_velocity(), current_alignment);
152  current_alignment += ((9) * 8) + eprosima::fastcdr::Cdr::alignment(current_alignment, 8);
153  current_alignment += geometry_msgs::msg::Vector3::getCdrSerializedSize(data.linear_acceleration(), current_alignment);
154  current_alignment += ((9) * 8) + eprosima::fastcdr::Cdr::alignment(current_alignment, 8);
155 
156  return current_alignment - initial_alignment;
157 }
158 
160  eprosima::fastcdr::Cdr& scdr) const
161 {
162  scdr << m_header;
163  scdr << m_orientation;
164  scdr << m_orientation_covariance;
165  scdr << m_angular_velocity;
166  scdr << m_angular_velocity_covariance;
167  scdr << m_linear_acceleration;
168  scdr << m_linear_acceleration_covariance;
169 }
170 
172  eprosima::fastcdr::Cdr& dcdr)
173 {
174  dcdr >> m_header;
175  dcdr >> m_orientation;
176  dcdr >> m_orientation_covariance;
177  dcdr >> m_angular_velocity;
178  dcdr >> m_angular_velocity_covariance;
179  dcdr >> m_linear_acceleration;
180  dcdr >> m_linear_acceleration_covariance;
181 }
182 
183 /*!
184  * @brief This function copies the value in member header
185  * @param _header New value to be copied in member header
186  */
188  const std_msgs::msg::Header& _header)
189 {
190  m_header = _header;
191 }
192 
193 /*!
194  * @brief This function moves the value in member header
195  * @param _header New value to be moved in member header
196  */
198  std_msgs::msg::Header&& _header)
199 {
200  m_header = std::move(_header);
201 }
202 
203 /*!
204  * @brief This function returns a constant reference to member header
205  * @return Constant reference to member header
206  */
208 {
209  return m_header;
210 }
211 
212 /*!
213  * @brief This function returns a reference to member header
214  * @return Reference to member header
215  */
217 {
218  return m_header;
219 }
220 
221 /*!
222  * @brief This function copies the value in member orientation
223  * @param _orientation New value to be copied in member orientation
224  */
226  const geometry_msgs::msg::Quaternion& _orientation)
227 {
228  m_orientation = _orientation;
229 }
230 
231 /*!
232  * @brief This function moves the value in member orientation
233  * @param _orientation New value to be moved in member orientation
234  */
236  geometry_msgs::msg::Quaternion&& _orientation)
237 {
238  m_orientation = std::move(_orientation);
239 }
240 
241 /*!
242  * @brief This function returns a constant reference to member orientation
243  * @return Constant reference to member orientation
244  */
246 {
247  return m_orientation;
248 }
249 
250 /*!
251  * @brief This function returns a reference to member orientation
252  * @return Reference to member orientation
253  */
255 {
256  return m_orientation;
257 }
258 
259 /*!
260  * @brief This function copies the value in member orientation_covariance
261  * @param _orientation_covariance New value to be copied in member orientation_covariance
262  */
264  const sensor_msgs::msg::sensor_msgs__Imu__double_array_9& _orientation_covariance)
265 {
266  m_orientation_covariance = _orientation_covariance;
267 }
268 
269 /*!
270  * @brief This function moves the value in member orientation_covariance
271  * @param _orientation_covariance New value to be moved in member orientation_covariance
272  */
274  sensor_msgs::msg::sensor_msgs__Imu__double_array_9&& _orientation_covariance)
275 {
276  m_orientation_covariance = std::move(_orientation_covariance);
277 }
278 
279 /*!
280  * @brief This function returns a constant reference to member orientation_covariance
281  * @return Constant reference to member orientation_covariance
282  */
284 {
285  return m_orientation_covariance;
286 }
287 
288 /*!
289  * @brief This function returns a reference to member orientation_covariance
290  * @return Reference to member orientation_covariance
291  */
293 {
294  return m_orientation_covariance;
295 }
296 
297 /*!
298  * @brief This function copies the value in member angular_velocity
299  * @param _angular_velocity New value to be copied in member angular_velocity
300  */
302  const geometry_msgs::msg::Vector3& _angular_velocity)
303 {
304  m_angular_velocity = _angular_velocity;
305 }
306 
307 /*!
308  * @brief This function moves the value in member angular_velocity
309  * @param _angular_velocity New value to be moved in member angular_velocity
310  */
312  geometry_msgs::msg::Vector3&& _angular_velocity)
313 {
314  m_angular_velocity = std::move(_angular_velocity);
315 }
316 
317 /*!
318  * @brief This function returns a constant reference to member angular_velocity
319  * @return Constant reference to member angular_velocity
320  */
322 {
323  return m_angular_velocity;
324 }
325 
326 /*!
327  * @brief This function returns a reference to member angular_velocity
328  * @return Reference to member angular_velocity
329  */
331 {
332  return m_angular_velocity;
333 }
334 
335 /*!
336  * @brief This function copies the value in member angular_velocity_covariance
337  * @param _angular_velocity_covariance New value to be copied in member angular_velocity_covariance
338  */
340  const sensor_msgs::msg::sensor_msgs__Imu__double_array_9& _angular_velocity_covariance)
341 {
342  m_angular_velocity_covariance = _angular_velocity_covariance;
343 }
344 
345 /*!
346  * @brief This function moves the value in member angular_velocity_covariance
347  * @param _angular_velocity_covariance New value to be moved in member angular_velocity_covariance
348  */
350  sensor_msgs::msg::sensor_msgs__Imu__double_array_9&& _angular_velocity_covariance)
351 {
352  m_angular_velocity_covariance = std::move(_angular_velocity_covariance);
353 }
354 
355 /*!
356  * @brief This function returns a constant reference to member angular_velocity_covariance
357  * @return Constant reference to member angular_velocity_covariance
358  */
360 {
361  return m_angular_velocity_covariance;
362 }
363 
364 /*!
365  * @brief This function returns a reference to member angular_velocity_covariance
366  * @return Reference to member angular_velocity_covariance
367  */
369 {
370  return m_angular_velocity_covariance;
371 }
372 
373 /*!
374  * @brief This function copies the value in member linear_acceleration
375  * @param _linear_acceleration New value to be copied in member linear_acceleration
376  */
378  const geometry_msgs::msg::Vector3& _linear_acceleration)
379 {
380  m_linear_acceleration = _linear_acceleration;
381 }
382 
383 /*!
384  * @brief This function moves the value in member linear_acceleration
385  * @param _linear_acceleration New value to be moved in member linear_acceleration
386  */
388  geometry_msgs::msg::Vector3&& _linear_acceleration)
389 {
390  m_linear_acceleration = std::move(_linear_acceleration);
391 }
392 
393 /*!
394  * @brief This function returns a constant reference to member linear_acceleration
395  * @return Constant reference to member linear_acceleration
396  */
398 {
399  return m_linear_acceleration;
400 }
401 
402 /*!
403  * @brief This function returns a reference to member linear_acceleration
404  * @return Reference to member linear_acceleration
405  */
407 {
408  return m_linear_acceleration;
409 }
410 
411 /*!
412  * @brief This function copies the value in member linear_acceleration_covariance
413  * @param _linear_acceleration_covariance New value to be copied in member linear_acceleration_covariance
414  */
416  const sensor_msgs::msg::sensor_msgs__Imu__double_array_9& _linear_acceleration_covariance)
417 {
418  m_linear_acceleration_covariance = _linear_acceleration_covariance;
419 }
420 
421 /*!
422  * @brief This function moves the value in member linear_acceleration_covariance
423  * @param _linear_acceleration_covariance New value to be moved in member linear_acceleration_covariance
424  */
426  sensor_msgs::msg::sensor_msgs__Imu__double_array_9&& _linear_acceleration_covariance)
427 {
428  m_linear_acceleration_covariance = std::move(_linear_acceleration_covariance);
429 }
430 
431 /*!
432  * @brief This function returns a constant reference to member linear_acceleration_covariance
433  * @return Constant reference to member linear_acceleration_covariance
434  */
436 {
437  return m_linear_acceleration_covariance;
438 }
439 
440 /*!
441  * @brief This function returns a reference to member linear_acceleration_covariance
442  * @return Reference to member linear_acceleration_covariance
443  */
445 {
446  return m_linear_acceleration_covariance;
447 }
448 
450  size_t current_alignment)
451 {
452  static_cast<void>(current_alignment);
454 }
455 
457 {
458  return false;
459 }
460 
462  eprosima::fastcdr::Cdr& scdr) const
463 {
464  (void) scdr;
465 }
eProsima_user_DllExport const sensor_msgs::msg::sensor_msgs__Imu__double_array_9 & angular_velocity_covariance() const
This function returns a constant reference to member angular_velocity_covariance. ...
Definition: Imu.cpp:359
eProsima_user_DllExport void serialize(eprosima::fastcdr::Cdr &cdr) const
This function serializes an object using CDR serialization.
Definition: Imu.cpp:159
std_msgs::msg::Header m_header
Definition: Imu.h:362
geometry_msgs::msg::Vector3 m_angular_velocity
Definition: Imu.h:365
sensor_msgs::msg::sensor_msgs__Imu__double_array_9 m_orientation_covariance
Definition: Imu.h:364
eProsima_user_DllExport void linear_acceleration(const geometry_msgs::msg::Vector3 &_linear_acceleration)
This function copies the value in member linear_acceleration.
Definition: Imu.cpp:377
eProsima_user_DllExport void header(const std_msgs::msg::Header &_header)
This function copies the value in member header.
Definition: Imu.cpp:187
eProsima_user_DllExport void serializeKey(eprosima::fastcdr::Cdr &cdr) const
This function serializes the key members of an object using CDR serialization.
Definition: Imu.cpp:461
eProsima_user_DllExport const geometry_msgs::msg::Vector3 & angular_velocity() const
This function returns a constant reference to member angular_velocity.
Definition: Imu.cpp:321
eProsima_user_DllExport bool operator!=(const Imu &x) const
Comparison operator.
Definition: Imu.cpp:130
This class represents the structure Header defined by the user in the IDL file.
Definition: Header.h:72
static eProsima_user_DllExport size_t getCdrSerializedSize(const geometry_msgs::msg::Quaternion &data, size_t current_alignment=0)
This function returns the serialized size of a data depending on the buffer alignment.
Definition: Quaternion.cpp:115
eProsima_user_DllExport bool operator==(const Imu &x) const
Comparison operator.
Definition: Imu.cpp:124
static eProsima_user_DllExport size_t getCdrSerializedSize(const std_msgs::msg::Header &data, size_t current_alignment=0)
This function returns the serialized size of a data depending on the buffer alignment.
Definition: Header.cpp:102
This class represents the structure Vector3 defined by the user in the IDL file.
Definition: Vector3.h:71
eProsima_user_DllExport void angular_velocity(const geometry_msgs::msg::Vector3 &_angular_velocity)
This function copies the value in member angular_velocity.
Definition: Imu.cpp:301
geometry_msgs::msg::Vector3 m_linear_acceleration
Definition: Imu.h:367
static eProsima_user_DllExport size_t getKeyMaxCdrSerializedSize(size_t current_alignment=0)
This function returns the maximum serialized size of the Key of an object depending on the buffer ali...
Definition: Imu.cpp:449
eProsima_user_DllExport const geometry_msgs::msg::Quaternion & orientation() const
This function returns a constant reference to member orientation.
Definition: Imu.cpp:245
This class represents the structure Imu defined by the user in the IDL file.
Definition: Imu.h:75
eProsima_user_DllExport const geometry_msgs::msg::Vector3 & linear_acceleration() const
This function returns a constant reference to member linear_acceleration.
Definition: Imu.cpp:397
eProsima_user_DllExport Imu & operator=(const Imu &x)
Copy assignment.
Definition: Imu.cpp:96
sensor_msgs::msg::sensor_msgs__Imu__double_array_9 m_angular_velocity_covariance
Definition: Imu.h:366
geometry_msgs::msg::Quaternion m_orientation
Definition: Imu.h:363
eProsima_user_DllExport ~Imu()
Default destructor.
Definition: Imu.cpp:68
eProsima_user_DllExport void orientation(const geometry_msgs::msg::Quaternion &_orientation)
This function copies the value in member orientation.
Definition: Imu.cpp:225
eProsima_user_DllExport const std_msgs::msg::Header & header() const
This function returns a constant reference to member header.
Definition: Imu.cpp:207
static eProsima_user_DllExport size_t getCdrSerializedSize(const geometry_msgs::msg::Vector3 &data, size_t current_alignment=0)
This function returns the serialized size of a data depending on the buffer alignment.
Definition: Vector3.cpp:110
static eProsima_user_DllExport size_t getMaxCdrSerializedSize(size_t current_alignment=0)
This function returns the maximum serialized size of an object depending on the buffer alignment...
Definition: Imu.cpp:136
#define sensor_msgs_msg_Imu_max_cdr_typesize
Definition: Imu.cpp:42
eProsima_user_DllExport Imu()
Default constructor.
Definition: Imu.cpp:50
static eProsima_user_DllExport size_t getCdrSerializedSize(const sensor_msgs::msg::Imu &data, size_t current_alignment=0)
This function returns the serialized size of a data depending on the buffer alignment.
Definition: Imu.cpp:143
eProsima_user_DllExport const sensor_msgs::msg::sensor_msgs__Imu__double_array_9 & orientation_covariance() const
This function returns a constant reference to member orientation_covariance.
Definition: Imu.cpp:283
std::array< double, 9 > sensor_msgs__Imu__double_array_9
Definition: Imu.h:70
#define sensor_msgs_msg_Imu_max_key_cdr_typesize
Definition: Imu.cpp:48
eProsima_user_DllExport const sensor_msgs::msg::sensor_msgs__Imu__double_array_9 & linear_acceleration_covariance() const
This function returns a constant reference to member linear_acceleration_covariance.
Definition: Imu.cpp:435
This class represents the structure Quaternion defined by the user in the IDL file.
Definition: Quaternion.h:70
static eProsima_user_DllExport bool isKeyDefined()
This function tells you if the Key has been defined for this type.
Definition: Imu.cpp:456
eProsima_user_DllExport void deserialize(eprosima::fastcdr::Cdr &cdr)
This function deserializes an object using CDR serialization.
Definition: Imu.cpp:171
sensor_msgs::msg::sensor_msgs__Imu__double_array_9 m_linear_acceleration_covariance
Definition: Imu.h:368