Ask Your Question
0

moveit function stop can not work rightly

asked 2020-02-26 02:54:18 -0500

pikachu gravatar image

updated 2020-02-26 03:19:40 -0500

gvdhoorn gravatar image

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!

edit retag flag offensive close merge delete

Comments

Where does this code break? What happens if you increase the sleep? Can you make a minimal example where switching execute and asyncExecute causes the problem to happen?

fvd gravatar image fvd  ( 2020-02-26 20:23:50 -0500 )edit

image description

Hello everyone, this is information of rviz, and i think this means rviz receives stop message but doesn't stop.

pikachu gravatar image pikachu  ( 2020-02-26 21:03:52 -0500 )edit

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.

pikachu gravatar image pikachu  ( 2020-02-26 21:06:14 -0500 )edit

1 Answer

Sort by » oldest newest most voted
0

answered 2020-02-27 04:35:50 -0500

pikachu gravatar image

hello everyone! i have sloved this problem. the code is right and has nothing rong. The problem is that i used wrong controller called arbotix. with ros_controller, the code can work normally.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2020-02-26 02:54:18 -0500

Seen: 39 times

Last updated: Feb 27