Fawkes API  Fawkes Development Version
gazebo_api_wrappers.h
1 
2 /***************************************************************************
3  * gazebo_api_wrappers.h - Gazebo Compatibility API wrappers
4  *
5  * Created: Thu Jun 29 13:27:47 2017 +0200
6  * Copyright 2017 Victor Matare
7  ****************************************************************************/
8 
9 /* This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU Library General Public License for more details.
18  *
19  * Read the full text in the LICENSE.GPL file in the doc directory.
20  */
21 
22 #ifndef UTILS_GAZEBO_API_WRAPPERS_H_
23 #define UTILS_GAZEBO_API_WRAPPERS_H_
24 
25 #include <gazebo/gazebo.hh>
26 
27 // Welcome to the Gazebo API refactoring hell.
28 
29 #if GAZEBO_MAJOR_VERSION >= 8
30 
31 # define GZWRAP_SIM_TIME SimTime
32 # define GZWRAP_REAL_TIME RealTime
33 # define GZWRAP_RUNNING Running
34 # define GZWRAP_MODEL_BY_NAME ModelByName
35 # define GZWRAP_MODEL_BY_INDEX ModelByIndex
36 # define GZWRAP_MODEL_COUNT ModelCount
37 # define GZWRAP_WORLD_POSE WorldPose
38 # define GZWRAP_ENTITY_BY_NAME EntityByName
39 # define GZWRAP_SIM_TIME SimTime
40 # define GZWRAP_NAME Name
41 # define GZWRAP_BOUNDING_BOX BoundingBox
42 # define GZWRAP_LENGTH Length
43 # define GZWRAP_MODELS Models
44 # define GZWRAP_PHYSICS Physics
45 # define GZWRAP_BASE_BY_NAME BaseByName
46 
47 # define GZWRAP_POS Pos()
48 # define GZWRAP_ROT Rot()
49 # define GZWRAP_EULER Euler()
50 # define GZWRAP_X X()
51 # define GZWRAP_Y Y()
52 # define GZWRAP_Z Z()
53 # define GZWRAP_W W()
54 
55 # define GZWRAP_ROT_ROLL Rot().Roll()
56 # define GZWRAP_ROT_PITCH Rot().Pitch()
57 # define GZWRAP_ROT_YAW Rot().Yaw()
58 
59 #else
60 
61 # define GZWRAP_SIM_TIME GetSimTime
62 # define GZWRAP_REAL_TIME GetRealTime
63 # define GZWRAP_RUNNING GetRunning
64 # define GZWRAP_MODEL_BY_NAME GetModel
65 # define GZWRAP_MODEL_BY_INDEX GetModel
66 # define GZWRAP_MODEL_COUNT GetModelCount
67 # define GZWRAP_WORLD_POSE GetWorldPose
68 # define GZWRAP_ENTITY_BY_NAME GetEntity
69 # define GZWRAP_SIM_TIME GetSimTime
70 # define GZWRAP_NAME GetName
71 # define GZWRAP_BOUNDING_BOX GetBoundingBox
72 # define GZWRAP_LENGTH GetLength
73 # define GZWRAP_MODELS GetModels
74 # define GZWRAP_PHYSICS GetPhysicsEngine
75 # define GZWRAP_BASE_BY_NAME GetByName
76 
77 # define GZWRAP_POS pos
78 # define GZWRAP_ROT rot
79 # define GZWRAP_EULER GetAsEuler()
80 # define GZWRAP_X x
81 # define GZWRAP_Y y
82 # define GZWRAP_Z z
83 # define GZWRAP_W w
84 
85 # define GZWRAP_ROT_ROLL rot.GetRoll()
86 # define GZWRAP_ROT_PITCH rot.GetPitch()
87 # define GZWRAP_ROT_YAW rot.GetYaw()
88 
89 #endif
90 
91 #define GZWRAP_POS_X GZWRAP_POS.GZWRAP_X
92 #define GZWRAP_POS_Y GZWRAP_POS.GZWRAP_Y
93 #define GZWRAP_POS_Z GZWRAP_POS.GZWRAP_Z
94 
95 #define GZWRAP_ROT_X GZWRAP_ROT.GZWRAP_X
96 #define GZWRAP_ROT_Y GZWRAP_ROT.GZWRAP_Y
97 #define GZWRAP_ROT_Z GZWRAP_ROT.GZWRAP_Z
98 #define GZWRAP_ROT_W GZWRAP_ROT.GZWRAP_W
99 
100 #define GZWRAP_ROT_EULER_X GZWRAP_ROT.GZWRAP_EULER.GZWRAP_X
101 #define GZWRAP_ROT_EULER_Y GZWRAP_ROT.GZWRAP_EULER.GZWRAP_Y
102 #define GZWRAP_ROT_EULER_Z GZWRAP_ROT.GZWRAP_EULER.GZWRAP_Z
103 
104 namespace gzwrap {
105 
106 #if GAZEBO_MAJOR_VERSION >= 8
107 typedef ignition::math::Pose3d Pose3d;
108 typedef ignition::math::Vector3d Vector3d;
109 #else
110 typedef gazebo::math::Pose Pose3d;
111 typedef gazebo::math::Vector3 Vector3d;
112 #endif
113 
114 } // namespace gzwrap
115 
116 #endif // UTILS_GAZEBO_API_WRAPPERS_H_