Best way to add new gripper for SE3

I made a 2 finger gripper that uses 2 dynamixels to control each finger. I’m planning on swapping out the Stretch gripper with my gripper and I’d like to know what the minimal necessary changes would have to be to get decent functionality. I’m thinking I create a new gripper class analogous to the StretchGripper class but instead of inheriting from DynamixelHelloXL430, it instantiates 2 composite DynamixelHelloXL430 objects. And then more or less, I’d have to rewrite the StretchGripper class with any interaction with the parent DynamixelHelloXL430 being done to the composed DynamixelHelloXL430s. What do you think of this approach? Any advice, recommendations, or warnings? Thanks!

2 Likes

Hey @themeede, what should the gripper’s API look like? Is it left_finger.move_to(x); right_finger.move_to(x) or gripper.move_to(<width>)? If it’s the latter, then I think your approach makes sense. I’d extend DynamixelXChain (if the fingers are chained) and implement the math to convert <width> into individual finger positions.

Independently, you’ll also want to implement a “tool” class by extending the EndOfArm class. It’s basically a chain of Dynamixel-based joints, and it’s how all of Stretch’s tools are currently defined. This “tool” gets instantiated at runtime as robot.end_of_arm in Python and in the action server in ROS2. In conjunction to the class, there are parameters that govern its behavior. In robot_params_SE3.py, there’s Python dictionaries for each tool, e.g. SE3_eoa_wrist_dw3_tool_nil, which has keys like “baud” and “devices”, that govern which joints are part of the tool and how they behave. Mohamed’s PR for the Aloha 2 gripper nicely encompasses everything needed code-wise to add a new gripper.

Thanks for asking this on the forum. Our documentation for adding new grippers is pretty sparse right now. I’m hoping we can improve it soon. In the meantime, I’m happy to answer any questions that come up.

1 Like

Thank you @bshah! Do you have any advice for how to get the robot to identify the new gripper as an end effector? It’s currently defaulting to the eoa_wrist_dw3_tool_tablet_12in

1 Like

Yes, that’s the robot.tool parameter. You change it to the name of your tool.

1 Like

Do you think you could elaborate on your response above where you suggested to extend the DynamixelXChain? Is there an example of this in action we could take inspiration from? I created a new gripper class that extended DynamixelXChain but was unsure how to actually use it for motion commands like move_by.