Class
List
Hierarchy
Modules
Common
Events
Math
Messages
Physics
Rendering
Sensors
Transport
Links
Gazebo Website
Wiki
Tutorials
Download
Report Documentation Issues
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
gazebo
physics
Inertial.hh
Go to the documentation of this file.
1
/*
2
* Copyright 2012 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 _INERTIAL_HH_
18
#define _INERTIAL_HH_
19
20
#include <string>
21
22
#include <sdf/sdf.hh>
23
24
#include "
gazebo/msgs/msgs.hh
"
25
#include "
gazebo/math/Quaternion.hh
"
26
#include "
gazebo/math/Vector3.hh
"
27
#include "
gazebo/math/Matrix3.hh
"
28
29
namespace
gazebo
30
{
31
namespace
physics
32
{
35
38
class
Inertial
39
{
41
public
:
Inertial
();
42
45
public
:
explicit
Inertial
(
double
_mass);
46
49
public
:
Inertial
(
const
Inertial
&_inertial);
50
52
public
:
virtual
~Inertial
();
53
56
public
:
void
Load
(sdf::ElementPtr _sdf);
57
60
public
:
void
UpdateParameters
(sdf::ElementPtr _sdf);
61
63
public
:
void
Reset
();
64
66
public
:
void
SetMass
(
double
m);
67
69
public
:
double
GetMass
()
const
;
70
78
public
:
void
SetInertiaMatrix
(
double
_ixx,
double
_iyy,
double
_izz,
79
double
_ixy,
double
_ixz,
double
iyz);
80
85
public
:
void
SetCoG
(
double
_cx,
double
_cy,
double
_cz);
86
89
public
:
void
SetCoG
(
const
math::Vector3
&_center);
90
99
public
:
void
SetCoG
(
double
_cx,
double
_cy,
double
_cz,
100
double
_rx,
double
_ry,
double
_rz);
101
104
public
:
void
SetCoG
(
const
math::Pose
&_c);
105
108
public
:
inline
const
math::Vector3
&
GetCoG
()
const
109
{
110
return
this->cog.
pos
;
111
}
112
116
public
:
inline
const
math::Pose
GetPose
()
const
117
{
118
return
math::Pose
(this->cog);
119
}
120
123
public
:
math::Vector3
GetPrincipalMoments
()
const
;
124
127
public
:
math::Vector3
GetProductsofInertia
()
const
;
128
131
public
:
double
GetIXX
()
const
;
132
135
public
:
double
GetIYY
()
const
;
136
139
public
:
double
GetIZZ
()
const
;
140
143
public
:
double
GetIXY
()
const
;
144
147
public
:
double
GetIXZ
()
const
;
148
151
public
:
double
GetIYZ
()
const
;
152
155
public
:
void
SetIXX
(
double
_v);
156
159
public
:
void
SetIYY
(
double
_v);
160
163
public
:
void
SetIZZ
(
double
_v);
164
167
public
:
void
SetIXY
(
double
_v);
168
171
public
:
void
SetIXZ
(
double
_v);
172
175
public
:
void
SetIYZ
(
double
_v);
176
179
public
:
void
Rotate
(
const
math::Quaternion
&_rot);
180
184
public
:
Inertial
&
operator=
(
const
Inertial
&_inertial);
185
193
public
:
Inertial
operator+
(
const
Inertial
&_inertial)
const
;
194
198
public
:
const
Inertial
&
operator+=
(
const
Inertial
&_inertial);
199
202
public
:
void
ProcessMsg
(
const
msgs::Inertial &_msg);
203
212
public
:
math::Matrix3
GetMOI
(
const
math::Pose
&_pose)
213
const
;
214
220
public
:
Inertial
GetInertial
(
const
math::Pose
&_frameOffset)
const
;
221
225
public
:
friend
std::ostream &
operator<<
(std::ostream &_out,
226
const
gazebo::physics::Inertial
&_inertial)
227
{
228
_out <<
"Mass["
<< _inertial.mass <<
"] CoG["
229
<< _inertial.cog <<
"]\n"
;
230
_out <<
"IXX["
<< _inertial.principals.
x
<<
"] "
231
<<
"IYY["
<< _inertial.principals.
y
<<
"] "
232
<<
"IZZ["
<< _inertial.principals.
z
<<
"]\n"
;
233
_out <<
"IXY["
<< _inertial.products.
x
<<
"] "
234
<<
"IXZ["
<< _inertial.products.
y
<<
"] "
235
<<
"IYZ["
<< _inertial.products.
z
<<
"]\n"
;
236
return
_out;
237
}
238
241
public
:
math::Matrix3
GetMOI
()
const
;
242
245
public
:
void
SetMOI
(
const
math::Matrix3
&_moi);
246
248
private
:
double
mass;
249
252
private
:
math::Pose
cog;
253
256
private
:
math::Vector3
principals;
257
261
private
:
math::Vector3
products;
262
264
private
: sdf::ElementPtr sdf;
265
268
private
:
static
sdf::ElementPtr sdfInertial;
269
};
271
}
272
}
273
#endif