Is it proper way to use async spinner?

asked 2019-03-14 06:11:34 -0500

mkt gravatar image

I'm modifying moveIt packages, to adjust them to my requirements. In one method I need to obtain the current state of the visualized robot. For this I found api -> *move_group -> getCurrentState();

I tried to call this method, but it returns an error. I found that for it to work properly, there must be async spinner running. I don't need an async spinner for any other operations and I don't want to start it and keep running for the whole program life.

So i made it like this:

ros::AsyncSpinner spinner(1);
spinner.start();
const robot_state::RobotState& state = *move_group_->getCurrentState(1);
spinner.stop();

Can You tell me - is this the proper way to use async spinner, or should I think about some other solution?

edit retag flag offensive close merge delete