IFRA-Cranfield / ros2_RobotSimulation

ROS2.0 Foxy and Humble repositories which provide ready-to-use ROS2.0 Gazebo + MoveIt!2 simulation packages for different Industrial and Collaborative Robots.
Apache License 2.0
189 stars 50 forks source link

No plan execution #8

Closed mrayh001 closed 1 year ago

mrayh001 commented 1 year ago

Hi , I am trying to run this in ROS 2 humble, ubuntu 22.04.

When I execute ros2 launch ur5_ros2_moveit2 ur5.launch.py

I can't execute any trajectory basically because it says i have to define an acceleration limits in URDF or joint_limits.yaml

The partial output: [rviz2-17] [INFO] [1681417475.035408610] [interactive_marker_display_94871693411616]: Service response received for initialization [rviz2-17] [INFO] [1681417542.921162527] [move_group_interface]: MoveGroup action client/server ready [move_group-18] [INFO] [1681417542.922056694] [moveit_move_group_default_capabilities.move_action_capability]: Received request

[move_group-18] [INFO] [1681417542.922800746] [moveit_move_group_default_capabilities.move_action_capability]: Planning request received for MoveGroup action. Forwarding to planning pipeline. [move_group-18] [INFO] [1681417542.922841654] [moveit_move_group_capabilities_base.move_group_capability]: Using planning pipeline 'move_group' [rviz2-17] [INFO] [1681417542.922942098] [move_group_interface]: Planning request accepted [move_group-18] [INFO] [1681417542.924870420] [moveit.ompl_planning.model_based_planning_context]: Planner configuration 'ur5_arm' will use planner 'geometric::RRTConnect'. Additional configuration parameters will be set when the planner is constructed. [move_group-18] [ERROR] [1681417543.048884791] [moveit_trajectory_processing.time_optimal_trajectory_generation]: No acceleration limit was defined for joint shoulder_pan_joint! You have to define acceleration limits in the URDF or joint_limits.yaml [move_group-18] [WARN] [1681417543.048922632] [moveit_ros.add_time_optimal_parameterization]: Time parametrization for the solution path failed. [move_group-18] [INFO] [1681417543.048977349] [moveit_move_group_default_capabilities.move_action_capability]: Motion plan was computed successfully. [rviz2-17] [INFO] [1681417543.049940292] [move_group_interface]: Planning request complete! [rviz2-17] [INFO] [1681417543.049949352] [move_group_interface]: time taken to generate plan: 0.0304088 seconds [move_group-18] [INFO] [1681417565.252176289] [moveit_move_group_default_capabilities.move_action_capability]: Received request

[move_group-18] [INFO] [1681417565.252799078] [moveit_move_group_default_capabilities.move_action_capability]: Combined planning and execution request received for MoveGroup action. Forwarding to planning and execution pipeline. [move_group-18] [INFO] [1681417565.252962096] [moveit_ros.plan_execution]: Planning attempt 1 of at most 1 [move_group-18] [INFO] [1681417565.252993345] [moveit_move_group_capabilities_base.move_group_capability]: Using planning pipeline 'move_group' [rviz2-17] [INFO] [1681417565.253123676] [move_group_interface]: Plan and Execute request accepted [move_group-18] [INFO] [1681417565.253760401] [moveit.ompl_planning.model_based_planning_context]: Planner configuration 'ur5_arm' will use planner 'geometric::RRTConnect'. Additional configuration parameters will be set when the planner is constructed. [move_group-18] [ERROR] [1681417565.400122973] [moveit_trajectory_processing.time_optimal_trajectory_generation]: No acceleration limit was defined for joint shoulder_pan_joint! You have to define acceleration limits in the URDF or joint_limits.yaml [move_group-18] [WARN] [1681417565.400148010] [moveit_ros.add_time_optimal_parameterization]: Time parametrization for the solution path failed. [move_group-18] [INFO] [1681417565.400367426] [moveit_move_group_default_capabilities.move_action_capability]: Solution was found and executed. [rviz2-17] [INFO] [1681417565.401689723] [move_group_interface]: Plan and Execute request complete!

I tried to define acceleration limits inside ur5_macro.urdf.xacro. but it does not work. Do you know any solution to this? Thanks.

MikelBueno commented 1 year ago

Hi @mrayh001,

Thank you very much for contacting us.

Unfortunately, ros2_RobotSimulation only supports the ROS2 Robot Triggers defined in ros2_data and ros2_actions packages. These actions use a very simple move_group node, which uses OMPL planning to plan and execute the robot movements (you can find this in any robot_interface.launch.py file, in the move_group node definition).

Thus, moveit2 will complain about some missing information (e.g., joint limits) if you want to execute any complex movement or planner, such as time parametrization (which I can see you are using) or the Pilz Industrial Motion Planner.

However, there is a way to define the joint limits that your execution is complaining about. I cannot guarantee that this will 100% solve your problem, but it will define the acceleration limits for your joints. You need to follow these steps:

  1. Create a joint_limits.yaml file and include the following inside:

    joint_limits:
    shoulder_pan_joint:
      has_velocity_limits: true
      max_velocity: 3.15
      has_acceleration_limits: true
      max_acceleration: 10.0
    shoulder_lift_joint:
      has_velocity_limits: true
      max_velocity: 3.15
      has_acceleration_limits: true
      max_acceleration: 10.0
    elbow_joint:
      has_velocity_limits: true
      max_velocity: 3.15
      has_acceleration_limits: true
      max_acceleration: 10.0
    wrist_1_joint:
      has_velocity_limits: true
      max_velocity: 3.2
      has_acceleration_limits: true
      max_acceleration: 10.0
    wrist_2_joint:
      has_velocity_limits: true
      max_velocity: 3.2
      has_acceleration_limits: true
      max_acceleration: 10.0
    wrist_3_joint:
      has_velocity_limits: true
      max_velocity: 3.2
      has_acceleration_limits: true
      max_acceleration: 10.0
    • max_velocity: Values obtained from the URDF file (should check just in case).
    • max_acceleration: The higher the acceleration limits, the quicker the robot will move in Gazebo.
  2. Add the following to the ur5_interface.launch.py file (above the move_group node definition):

    # joint_limits.yaml file:
    joint_limits_yaml = load_yaml(
      "ur5_ros2_moveit2", "config/joint_limits.yaml"
    )
    joint_limits = {'robot_description_planning': joint_limits_yaml}
  3. Modify the move_group node definition (add joint_limits):

    # move_group node:
    run_move_group_node = Node(
      package="moveit_ros_move_group",
      executable="move_group",
      output="screen",
      parameters=[
          robot_description,
          robot_description_semantic,
          kinematics_yaml,
          joint_limits, 
          ompl_planning_pipeline_config,
          trajectory_execution,
          moveit_controllers,
          planning_scene_monitor_parameters,
          {"use_sim_time": True}, 
      ],
    )

This will allow you to add information about the joint acceleration limits into the move_group node.

Regards, Mikel Bueno IFRA Research Group Cranfield University

ghost commented 1 year ago

Hey @mrayh001, In my case, I have solved it by reinstalling ROS2 Humble, and it shows well now.