While having [panda_moveit_config's](https://github.com/ros-planning/panda_moveit_config) panda_moveit.launch up and running a position controller, loading objects in the planning scene with `moveit::planning_interface::PlanningSceneInterface::addCollisionObjects` results in error `Unable to transform from frame 'world' to frame '/panda_link0'. Returning identity.`.
I tracked down the issue to [moveit::core::getTransform](https://github.com/ros-planning/moveit/blob/68eb44ded1ca665dfab81fc5c615a81f95409291/moveit_core/transforms/src/transforms.cpp#L89) which I suppose gets called by the interface which calls methods from `planning_scene`, probably [here](https://github.com/ros-planning/moveit/blob/68eb44ded1ca665dfab81fc5c615a81f95409291/moveit_core/planning_scene/src/planning_scene.cpp#L82).
However, I'm 100% sure the transform exists before publishing the objects, because I sleep until it's available with `!buffer_.canTransform("panda_link0", "world", ros::Time {0}))` (where `buffer_` is a `tf2_ros::Buffer`) and I can see it if I `rosrun tf2_tools view_frames.py`.
Looking more into it, I found it likely needs to update the internal map of transforms used for the `planning_scene`, however the only call I could find to force this is in [planning_scene_monitor](https://github.com/ros-planning/moveit/blob/3e1670a6fe6d11750036a5a377d1b700c1e47f11/moveit_ros/planning/planning_scene_monitor/include/moveit/planning_scene_monitor/planning_scene_monitor.h#L298) which IIRC is not recommended to be used, and uses `tf` instead of `tf2` in the only constructor I could call. From this stems the title question. Is there otherwise an alternative to get a pointer to an existing monitor from `MoveGroup`/`PlanningSceneInterface`/something else that I didn't see?
[This issue](https://github.com/ros-planning/moveit/issues/323) is also noteworthy, as it discusses the solution I would have found, however it doesn't seem ideal to post directly there since it's 2y old.
↧