facebookresearch / fairo

A modular embodied agent architecture and platform for building embodied agents
MIT License
852 stars 92 forks source link

[Polymetis] Gripper stuck #1418

Open buoyancy99 opened 10 months ago

buoyancy99 commented 10 months ago

Type of Issue

Select the type of issue:

Description

A while ago, this issue found an issue when using polymetis to control franka gripper. This is a very critical problem as one cannot control gripper to grasp one object and release it.

This PR offers a partial fix to the issue, but on real robots this doesn't completely solve the problem.

Instead, one should follow the official C++ example from franka to achieve the desired behavior of getting gripper unstuck from previous commands. This example essentially calls gripper.stop() to terminate a previous command that cannot be achieved, whenever a new command is about to be sent.

This requires us to expose the GripperInterface.stop API, so one can call GripperInterface.stop() before GripperInterface.goto or GripperInterface.grasp to get gripper unstuck.

Current Behavior

gripper = GripperInterface()

gripper.grasp(speed=0.5, force=3.0)
# let's say robot grabs a 3cm by 3cm block

gripper.goto(width=0.08, speed=0.5, force=3.0)
# expect the robot to release the object
# the robot actually cannot release the object itself! 
# this is because previous grasp command asks it to go to width=0.0, which cannot be achieved due to the block

Expected Behavior

gripper = GripperInterface()

gripper.grasp(speed=0.5, force=3.0)
# let's say robot grabs a 3cm by 3cm block

gripper.stop()  # this is added by my PR
gripper.goto(width=0.08, speed=0.5, force=3.0)
# expect the robot to release the object

Steps to reproduce

See above

Links to any relevant pastes or documents

official C++ example to teleop gripper grasping from libfranka

buoyancy99 commented 10 months ago

I've already fixed the bug by exposing a python API, and tested it on hardware to get the desired behavior

see PR