ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

faster way to disable and enable collision check between gripper and object

asked 2020-08-19 03:42:04 -0600

xibeisiber gravatar image

Hi all,

Currently when trying to disable the collision check among (gripper, object, octomap) before grasping the object and enable the collison check among (gripper, object, octomap) after the object is grasped, I use the method mentioned in this pose.

It works well. But it takes some time to complete these operations on planning_scene_interface. Therefore the gripper always waits for a few seconds to grasp the object and wait for a few seconds to move again..

Is there an easier way to do this?

edit retag flag offensive close merge delete

Comments

1

If you implement your ACM modification directly in the move_group node (as a MoveGroupCapability) you can get around this heavy interface and for example implement your own rosservice.

Allowing for incremental ACM modifications is an open in the MoveIt repository and would make the operation much faster. Contributions are encouraged! If nobody spends time implementing things when they experience problems with them, they sadly do not improve by themselves...

v4hn gravatar image v4hn  ( 2020-08-19 04:50:06 -0600 )edit

thanks very much for your clarification@v4hn. That implementation would be very useful! I will try to see what I can do after I peruse the source code..

xibeisiber gravatar image xibeisiber  ( 2020-08-19 07:57:58 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2020-08-19 04:39:24 -0600

HappyBit gravatar image

I don't see a different way. One slight enhancement tho. In the post mentioned, the node waits 2 seconds. You can also write a function that checks the planning scene and makes sure your update got noted. I saw a snippet on the internet with something similar to this:

# Ensuring Collision Updates Are Received
def wait_till_updated(pl_scene, obj_name, attached, known, sleep_duration=0.5):
    """
    Wait until the planning scene was updated
    :param pl_scene: planning scene
    :param obj_name: name of the object to be updated
    :param attached: is the object now attached
    :param known: is the object now known
    :param sleep_duration: sleep between checks
    :return: success
    """
    start = rospy.get_time()
    seconds = rospy.get_time()
    timeout = 5
    while (seconds - start < timeout) and not rospy.is_shutdown():
        # Test if the object is in attached objects
        attached_objects = pl_scene.get_attached_objects([obj_name])
        is_attached = len(attached_objects.keys()) > 0
        rospy.logdebug("[wait_till_updated] Attached Objects: %s" % attached_objects.keys())

        # Test if the object is in the scene.
        # Note that attaching the box will remove it from known_objects
        is_known = obj_name in pl_scene.get_known_object_names()
        rospy.logdebug("[wait_till_updated] Known Objects: %s" %  
                       pl_scene.get_known_object_names())

        # Test if we are in the expected state
        if (attached == is_attached) and (known == is_known):
            return True

        # Sleep so that we give other threads time on the processor
        rospy.logdebug("[wait_till_updated] Waiting ...")
        rospy.sleep(sleep_duration)
        seconds = rospy.get_time()
edit flag offensive delete link more

Comments

Thanks for your reply. Currently, I didn't wait and check whether the scene is updated. But the check will be very useful.

xibeisiber gravatar image xibeisiber  ( 2020-08-19 08:01:39 -0600 )edit

Question Tools

2 followers

Stats

Asked: 2020-08-19 03:42:04 -0600

Seen: 903 times

Last updated: Aug 19 '20