Gazebo Msgs
API Reference
11.0.1
insert_drive_file
Tutorials
library_books
Classes
toc
Namespaces
insert_drive_file
Files
launch
Gazebo Website
Index
List
Hierarchy
Members: All
Members: Functions
Members: Variables
Members: Typedefs
Members: Enumerations
Members: Enumerator
List
Members
Functions
Typedefs
Variables
Enumerations
Enumerator
src
gz-msgs
core
include
gz
msgs
convert
Quaternion.hh
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2023 Open Source Robotics Foundation
3
*
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
7
*
8
* http://www.apache.org/licenses/LICENSE-2.0
9
*
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
15
*
16
*/
17
#ifndef GZ_MSGS_CONVERT_QUATERNION_HH_
18
#define GZ_MSGS_CONVERT_QUATERNION_HH_
19
20
#include <gz/msgs/config.hh>
21
22
// Message Headers
23
#include "gz/msgs/quaternion.pb.h"
24
25
// Data Headers
26
#include <
gz/math/Quaternion.hh
>
27
28
namespace
gz::msgs
{
29
// Inline bracket to help doxygen filtering.
30
inline
namespace
GZ_MSGS_VERSION_NAMESPACE {
31
33
inline
void
Set
(gz::msgs::Quaternion *_msg,
const
gz::math::Quaterniond
&_data)
34
{
35
_msg->set_w(_data.
W
());
36
_msg->set_x(_data.
X
());
37
_msg->set_y(_data.
Y
());
38
_msg->set_z(_data.
Z
());
39
}
40
41
inline
void
Set
(
gz::math::Quaterniond
*_data,
const
gz::msgs::Quaternion &_msg)
42
{
43
_data->
Set
(_msg.w(), _msg.x(), _msg.y(), _msg.z());
44
}
45
46
inline
gz::msgs::Quaternion
Convert
(
const
gz::math::Quaterniond
&_data)
47
{
48
gz::msgs::Quaternion ret;
49
Set
(&ret, _data);
50
return
ret;
51
}
52
53
inline
gz::math::Quaterniond
Convert
(
const
gz::msgs::Quaternion &_msg)
54
{
55
gz::math::Quaterniond
ret;
56
Set
(&ret, _msg);
57
return
ret;
58
}
59
}
// namespce
60
}
// namespace gz::msgs
61
62
#endif
// GZ_MSGS_CONVERT_VECTOR3_HH_