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

Trajectory Components with ToolNone #117

Open
Artificys opened this issue Mar 27, 2024 · 1 comment
Open

Trajectory Components with ToolNone #117

Artificys opened this issue Mar 27, 2024 · 1 comment

Comments

@Artificys
Copy link

So, as far as I can tell, JointTrajectoryAction will always throw an error if there is no tool on the Stretch.
When trying to execute the callback, on line 285 it'll clear each joint's trajectory manager. However, when it gets to the GripperComponent, since there is no 'device' named 'stretch_gripper' on the robot, it returns a NoneType with no trajectory_manager and will fail the trajectory.

I don't have the error anymore because I fixed it, but if needed I can undo it and get the error again.

My fix for it was to add another check in the trajectory_components.py:

def get_trajectory_components(robot):
    robot_status = robot.get_status()
    if 'wrist_pitch' in robot_status['end_of_arm']:
        return {component.name: component for component in [HeadPanComponent(robot),
                                                            HeadTiltComponent(robot),
                                                            WristYawComponent(robot),
                                                            WristPitchComponent(robot),
                                                            WristRollComponent(robot),
                                                            GripperComponent(robot),
                                                            ArmComponent(robot),
                                                            LiftComponent(robot),
                                                            BaseComponent(robot),
                                                            ]}
    elif 'stretch_gripper' in robot_status['end_of_arm']:
        return {component.name: component for component in [HeadPanComponent(robot),
                                                            HeadTiltComponent(robot),
                                                            WristYawComponent(robot),
                                                            GripperComponent(robot),
                                                            ArmComponent(robot),
                                                            LiftComponent(robot),
                                                            BaseComponent(robot),
                                                            ]}
    else:
        return {component.name: component for component in [HeadPanComponent(robot),
                                                            HeadTiltComponent(robot),
                                                            WristYawComponent(robot),
                                                            ArmComponent(robot),
                                                            LiftComponent(robot),
                                                            BaseComponent(robot),
                                                            ]}

Not sure if this is the correct way of doing this, but for now this fixes the error and lets the trajectory continue.

@Artificys
Copy link
Author

This was also found while following the Align To Aruco example - which I know isn't in the new V0.3 docs, but the tutorial code is still there. Not sure if that matters, but worth noting.

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

No branches or pull requests

1 participant