ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

The plan function returns an error code. You can check this error code for success, using this example from the tutorial:

bool success = (move_group.plan(my_plan) == moveit::planning_interface::MoveItErrorCode::SUCCESS);

ROS_INFO_NAMED("tutorial", "Plan 1 (pose goal) %s", success ? "succeeded" : "FAILED");

All the error codes are listed here.

The plan function returns an error code. You can check this error code for success, using this example from the tutorial:

bool success = (move_group.plan(my_plan) == moveit::planning_interface::MoveItErrorCode::SUCCESS);

ROS_INFO_NAMED("tutorial", "Plan 1 (pose goal) %s", success ? "succeeded" : "FAILED");

All the error codes are listed here.


The Python interface also has a plan function. For reference, all the Python move_group's functions are defined in this file. Change to the branch of your release (melodic-devel, kinetic-devel...) if you are not building from source.

The plan function returns the plan instead of an error code. To check for success, you can check that the trajectory is not empty:

plan = move_group.plan()
if plan.joint_trajectory.points:  # True if trajectory contains points
  move_success = move_group.execute(plan)
else:
  rospy.logerr("Trajectory is empty. Planning was unsuccessful.")

This should work in Melodic (and Kinetic, I believe), but the API might be changing in the future (it seems like it is already different in the master branch). Feel free to add this use case to the tutorial. A pull request is very welcome.

PS: The errors in your post look like they are caused by your robot being in an invalid pose. Maybe you are restricting the possible joint angles in your moveit_config, and your robot arm is in a different configuration? E.g. is the elbow flipped, or a joint at +- 2*pi? Does the robot look correct in Rviz? Don't forget to set the orientation for your pose_target, too.

The plan function returns an error code. You can check this error code for success, using this example from the tutorial:

bool success = (move_group.plan(my_plan) == moveit::planning_interface::MoveItErrorCode::SUCCESS);

ROS_INFO_NAMED("tutorial", "Plan 1 (pose goal) %s", success ? "succeeded" : "FAILED");

All the error codes are listed here.


The Python interface also has a plan function. For reference, all the Python move_group's functions are defined in this file. Change to the branch of your release (melodic-devel, kinetic-devel...) if you are not building from source.

The plan function returns the plan instead of an error code. To check for success, you can check that the trajectory is not empty:

plan = move_group.plan()
if plan.joint_trajectory.points:  # True if trajectory contains points
  move_success = move_group.execute(plan)
else:
  rospy.logerr("Trajectory is empty. Planning was unsuccessful.")

This should work in Melodic (and Kinetic, I believe), but the API might be changing in the future (it seems like it is already different in the master branch). Feel free to add this use case to the tutorial. A pull request is very welcome.

PS: The errors in your post look like they are caused by your robot being in an invalid pose. Maybe you are restricting the possible joint angles in your moveit_config, and your robot arm is in a different configuration? E.g. is the elbow flipped, or a joint at +- 2*pi? Does the robot look correct in Rviz? Don't forget to set the orientation for your pose_target, too.