Skip to content

Commit f0a292e

Browse files
committed
Fix model_testing.py
Relates to #336
1 parent 866d796 commit f0a292e

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

phobos/ci/model_testing.py

+9-7
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@ def __init__(self, new_model, compare_model=None):
2525
self.old_hyrodyn = None
2626
self.new_hml_test = get_load_report(self.new.robot.xmlfile, self.new.robot.submechanisms_file)
2727
self.new_sm_hml_test = []
28-
if len([x for x in self.new.robot.submodel_defs if not x["name"].startswith("#submech#")]) > 0:
28+
if len([x for name, x in self.new.robot.submodel_defs.items() if not name.startswith("#submech#")]) > 0:
2929
sm_path = os.path.join(self.new.exportdir, "submodels")
30-
for au in self.new.robot.submodel_defs:
31-
if au["name"].startswith("#submech#"):
30+
for name, au in self.new.robot.submodel_defs.items():
31+
if name.startswith("#submech#"):
3232
continue
3333
self.new_sm_hml_test += [{
34-
"name": au["name"],
35-
"urdf": os.path.join(sm_path, au["name"], "urdf", au["name"] + ".urdf"),
36-
"submech": os.path.normpath(os.path.join(sm_path, au["name"], "smurf", au["name"] + "_submechanisms.yml"))
34+
"name": name,
35+
"urdf": os.path.join(sm_path, name, "urdf", name + ".urdf"),
36+
"submech": os.path.normpath(os.path.join(sm_path, name, "smurf", name + "_submechanisms.yml"))
3737
}]
3838
self.new_sm_hml_test[-1]["report"] = get_load_report(
3939
self.new_sm_hml_test[-1]["urdf"],
@@ -267,10 +267,12 @@ def test_compare_amount_joints(self):
267267
return len(self.new.robot.joints) == len(self.old.joints)
268268

269269
def test_load_in_pybullet(self):
270-
if not PYBULLET_AVAILABLE:
271270
log.warning('Pybullet not present')
272271
return True
272+
from ..defs import check_pybullet_available
273+
if not check_pybullet_available():
273274
try:
275+
import pybullet as pb
274276
client = pb.connect(pb.DIRECT)
275277
pb.loadURDF(os.path.join(self.new.robot.xmlfile), physicsClientId=client)
276278
pb.disconnect(client)

0 commit comments

Comments
 (0)