Open Pedroacsilva opened 1 year ago
Thanks for reporting an issue. Because we're a volunteer community, providing a pull request with suggested changes is always welcomed.
MoveIt's MoveGroupInterface (MGI) and PlanningSceneInterface (PSI) both themselves make heavy use of ROS message communication. As you are calling them from the one and only spinner thread handling ROS messages, these messages cannot be served. Create a class instantiating (and keeping) MGI and PSI for its whole life time and make your callback a method of that class. That should solve your issue.
Description
I'm trying to implement a std_msgs::String callback that would read a JSON message containing the target pose coordinates. I am starting from the following tutorial.
My first attempt was the following:
With the main function being:
When I publish a message, triggering this callback, I get the following console output and a segmentation fault:
Your environment
Expected behaviour
I would expect to see a movement plan on RVIZ after publishing one message in this topic.
Basically, my question is, what would be the best way to implement MoveIt in ROS Callback functions?
EDIT: Ok I think I fixed it. I needed to construct an AsyncSpinner with 2 threads instead of one: one thread for the callback and another one for MoveIt, I guess?