mikeferguson / chessbox

It's like a sandbox -- for robot chess
8 stars 3 forks source link

Add removeAttached() to object_interface.py in moveit_utils #11

Closed pirobot closed 10 years ago

pirobot commented 10 years ago

I was trying to add a function removeAttached() to object_interface.py in moveit_utils but I'm getting stuck on syntax. This is what I am currently trying:

def removeAttached(self, link_name, name, wait = True):
    """ Remove an attached object. """
    o = AttachedCollisionObject()
    o.object.header.stamp = rospy.Time.now()
    o.object.header.frame_id = self._fixed_frame
    o.object.id = name
    o.object.operation = o.object.REMOVE
    o.link_name = link_name

    try:
        del self._attached_objects[name]
    except KeyError:
        pass

    self._attached_pub.publish(o)
    if wait:
        self.waitForSync()

When I run this near the top of my script to remove an attached object from a previous run of the script, my script generates the following error:

[INFO] [WallTime: 1391887282.006127] Waiting for get_planning_scene [ERROR] [WallTime: 1391887284.021650] ObjectManager: sync timed out.

What am I missing?

mikeferguson commented 10 years ago

WaitForSync also needs some adjustments I think, the delete part doesn't handle attached_objects yet.

pirobot commented 10 years ago

OK, thanks. I can use the PlanningSceneInterface() object directly for now.

mikeferguson commented 10 years ago

@pirobot Just a heads up -- moveit_utils is going away, moved to https://github.com/mikeferguson/moveit_python -- and this feature is implemented there in the new PlanningSceneInterface class that replaces ObjectManager

mikeferguson commented 10 years ago

And moveit_python is in debs for hydro and indigo -- indigo just sync'd, I imagine hydro isn't far behind.