moveit function stop can not work rightly
Hello,everyone, i am trying to stop the moving trajectory of robot arm in the rviz, and im using function asyncmove()and function stop(),but it is not work. The rviz can receive stop command, but robot continue to move. and i found if i push plan and execute button on the motion_planning_plugin in rviz, and use stop function i wrote, it works successfully. however, when i use function asyncmove(), it can not stop. Why? And How can i fix it? these are my src and scripts(i also try python)
moveit::planning_interface::MoveGroupInterface::Plan my_plan;
moveit::planning_interface::MoveItErrorCode success = group.plan(my_plan)
group.asyncexecute(my_plan);
sleep(1);
group.stop();
sleep(1);
plan=arm.plan()
arm.execute(plan,wait=False)
rospy.loginfo("move home finished")
rospy.sleep(0.5)
arm.stop()
rospy.loginfo("stoped")
rospy.sleep(0.5)
moveit_commander.roscpp_shutdown()
Thank you!
Where does this code break? What happens if you increase the sleep? Can you make a minimal example where switching
execute
andasyncExecute
causes the problem to happen?Hello everyone, this is information of rviz, and i think this means rviz receives stop message but doesn't stop.
Hello! This code has no error and can run. But arm robot in rviz just doesn't stop. I have tried lots of sleep time, but they are all same. if i used execute rather than asyncexecute, arm robot would finish excuting and then stop, which dose not suits my need.