Class
List
Hierarchy
Links
SDF Website
Report Documentation Issues
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Friends
Macros
Groups
Pages
include
sdf
parser_urdf.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 URDF2SDF_HH
18
#define URDF2SDF_HH
19
20
#include <tinyxml.h>
21
#include <vector>
22
#include <string>
23
#include <map>
24
25
#include "
sdf/Types.hh
"
26
#include "
sdf/Console.hh
"
27
28
namespace
sdf
29
{
32
34
class
SDFExtension
35
{
36
private
:
SDFExtension
()
37
{
38
material
.clear();
39
visual_blobs
.clear();
40
setStaticFlag
=
false
;
41
gravity
=
true
;
42
isDampingFactor
=
false
;
43
isMaxContacts
=
false
;
44
isMaxVel
=
false
;
45
isMinDepth
=
false
;
46
fdir1
.clear();
47
isMu1
=
false
;
48
isMu2
=
false
;
49
isKp
=
false
;
50
isKd
=
false
;
51
selfCollide
=
false
;
52
isLaserRetro
=
false
;
53
isStopCfm
=
false
;
54
isStopErp
=
false
;
55
isStopKp =
false
;
56
isStopKd =
false
;
57
isInitialJointPosition
=
false
;
58
isFudgeFactor
=
false
;
59
isProvideFeedback
=
false
;
60
isImplicitSpringDamper
=
false
;
61
blobs
.clear();
62
63
dampingFactor
= 0;
64
maxContacts
= 0;
65
maxVel
= 0;
66
minDepth
= 0;
67
mu1
= 0;
68
mu2
= 0;
69
kp
= 100000000;
70
kd
= 1;
71
laserRetro
= 101;
72
stopCfm
= 0;
73
stopErp
= 0.1;
74
stopKp = 100000000;
75
stopKd = 1;
76
initialJointPosition
= 0;
77
fudgeFactor
= 1;
78
79
provideFeedback
=
false
;
80
implicitSpringDamper
=
false
;
81
};
82
83
private
:
SDFExtension
(
const
SDFExtension
&ge)
84
{
85
material
= ge.
material
;
86
visual_blobs
= ge.
visual_blobs
;
87
setStaticFlag
= ge.
setStaticFlag
;
88
gravity
= ge.
gravity
;
89
isDampingFactor
= ge.
isDampingFactor
;
90
isMaxContacts
= ge.
isMaxContacts
;
91
isMaxVel
= ge.
isMaxVel
;
92
isMinDepth
= ge.
isMinDepth
;
93
fdir1
= ge.
fdir1
;
94
isMu1
= ge.
isMu1
;
95
isMu2
= ge.
isMu2
;
96
isKp
= ge.
isKp
;
97
isKd
= ge.
isKd
;
98
selfCollide
= ge.
selfCollide
;
99
isLaserRetro
= ge.
isLaserRetro
;
100
isStopKp = ge.isStopKp;
101
isStopKd = ge.isStopKd;
102
isStopCfm
= ge.
isStopCfm
;
103
isStopErp
= ge.
isStopErp
;
104
isInitialJointPosition
= ge.
isInitialJointPosition
;
105
isFudgeFactor
= ge.
isFudgeFactor
;
106
isProvideFeedback
= ge.
isProvideFeedback
;
107
isImplicitSpringDamper
= ge.
isImplicitSpringDamper
;
108
provideFeedback
= ge.
provideFeedback
;
109
implicitSpringDamper
= ge.
implicitSpringDamper
;
110
oldLinkName
= ge.
oldLinkName
;
111
reductionTransform
= ge.
reductionTransform
;
112
blobs
= ge.
blobs
;
113
114
dampingFactor
= ge.
dampingFactor
;
115
maxContacts
= ge.
maxContacts
;
116
maxVel
= ge.
maxVel
;
117
minDepth
= ge.
minDepth
;
118
mu1
= ge.
mu1
;
119
mu2
= ge.
mu2
;
120
kp
= ge.
kp
;
121
kd
= ge.
kd
;
122
laserRetro
= ge.
laserRetro
;
123
stopKp = ge.stopKp;
124
stopKd = ge.stopKd;
125
stopCfm
= ge.
stopCfm
;
126
stopErp
= ge.
stopErp
;
127
initialJointPosition
= ge.
initialJointPosition
;
128
fudgeFactor
= ge.
fudgeFactor
;
129
};
130
131
// for reducing fixed joints and removing links
132
public
: std::string
oldLinkName
;
133
public
:
sdf::Pose
reductionTransform
;
134
135
// visual
136
public
: std::string
material
;
137
public
: std::vector<boost::shared_ptr<TiXmlElement> >
visual_blobs
;
138
139
// body, default off
140
public
:
bool
setStaticFlag
;
141
public
:
bool
gravity
;
142
public
:
bool
isDampingFactor
;
143
public
:
double
dampingFactor
;
144
public
:
bool
isMaxContacts
;
145
public
:
int
maxContacts
;
146
public
:
bool
isMaxVel
;
147
public
:
double
maxVel
;
148
public
:
bool
isMinDepth
;
149
public
:
double
minDepth
;
150
public
:
bool
selfCollide
;
151
152
// geom, contact dynamics
153
public
:
bool
isMu1
,
isMu2
,
isKp
,
isKd
;
154
public
:
double
mu1
,
mu2
,
kp
,
kd
;
155
public
: std::string
fdir1
;
156
public
:
bool
isLaserRetro
;
157
public
:
double
laserRetro
;
158
159
// joint, joint limit dynamics
160
public
:
bool
isStopCfm
,
isStopErp
,
isInitialJointPosition
,
isFudgeFactor
;
161
public
:
double
stopCfm
,
stopErp
,
initialJointPosition
,
fudgeFactor
;
162
public
:
bool
isProvideFeedback
;
163
public
:
bool
provideFeedback
;
164
public
:
bool
isImplicitSpringDamper
;
165
public
:
bool
implicitSpringDamper
;
166
private
:
bool
isStopKp, isStopKd;
167
private
:
double
stopKp, stopKd;
168
169
// blobs into body or robot
170
public
: std::vector<boost::shared_ptr<TiXmlElement> >
blobs
;
171
172
friend
class
URDF2SDF
;
173
};
174
176
class
URDF2SDF
177
{
179
public
:
URDF2SDF
();
180
182
public
:
~URDF2SDF
();
183
187
public
: TiXmlDocument
InitModelDoc
(TiXmlDocument* _xmlDoc);
188
192
public
: TiXmlDocument
InitModelFile
(
const
std::string &_filename);
193
199
public
: TiXmlDocument
InitModelString
(
const
std::string &_urdfStr,
200
bool
_enforceLimits =
true
);
201
204
private
:
void
ParseSDFExtension(TiXmlDocument &_urdfXml);
205
207
private
:
void
ListSDFExtensions();
208
210
private
:
void
ListSDFExtensions(
const
std::string &_reference);
211
};
213
}
214
215
#endif