Hi Ane,
I use PlanningSceneInterface for this
http://docs.ros.org/jade/api/moveit_ros_planning_interface/html/classmoveit_1_1planning__interface_1_1PlanningSceneInterface.htmlThen you need to know that this will only publish a "polite request to attach this at some time", so there is no guarantee that your PlanningScene has been updated yet and it's even less likely that your local RobotState has received these updates.
So you might want to sleep a bit and then force an update, quoting myself from another discussion
> please have a look at this post, it's an acceptable workaround for me at the moment:
>
https://groups.google.com/d/msg/moveit-users/ZYsWL1jRWyY/K0ia02WC4JYJ> make sure to scope the second part of the code with { } or put it in a function to kill the lock object before using it again.
or, as I do it, get a local detached PlanningScene, attach to it and to the real one (via planningSceneInterface) and then do the planning using the local copy. (A PlanningScene can be viewed as a static snapshot of your environment at a certain point in time, there can be many of them and you can play around with them. The "authoritative" one is the one provided and updated by PlanningSceneUpdater of move group)
You're welcome
Simon