Skip to content

Commit 0146cf4

Browse files
committed
pr2 working
1 parent 0fa53e4 commit 0146cf4

File tree

6 files changed

+24
-17
lines changed

6 files changed

+24
-17
lines changed

roboticstoolbox/backend/urdf/urdf.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ def _parse(cls, node, path):
153153
and elements in the class arrays.
154154
"""
155155
kwargs = cls._parse_simple_attribs(node)
156+
print(kwargs)
156157
kwargs.update(cls._parse_simple_elements(node, path))
157158
return kwargs
158159

@@ -1212,11 +1213,11 @@ def actuators(self, value): # pragma nocover
12121213
@classmethod
12131214
def _from_xml(cls, node, path):
12141215
kwargs = cls._parse(node, path)
1215-
# print(cls._parse(node, path))
1216-
# if node.find('type') is not None:
1217-
kwargs['trans_type'] = node.find('type').text
1218-
# else:
1219-
# kwargs['trans_type'] = ''
1216+
print(cls._parse(node, path))
1217+
if node.find('type') is not None:
1218+
kwargs['trans_type'] = node.find('type').text
1219+
else:
1220+
kwargs['trans_type'] = ' '
12201221

12211222
return Transmission(**kwargs)
12221223

@@ -1751,7 +1752,8 @@ def __init__(self, name, links, joints=None,
17511752
elinks[i].inertia = link.inertial.inertia
17521753

17531754
try:
1754-
elinks[i].B = self.joints[i].dynamics.friction
1755+
if self.joints[i].dynamics.friction is not None:
1756+
elinks[i].B = self.joints[i].dynamics.friction
17551757

17561758
# TODO Add damping
17571759
self.joints[i].dynamics.damping

roboticstoolbox/backend/xacro/__init__.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,8 @@ def eval_extension(s): # pragma: no cover
200200
return os.getcwd()
201201

202202
if s.startswith('$(find'):
203-
# return tld
204-
return '..'
203+
return tld
204+
# return '..'
205205

206206
if s.startswith('$(arg'):
207207
s = s.replace('$(arg ', '')
@@ -1049,7 +1049,7 @@ def process_file(input_file_name, **kwargs): # pragma: no cover
10491049
return doc
10501050

10511051

1052-
def main(filename): # pragma: no cover
1052+
def main(filename, tld_other=None): # pragma: no cover
10531053
opts = {
10541054
'output': None,
10551055
'just_deps': False,
@@ -1060,7 +1060,11 @@ def main(filename): # pragma: no cover
10601060
}
10611061

10621062
global tld
1063-
tld = Path(filename).parent.as_posix()
1063+
1064+
if tld_other is None:
1065+
tld = '..'
1066+
else:
1067+
tld = tld_other
10641068

10651069
try:
10661070
# open and process file

roboticstoolbox/models/URDF/PR2.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@ def __init__(self):
1212

1313
mpath = Path(rp.__file__).parent
1414
fpath = mpath / 'models' / 'xacro' / 'pr2_description' / 'robots'
15-
fname = 'right_arm.urdf.xacro'
15+
fname = 'pr2.urdf.xacro'
16+
tld = mpath / 'models' / 'xacro' / 'pr2_description'
1617

1718
args = super(PR2, self).urdf_to_ets_args(
18-
(fpath / fname).as_posix())
19+
(fpath / fname).as_posix(), tld)
1920

2021
super(PR2, self).__init__(
2122
args[0],

roboticstoolbox/models/xacro/pr2_description/urdf/forearm_v0/forearm.urdf.xacro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@
120120
</link>
121121
<!-- extensions-->
122122
<xacro:pr2_forearm_gazebo_v0 side="${side}" />
123-
<xacro:pr2_forearm_transmission_v0 side="${side}" />
123+
<!-- <xacro:pr2_forearm_transmission_v0 side="${side}" /> -->
124124

125125
</xacro:macro>
126126

roboticstoolbox/models/xacro/pr2_description/urdf/gripper_v0/gripper.urdf.xacro

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@
353353

354354
<!-- extensions -->
355355
<xacro:pr2_gripper_gazebo_v0 side="${side}" />
356-
<xacro:pr2_gripper_transmission_v0 side="${side}"
356+
<!-- <xacro:pr2_gripper_transmission_v0 side="${side}"
357357
screw_reduction="${screw_reduction}"
358358
gear_ratio="${gear_ratio}"
359359
theta0="${theta0}"
@@ -363,7 +363,7 @@
363363
h="${h}"
364364
a="${a}"
365365
b="${b}"
366-
r="${r}" />
366+
r="${r}" /> -->
367367

368368
</xacro:macro>
369369

roboticstoolbox/robot/ERobot.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,11 +255,11 @@ def fk_dict(self):
255255
# )
256256

257257
@staticmethod
258-
def urdf_to_ets_args(file_path):
258+
def urdf_to_ets_args(file_path, tld=None):
259259
name, ext = splitext(file_path)
260260

261261
if ext == '.xacro':
262-
urdf_string = xacro.main(file_path)
262+
urdf_string = xacro.main(file_path, tld)
263263
urdf = URDF.loadstr(urdf_string, file_path)
264264

265265
return urdf.elinks, urdf.name

0 commit comments

Comments
 (0)