Skip to content

Commit

Permalink
Do not filter links that have children.
Browse files Browse the repository at this point in the history
  • Loading branch information
Giulero committed Jun 10, 2024
1 parent f65d0d6 commit 537db7c
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions src/adam/model/std_factories/std_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,8 @@ def __init__(self, path: str, math: SpatialMath):
if not path.exists():
raise FileExistsError(path)

# Read URDF, but before passing it to urdf_parser_py get rid of all sensor tags
# sensor tags are valid elements of URDF (see ),
# but they are ignored by urdf_parser_py, that complains every time it sees one.
# As there is nothing to be fixed in the used models, and it is not useful
# to have a useless and noisy warning, let's remove before hands all the sensor elements,
# that anyhow are not parser by urdf_parser_py or adam
# See https://github.com/ami-iit/ADAM/issues/59
xml_file = open(path, "r")
xml_string = xml_file.read()
xml_file.close()
with open(path, "r") as xml_file:
xml_string = xml_file.read()
xml_string_without_sensors_tags = urdf_remove_sensors_tags(xml_string)
self.urdf_desc = urdf_parser_py.urdf.URDF.from_xml_string(
xml_string_without_sensors_tags
Expand All @@ -66,15 +58,21 @@ def get_links(self) -> List[StdLink]:
List[StdLink]: build the list of the links
"""
return [
self.build_link(l) for l in self.urdf_desc.links if l.inertial is not None
self.build_link(l)
for l in self.urdf_desc.links
if (l.inertial is not None or l.name in self.urdf_desc.child_map.keys())
]

def get_frames(self) -> List[StdLink]:
"""
Returns:
List[StdLink]: build the list of the links
"""
return [self.build_link(l) for l in self.urdf_desc.links if l.inertial is None]
return [
self.build_link(l)
for l in self.urdf_desc.links
if l.inertial is None and l.name not in self.urdf_desc.child_map.keys()
]

def build_joint(self, joint: urdf_parser_py.urdf.Joint) -> StdJoint:
"""
Expand Down

0 comments on commit 537db7c

Please sign in to comment.