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 (C) 2012-2014 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
#include "
gazebo/util/system.hh
"
29
30
namespace
gazebo
31
{
32
namespace
physics
33
{
36
39
class
GAZEBO_VISIBLE
Inertial
40
{
42
public
:
Inertial
();
43
46
public
:
explicit
Inertial
(
double
_mass);
47
50
public
:
Inertial
(
const
Inertial
&_inertial);
51
53
public
:
virtual
~
Inertial
();
54
57
public
:
void
Load(sdf::ElementPtr _sdf);
58
61
public
:
void
UpdateParameters(sdf::ElementPtr _sdf);
62
64
public
:
void
Reset();
65
67
public
:
void
SetMass(
double
m);
68
70
public
:
double
GetMass()
const
;
71
79
public
:
void
SetInertiaMatrix(
double
_ixx,
double
_iyy,
double
_izz,
80
double
_ixy,
double
_ixz,
double
iyz);
81
86
public
:
void
SetCoG(
double
_cx,
double
_cy,
double
_cz);
87
90
public
:
void
SetCoG(
const
math::Vector3
&_center);
91
100
public
:
void
SetCoG(
double
_cx,
double
_cy,
double
_cz,
101
double
_rx,
double
_ry,
double
_rz);
102
105
public
:
void
SetCoG(
const
math::Pose
&_c);
106
109
public
:
inline
const
math::Vector3
&
GetCoG
()
const
110
{
111
return
this->cog.pos;
112
}
113
117
public
:
inline
const
math::Pose
GetPose
()
const
118
{
119
return
math::Pose
(this->cog);
120
}
121
124
public
:
math::Vector3
GetPrincipalMoments()
const
;
125
128
public
:
math::Vector3
GetProductsofInertia()
const
;
129
132
public
:
double
GetIXX()
const
;
133
136
public
:
double
GetIYY()
const
;
137
140
public
:
double
GetIZZ()
const
;
141
144
public
:
double
GetIXY()
const
;
145
148
public
:
double
GetIXZ()
const
;
149
152
public
:
double
GetIYZ()
const
;
153
156
public
:
void
SetIXX(
double
_v);
157
160
public
:
void
SetIYY(
double
_v);
161
164
public
:
void
SetIZZ(
double
_v);
165
168
public
:
void
SetIXY(
double
_v);
169
172
public
:
void
SetIXZ(
double
_v);
173
176
public
:
void
SetIYZ(
double
_v);
177
180
public
:
void
Rotate(
const
math::Quaternion
&_rot);
181
185
public
:
Inertial
&operator=(
const
Inertial
&_inertial);
186
194
public
:
Inertial
operator+(
const
Inertial
&_inertial)
const
;
195
199
public
:
const
Inertial
&operator+=(
const
Inertial
&_inertial);
200
203
public
:
void
ProcessMsg(
const
msgs::Inertial &_msg);
204
213
public
:
math::Matrix3
GetMOI(
const
math::Pose
&_pose)
214
const
;
215
221
public
:
Inertial
GetInertial(
const
math::Pose
&_frameOffset)
const
;
222
226
public
:
friend
std::ostream &
operator<<
(std::ostream &_out,
227
const
gazebo::physics::Inertial
&_inertial)
228
{
229
_out <<
"Mass["
<< _inertial.mass <<
"] CoG["
230
<< _inertial.cog <<
"]\n"
;
231
_out <<
"IXX["
<< _inertial.principals.
x
<<
"] "
232
<<
"IYY["
<< _inertial.principals.
y
<<
"] "
233
<<
"IZZ["
<< _inertial.principals.
z
<<
"]\n"
;
234
_out <<
"IXY["
<< _inertial.products.
x
<<
"] "
235
<<
"IXZ["
<< _inertial.products.
y
<<
"] "
236
<<
"IYZ["
<< _inertial.products.
z
<<
"]\n"
;
237
return
_out;
238
}
239
242
public
:
math::Matrix3
GetMOI()
const
;
243
246
public
:
void
SetMOI(
const
math::Matrix3
&_moi);
247
249
private
:
double
mass;
250
253
private
:
math::Pose
cog;
254
257
private
:
math::Vector3
principals;
258
262
private
:
math::Vector3
products;
263
265
private
: sdf::ElementPtr sdf;
266
269
private
:
static
sdf::ElementPtr sdfInertial;
270
};
272
}
273
}
274
#endif