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

Using Universal Robot instead of Pandas Arm in MoveIt2 tutorial

asked 2022-10-18 01:58:41 -0500

LucB gravatar image

updated 2022-10-19 06:36:39 -0500

I`m using ros2 humble. I also installed the ROS2 Universal Robot Driver.

I can start the connection to the UR

ros2 launch ur_robot_driver ur_type:=ur3e robot_ip:= launch_rviz:=false initial_joint_controller:=joint_trajectory_controller

and in a second Terminal:

ros2 launch ur_moveit_config ur_type:=ur3e launch_rviz:=true

then i can plan and execute the path to a desired position and the robot moves. Now i want to move the Robot with my own script. Therefore i was working on a tutorial. Now I got the moveit2 tutorial running.

So far i have the problem, that i don't know what i need to change to get the UR running instead of the pandas arm? I'm not sure which packages or header i have to include or launch files i have to change etc. .

Can anyone give me an advice on how to get started on this? Or does anyone have a different approach to move the UR with my own written package and inverse kinematics?

Update: I created a new package hello_moveit_ur like in the tutorial explained. Then i modified the sourcecode:

#include <memory>

#include <rclcpp/rclcpp.hpp>
#include <moveit/move_group_interface/move_group_interface.h>

int main(int argc, char * argv[])
  // Initialize ROS and create the Node
  rclcpp::init(argc, argv);
  auto const node = std::make_shared<rclcpp::Node>(

  // Create a ROS logger
  auto const logger = rclcpp::get_logger("hello_moveit");

  // Create the MoveIt MoveGroup Interface
using moveit::planning_interface::MoveGroupInterface;
auto move_group_interface = MoveGroupInterface(node, "ur_manipulator");  //CHANGE

// Set a target Pose
auto const target_pose = []{
  geometry_msgs::msg::Pose msg;
  msg.orientation.w = 1.0;
  msg.position.x = 0.28;
  msg.position.y = -0.2;
  msg.position.z = 0.5;
  return msg;

// Create a plan to that target pose
auto const [success, plan] = [&move_group_interface]{
  moveit::planning_interface::MoveGroupInterface::Plan msg;
  auto const ok = static_cast<bool>(move_group_interface.plan(msg));
  return std::make_pair(ok, msg);

// Execute the plan
if(success) {
} else {
  RCLCPP_ERROR(logger, "Planing failed!");

  // Shutdown ROS
  return 0;

There i changed the MoveGroupInterface to "ur_manipulator". Also in the package.xml i added <depend>ros_ur_dirver</depend>.

After building and sourcing i start the simulation

docker run --rm -it -p 5900:5900 -p 6080:6080 -v ${HOME}/.ursim/urcaps:/urcaps -v ${HOME}/.ursim/programs:/ursim/programs --name ursim universalrobots/ursim_e-series

then the ur driver

ros2 launch ur_robot_driver ur_type:=ur3e robot_ip:= launch_rviz:=false initial_joint_controller:=joint_trajectory_controller

then the external control file in the simulation. Then ur moveit config

ros2 launch ur_moveit_config ur_type:=ur3e launch_rviz:=true

then my new package

ros2 run hello_moveit_ur hello_moveit_ur

and the Terminal returns:

ros2 run hello_moveit_ur hello_moveit_ur 
[ERROR] [1666102107.906278553] [hello_moveit]: Could not find parameter robot_description_semantic and did not receive robot_description_semantic via std_msgs::msg::String subscription within 10.000000 seconds.
Error:   Could not parse the SRDF XML File. Error=XML_ERROR_EMPTY_DOCUMENT ErrorID=13 (0xd) Line number=0
     at line 715 in /home/luca/ws_moveit2/src/srdfdom/src/model.cpp
[ERROR] [1666102107.910497801] [moveit_rdf_loader.rdf_loader ...
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2022-10-20 03:46:15 -0500

LucB gravatar image

updated 2022-10-20 03:46:56 -0500

I had o give the necessary parameters with a launchfile:

import launch
import os
import sys

from launch_ros.actions import Node
from launch.substitutions import PathJoinSubstitution, Command, FindExecutable
from launch_ros.substitutions import FindPackageShare

def get_robot_description():
    joint_limit_params = PathJoinSubstitution(
        [FindPackageShare("ur_description"), "config", "ur3e", "joint_limits.yaml"]
    kinematics_params = PathJoinSubstitution(
        [FindPackageShare("ur_description"), "config", "ur3e", "default_kinematics.yaml"]
    physical_params = PathJoinSubstitution(
        [FindPackageShare("ur_description"), "config", "ur3e", "physical_parameters.yaml"]
    visual_params = PathJoinSubstitution(
        [FindPackageShare("ur_description"), "config", "ur3e", "visual_parameters.yaml"]
    robot_description_content = Command(
            " ",
            PathJoinSubstitution([FindPackageShare("ur_description"), "urdf", "ur.urdf.xacro"]),
            " ",
            " ",
            " ",
            " ",
            " ",
            " ",
            " ",
            " ",
            " ",
            " ",
            " ",
            " ",

    robot_description = {"robot_description": robot_description_content}
    return robot_description

def get_robot_description_semantic():
    # MoveIt Configuration
    robot_description_semantic_content = Command(
            " ",
            PathJoinSubstitution([FindPackageShare("ur_moveit_config"), "srdf", "ur.srdf.xacro"]),
            " ",
            # Also ur_type parameter could be used but then the planning group names in yaml
            # configs has to be updated!
            " ",
            " ",
    robot_description_semantic = {
        "robot_description_semantic": robot_description_semantic_content
    return robot_description_semantic

def generate_launch_description():
    # generate_common_hybrid_launch_description() returns a list of nodes to launch
    robot_description = get_robot_description()
    robot_description_semantic = get_robot_description_semantic()
    demo_node = Node(

    return launch.LaunchDescription([demo_node])

When I start

ros2 launch ur_robot_driver ur_type:=ur3e robot_ip:= launch_rviz:=false initial_joint_controller:=joint_trajectory_controller then activate the external control urcap then ros2 launch ur_moveit_config ur_type:=ur3e launch_rviz:=true then ros2 launch hello_moveit_ur the Robot moves to the target position.

The topic was also discussed here:

My files can be found here:

edit flag offensive delete link more

Question Tools



Asked: 2022-10-18 01:58:41 -0500

Seen: 1,047 times

Last updated: Oct 20 '22