Created
March 8, 2022 15:32
-
-
Save JaldertVicarious/e6ef409da6759fda86e70e1918a26ed7 to your computer and use it in GitHub Desktop.
A hacky script to check URDF / SDF gripper tooling consistency.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import annotations | |
def get_robot_ee_info(path: str) -> dict[str, str]: | |
with open(path, 'r') as fh: | |
all = fh.readlines() | |
robot_ee_info = dict() | |
for line in all: | |
line = line.strip() | |
robot_ee_id, type = line.split(":") | |
robot_ee_info[robot_ee_id] = type | |
return robot_ee_info | |
def main(): | |
urdf_ee_info = get_robot_ee_info("urdf_cups") # or cups | |
sdf_ee_info = get_robot_ee_info("sdf_cups") # or cups | |
for key, value in urdf_ee_info.items(): | |
if key not in sdf_ee_info: | |
print(f"Missing from SDF {key}") | |
continue | |
if sdf_ee_info[key] != value: | |
print(f"Mismatch for robot {key}: urdf had {value}, sdf had {sdf_ee_info[key]}") | |
print("fingers") | |
urdf_ee_info = get_robot_ee_info("urdf_fingers") # or cups | |
sdf_ee_info = get_robot_ee_info("sdf_fingers") # or cups | |
for key, value in urdf_ee_info.items(): | |
if key not in sdf_ee_info: | |
print(f"Missing from SDF {key}") | |
continue | |
if sdf_ee_info[key] != value: | |
print(f"Mismatch for robot {key}: urdf had {value}, sdf had {sdf_ee_info[key]}") | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment