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
Joint.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
/* Desc: The base joint class
18
* Author: Nate Koenig, Andrew Howard
19
* Date: 21 May 2003
20
*/
21
22
#ifndef _JOINT_HH_
23
#define _JOINT_HH_
24
25
#include <string>
26
#include <vector>
27
28
#include <boost/any.hpp>
29
30
#include "
gazebo/common/Event.hh
"
31
#include "
gazebo/common/Events.hh
"
32
#include "
gazebo/math/Angle.hh
"
33
#include "
gazebo/math/Vector3.hh
"
34
#include "gazebo/msgs/MessageTypes.hh"
35
36
#include "
gazebo/physics/JointState.hh
"
37
#include "
gazebo/physics/Base.hh
"
38
#include "
gazebo/physics/JointWrench.hh
"
39
43
#define MAX_JOINT_AXIS 2
44
45
namespace
gazebo
46
{
47
namespace
physics
48
{
51
54
class
Joint
:
public
Base
55
{
58
public
:
enum
Attribute
59
{
61
FUDGE_FACTOR
,
62
64
SUSPENSION_ERP
,
65
67
SUSPENSION_CFM
,
68
70
STOP_ERP
,
71
73
STOP_CFM
,
74
76
ERP
,
77
79
CFM
,
80
82
FMAX
,
83
85
VEL
,
86
88
HI_STOP
,
89
91
LO_STOP
92
};
93
96
public
:
explicit
Joint
(
BasePtr
_parent);
97
99
public
:
virtual
~Joint
();
100
105
public
:
void
Load
(
LinkPtr
_parent,
LinkPtr
_child,
106
const
math::Pose
&_pose);
107
110
public
:
virtual
void
Load
(sdf::ElementPtr _sdf);
111
113
public
:
virtual
void
Init
();
114
116
public
:
void
Update
();
117
120
public
:
virtual
void
UpdateParameters
(sdf::ElementPtr _sdf);
121
123
public
:
virtual
void
Reset
();
124
127
public
:
void
SetState
(
const
JointState
&_state);
128
131
public
:
void
SetModel
(
ModelPtr
_model);
132
138
public
:
virtual
LinkPtr
GetJointLink
(
int
_index)
const
= 0;
139
144
public
:
virtual
bool
AreConnected
(
LinkPtr
_one,
LinkPtr
_two)
const
= 0;
145
149
public
:
virtual
void
Attach
(
LinkPtr
_parent,
LinkPtr
_child);
150
152
public
:
virtual
void
Detach
();
153
159
public
:
virtual
void
SetAxis
(
int
_index,
const
math::Vector3
&_axis) = 0;
160
165
public
:
virtual
void
SetDamping
(
int
_index,
double
_damping) = 0;
166
171
public
:
double
GetDamping
(
int
_index);
172
174
public
:
virtual
void
ApplyDamping
();
175
179
public
:
template
<
typename
T>
180
event::ConnectionPtr
ConnectJointUpdate
(T _subscriber)
181
{
return
jointUpdate.
Connect
(_subscriber);}
182
185
public
:
void
DisconnectJointUpdate
(
event::ConnectionPtr
&_conn)
186
{jointUpdate.
Disconnect
(_conn);}
187
191
public
:
math::Vector3
GetLocalAxis
(
int
_index)
const
;
192
196
public
:
virtual
math::Vector3
GetGlobalAxis
(
int
_index)
const
= 0;
197
201
public
:
virtual
void
SetAnchor
(
int
_index,
202
const
math::Vector3
&_anchor) = 0;
203
207
public
:
virtual
math::Vector3
GetAnchor
(
int
_index)
const
= 0;
208
212
public
:
virtual
void
SetHighStop
(
int
_index,
213
const
math::Angle
&_angle);
214
218
public
:
virtual
void
SetLowStop
(
int
_index,
219
const
math::Angle
&_angle);
220
227
public
:
virtual
math::Angle
GetHighStop
(
int
_index) = 0;
228
235
public
:
virtual
math::Angle
GetLowStop
(
int
_index) = 0;
236
240
public
:
virtual
double
GetEffortLimit
(
int
_index);
241
245
public
:
virtual
double
GetVelocityLimit
(
int
_index);
246
250
public
:
virtual
void
SetVelocity
(
int
_index,
double
_vel) = 0;
251
255
public
:
virtual
double
GetVelocity
(
int
_index)
const
= 0;
256
265
public
:
virtual
void
SetForce
(
int
_index,
double
_effort) = 0;
266
272
public
:
double
CheckAndTruncateForce
(
int
_index,
double
_effort);
273
280
public
:
virtual
double
GetForce
(
unsigned
int
_index);
281
304
public
:
virtual
JointWrench
GetForceTorque
(
unsigned
int
_index) = 0;
305
311
public
:
virtual
void
SetMaxForce
(
int
_index,
double
_force) = 0;
312
318
public
:
virtual
double
GetMaxForce
(
int
_index) = 0;
319
323
public
:
math::Angle
GetAngle
(
int
_index)
const
;
324
327
public
:
virtual
unsigned
int
GetAngleCount
()
const
= 0;
328
338
public
:
void
SetAngle
(
int
_index,
math::Angle
_angle);
339
346
public
:
virtual
math::Vector3
GetLinkForce
(
unsigned
int
_index)
const
= 0;
347
354
public
:
virtual
math::Vector3
GetLinkTorque
(
355
unsigned
int
_index)
const
= 0;
356
362
public
:
virtual
void
SetAttribute
(
const
std::string &_key,
int
_index,
363
const
boost::any &_value) = 0;
364
369
public
:
virtual
double
GetAttribute
(
const
std::string &_key,
370
unsigned
int
_index) = 0;
371
374
public
:
LinkPtr
GetChild
()
const
;
375
378
public
:
LinkPtr
GetParent
()
const
;
379
382
public
:
void
FillMsg
(msgs::Joint &_msg);
383
387
public
:
double
GetInertiaRatio
(
unsigned
int
_index)
const
;
388
393
public
:
math::Angle
GetLowerLimit
(
unsigned
int
_index)
const
;
394
399
public
:
math::Angle
GetUpperLimit
(
unsigned
int
_index)
const
;
400
403
public
:
virtual
void
SetProvideFeedback
(
bool
_enable);
404
406
public
:
virtual
void
CacheForceTorque
() { }
407
410
public
:
double
GetDampingCoefficient
()
const
;
411
415
public
:
math::Pose
GetInitialAnchorPose
();
416
420
protected
:
virtual
math::Angle
GetAngleImpl
(
int
_index)
const
= 0;
421
424
private
:
void
LoadImpl(
const
math::Pose
&_pose);
425
429
private
:
void
ComputeInertiaRatio();
430
432
protected
:
LinkPtr
childLink
;
433
435
protected
:
LinkPtr
parentLink
;
436
438
protected
:
ModelPtr
model
;
439
442
protected
:
math::Vector3
anchorPos
;
443
449
protected
:
math::Pose
anchorPose
;
450
452
protected
:
LinkPtr
anchorLink
;
453
455
protected
:
double
dampingCoefficient
;
456
458
protected
:
gazebo::event::ConnectionPtr
applyDamping
;
459
461
protected
:
double
effortLimit
[
MAX_JOINT_AXIS
];
462
464
protected
:
double
velocityLimit
[
MAX_JOINT_AXIS
];
465
468
protected
:
double
inertiaRatio
[
MAX_JOINT_AXIS
];
469
471
protected
:
math::Angle
lowerLimit
[
MAX_JOINT_AXIS
];
472
474
protected
:
math::Angle
upperLimit
[
MAX_JOINT_AXIS
];
475
478
protected
:
JointWrench
wrench
;
479
481
protected
:
bool
useCFMDamping
;
482
485
private
:
static
sdf::ElementPtr sdfJoint;
486
488
protected
:
bool
provideFeedback
;
489
491
private
: std::vector<std::string> sensors;
492
494
private
:
event::EventT<void ()>
jointUpdate;
495
497
private
:
math::Angle
staticAngle;
498
499
// Added in 2.1 down here to preserve ABI
503
public
:
virtual
void
SetEffortLimit
(
unsigned
int
_index,
double
_effort);
504
};
506
}
507
}
508
#endif