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

Catch move group error

asked 2023-06-01 06:34:58 -0500

infraviored gravatar image

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>

edit retag flag offensive close merge delete

Comments

1

Quick comment (and not an answer): the error you quote is actually not from move_group. It's logged by the joint_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):

export ROSCONSOLE_FORMAT='[${severity}] [${time}] [${node}]: ${message}'

doesn't change your question of course, but thought I'd mention it.

gvdhoorn gravatar image gvdhoorn  ( 2023-06-01 07:34:34 -0500 )edit

many thanks for the hint!

[ERROR] [1685972379.187259401] [/move_group]: Inverse kinematics for pose 
20
0.4
0.5 has no solution.
[ERROR] [1685972379.187364051] [/move_group]: No IK solution for goal pose

So it apparently is from the move group?

infraviored gravatar image infraviored  ( 2023-06-05 08:57:17 -0500 )edit
1

Your statement:

When moving my robot i sometimes get errors from the Move Group. For example: [..] I want to catch these errors somehow and store them in a variable (so i can work with them)

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.

gvdhoorn gravatar image gvdhoorn  ( 2023-06-05 09:03:47 -0500 )edit

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.

infraviored gravatar image infraviored  ( 2023-06-05 10:16:47 -0500 )edit
1

Subscribe to rosout?

gvdhoorn gravatar image gvdhoorn  ( 2023-06-05 10:43:06 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2023-06-05 11:04:09 -0500

infraviored gravatar image

updated 2023-06-05 11:05:20 -0500

i have it.

    rospy.Subscriber("/rosout", Log, self.error_handler)

def error_handler(self, data):
    if data.level == Log.ERROR:  # Only store error messages
        current_time = rospy.get_time()
        message = data.msg

        # If the previous error message was less than 1 second ago, append the current message
        if self.last_error_time is not None and current_time - self.last_error_time < 1:
            self.error_message += "\n" + message
        else:
            self.error_message = message

        # find "Controller is not running." in message
        if message.find("Controller is not running.") != -1:
            self.error_message += "\n\nPressed Play on UR Panel?"
        if message.find("No IK solution for goal pose") != -1:
            self.error_message += "\n\nMaybe the Pose is not reachable."

        self.last_error_time = current_time

Thank you sir!

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2023-06-01 06:34:58 -0500

Seen: 113 times

Last updated: Jun 01 '23