Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Catch RTDE exceptions in URrtde constructor #143

Open
Victorlouisdg opened this issue Mar 28, 2024 · 2 comments
Open

Catch RTDE exceptions in URrtde constructor #143

Victorlouisdg opened this issue Mar 28, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@Victorlouisdg
Copy link
Contributor

Sometimes connecting the to robot fails with weird errors. This often happens after protective stops or emergency stops. Restarting your script usually solves this. However it would be nice if airo-mono tries a few times itself, e.g:

max_attempts = 3
for i in range(max_attempts):
    try:
        gripper_left = Robotiq2F85(ip_address_left)
        robot_left = URrtde(ip_address_left, URrtde.UR3E_CONFIG, gripper_left)

        gripper_right = Robotiq2F85(ip_address_right)
        robot_right = URrtde(ip_address_right, URrtde.UR3E_CONFIG, gripper_right)

        dual_arm = DualArmPositionManipulator(robot_left, X_W_LCB, robot_right, X_W_RCB)
        return dual_arm
    except RuntimeError as e:
        print(f"Failed to connect to UR5e robots. Attempt {i+1}/{max_attempts}. Error:\n {e}")
        if i == max_attempts - 1:
            raise e
        time.sleep(2)

This works for me for the cloth competition, example of it saving me a little time:
Screenshot from 2024-03-28 10-28-20

@Victorlouisdg Victorlouisdg added the enhancement New feature or request label Mar 28, 2024
@tlpss
Copy link
Contributor

tlpss commented Mar 28, 2024

I think we should only add this to the 'real' hardware classes? not to the Bimanual interfaces on top of them?

@Victorlouisdg
Copy link
Contributor Author

Agreed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants