Skip to content

Commit

Permalink
Fix model_testing.py
Browse files Browse the repository at this point in the history
Relates to #336
  • Loading branch information
hwiedPro committed Feb 13, 2024
1 parent 866d796 commit f0a292e
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions phobos/ci/model_testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ def __init__(self, new_model, compare_model=None):
self.old_hyrodyn = None
self.new_hml_test = get_load_report(self.new.robot.xmlfile, self.new.robot.submechanisms_file)
self.new_sm_hml_test = []
if len([x for x in self.new.robot.submodel_defs if not x["name"].startswith("#submech#")]) > 0:
if len([x for name, x in self.new.robot.submodel_defs.items() if not name.startswith("#submech#")]) > 0:
sm_path = os.path.join(self.new.exportdir, "submodels")
for au in self.new.robot.submodel_defs:
if au["name"].startswith("#submech#"):
for name, au in self.new.robot.submodel_defs.items():
if name.startswith("#submech#"):
continue
self.new_sm_hml_test += [{
"name": au["name"],
"urdf": os.path.join(sm_path, au["name"], "urdf", au["name"] + ".urdf"),
"submech": os.path.normpath(os.path.join(sm_path, au["name"], "smurf", au["name"] + "_submechanisms.yml"))
"name": name,
"urdf": os.path.join(sm_path, name, "urdf", name + ".urdf"),
"submech": os.path.normpath(os.path.join(sm_path, name, "smurf", name + "_submechanisms.yml"))
}]
self.new_sm_hml_test[-1]["report"] = get_load_report(
self.new_sm_hml_test[-1]["urdf"],
Expand Down Expand Up @@ -267,10 +267,12 @@ def test_compare_amount_joints(self):
return len(self.new.robot.joints) == len(self.old.joints)

def test_load_in_pybullet(self):
if not PYBULLET_AVAILABLE:
log.warning('Pybullet not present')
return True
from ..defs import check_pybullet_available
if not check_pybullet_available():
try:
import pybullet as pb
client = pb.connect(pb.DIRECT)
pb.loadURDF(os.path.join(self.new.robot.xmlfile), physicsClientId=client)
pb.disconnect(client)
Expand Down

0 comments on commit f0a292e

Please sign in to comment.