Catch move group error
Hello folks,
When moving my robot i sometimes get errors from the Move Group. For example:
[ INFO] [1685618721.819197275]: Generating PTP trajectory...
[ERROR] [1685618721.829472804]: Inverse kinematics for pose
20
0.4
0.5 has no solution.
[ERROR] [1685618721.829598707]: No IK solution for goal pose
[ INFO] [1685618891.699098837]: Combined planning and execution request received for MoveGroup action. Forwarding to planning and execution pipeline.
[ INFO] [1685618891.699238863]: Planning attempt 1 of at most 1
[ INFO] [1685618891.699341280]: Initialized Point-to-Point Trajectory Generator.
[ INFO] [1685618891.699387198]: Generating PTP trajectory...
[ INFO] [1685618891.699897834]: Goal already reached, set one goal point explicitly.
[ERROR] [1685618891.707460618]: Can't accept new action goals. Controller is not running.
I want to catch these errors somehow and store them in a variable (so i can work with them)
How can i get my script to catch these errors?
Script which should "catch" the errors, reduced to most important function:
move_group = moveit_commander.MoveGroupCommander(group_name)
self.moveGroupCommander = move_group
self.moveGroupCommander.set_pose_target(target_pose)
did_move_succeed = self.moveGroupCommander.go(wait=True)
# If the motion failed, set action_success to False and return
if not did_move_succeed:
self.action_success = False
self._result.motion_executed = False
self._result.error = 'Motion failed due to move group. Maybe IK failed.'
print("Error: %s" % self._result.error)
self._as.set_aborted(self._result)
else:
# Calling `stop()` ensures that there is no residual movement
self.moveGroupCommander.stop()
reached_pose = self.moveGroupCommander.get_current_pose().pose
self.print_pose(reached_pose, "Reached")
self.action_success = True
self._result.motion_executed = True
self._result.error = ""
self._as.set_succeeded(self._result)
self.moveGroupCommander.clear_pose_targets()
print("POSE TO POSE MOVEMENT END\n")
But i want to catch the real error, not that fake version i made.
The launchfile that that opens another terminal displays all the errors i wish:
<launch> <arg name="robot_ip" default="192.168.1.2" doc="IP address of the robot"/> <arg name="pipeline" default="pilz_industrial_motion_planner" doc="OMPL for normal operation and Pilz Industrial Motion Planner for industrial use"/> <arg name="robot_type" default="RMAG" doc="Type of robot configuration that can be selected: 2JVAC_2TCPs/PVAC/RMAG, the URDF specific for the set-up is within fmp_ur10_environemnt"/> <arg name="camera_type" default="" doc="Type of camera configuration that can be selected: realsense/basler"/>
<!-- Launch UR10 Robot -->
<!-- Include the launch file for bringing up the UR10 robot -->
<include file="$(find ur_robot_driver)/launch/ur10_bringup.launch">
<arg name="robot_ip" value="$(arg robot_ip)"/>
<arg name="kinematics_config" value="$(find fmp_ur10_with_gripper)/calibration/ur10_calibration.yaml"/>
</include>
<!-- Motion Planning -->
<!-- Include the launch file for launching MoveIt motion planning -->
<include file="$(find fmp_ur10_moveit_config)/launch/move_group.launch">
<arg name="pipeline" value="$(arg pipeline)"/>
<arg name="robot_type" value="$(arg robot_type)"/>
<arg name="camera_type" value="$(arg camera_type)"/>
<arg name="load_env_robot_description" value="false"/>
<arg name="load_only_robot_description" value="false"/>
<arg name="load_only_robot_rmag" value="true"/>
</include>
</launch>
Quick comment (and not an answer): the error you quote is actually not from
move_group
. It's logged by thejoint_trajectory_controller
. See here.I'd suggest to update your
ROSCONSOLE_FORMAT
to something like:'[${severity}] [${time}] [${node}]: ${message}'
so it's clear which node prints what. You could add the following to your.bashrc
(if using Bash):doesn't change your question of course, but thought I'd mention it.
many thanks for the hint!
So it apparently is from the move group?
Your statement:
was ambiguous. I assumed you cut off your snippet after the error you were interested in (ie:
Can't accept new action goals. Controller is not running.
).But yes, the error you quote does seem to be printed by
move_group
.you are right! actually, it would be great to catch any ERROR and be able to forward it.
Reason is that i have a web frontend and want to inform the user why a command can not be executed.
Subscribe to
rosout
?