Open PedroMoreo opened 2 months ago
As the log message suggests, did you create a kinematics.yaml
file? See here as an example https://github.com/UniversalRobots/Universal_Robots_ROS2_Driver/blob/main/ur_moveit_config/config/kinematics.yaml
The Setup Assistant does not automate this part, to the best of my knowledge.
The Setup Assistant does not automate this part, to the best of my knowledge.
It does. I think you are missing the kinematics parameter config in your hello_moveit_ur_launch.py
launch file.
See ur_moveit.launch.py
for an example.
Thanks for the correction. I guess the best of my knowledge didn't have much "best" to it 🤣
Thanks a lof for your anwser.
I had the same thought, the problem was in the kinematics_param (as you can see, it is using default_kinematics.yaml, I didn't change it). Although I was pretty sure the kinematics_params was inside the robot_description_content and this inside the robot_description. Between the millions tries I did, I think tried something similar
Nonetheless now if tried this:
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(
package="hello_moveit_ur",
executable="hello_moveit_ur",
name="hello_moveit_ur",
output="screen",
parameters=[
robot_description,
robot_description_semantic,
kinematics_params, # add this
],
)
The result is this:
ros2 launch hello_moveit_ur hello_moveit_ur_launch.py
[INFO] [launch]: All log files can be found below /home/pedro/.ros/log/2024-08-29-12-09-49-859276-pedro-B650-AORUS-ELITE-AX-14030
[INFO] [launch]: Default logging verbosity is set to INFO
[ERROR] [launch]: Caught exception in launch (see debug for traceback): Caught multiple exceptions when trying to load file of format [py]:
- NameError: name 'kinematics_params' is not defined
- InvalidFrontendLaunchFileError: The launch file may have a syntax error, or its format is unknown
Just adding the kinematics_params give an syntax error. So I tried adding a new path:
This is the complete new launch file hello_moveit_ur_launch_k.py
import launch
import os
import sys
from ament_index_python.packages import get_package_share_directory
from launch_ros.actions import Node
from launch.substitutions import PathJoinSubstitution, Command, FindExecutable
from launch_ros.substitutions import FindPackageShare
from launch.actions import DeclareLaunchArgument
from launch.substitutions import LaunchConfiguration
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([FindExecutable(name="xacro")]),
" ",
PathJoinSubstitution([FindPackageShare("ur_description"), "urdf", "ur.urdf.xacro"]),
" ",
"robot_ip:=172.17.0.2",
" ",
"joint_limit_params:=",
joint_limit_params,
" ",
"kinematics_params:=",
kinematics_params,
" ",
"physical_params:=",
physical_params,
" ",
"visual_params:=",
visual_params,
" ",
"safety_limits:=",
"true",
" ",
"safety_pos_margin:=",
"0.15",
" ",
"safety_k_position:=",
"20",
" ",
"name:=",
"ur",
" ",
"ur_type:=",
"ur3e",
" ",
"prefix:=",
'""',
" ",
]
)
robot_description = {"robot_description": robot_description_content}
return robot_description
def get_robot_description_semantic():
# MoveIt Configuration
robot_description_semantic_content = Command(
[
PathJoinSubstitution([FindExecutable(name="xacro")]),
" ",
PathJoinSubstitution([FindPackageShare("ur_moveit_config"), "srdf", "ur.srdf.xacro"]),
" ",
"name:=",
# Also ur_type parameter could be used but then the planning group names in yaml
# configs has to be updated!
"ur",
" ",
"prefix:=",
'""',
" ",
]
)
robot_description_semantic = {
"robot_description_semantic": robot_description_semantic_content
}
return robot_description_semantic
def generate_launch_description():
# Declare the launch argument for the config directory
config_dir_arg = DeclareLaunchArgument(
'config_dir',
default_value=os.path.join(get_package_share_directory('ur_moveit_config'), 'config'),
description='Directory for config files'
)
# Load robot description
robot_description = get_robot_description()
robot_description_semantic = get_robot_description_semantic()
# Load Kinematics file
kinematics_yaml = LaunchConfiguration('config_dir')
kinematics_yaml_path = PathJoinSubstitution([kinematics_yaml, 'kinematics.yaml'])
demo_node = Node(
package="hello_moveit_ur",
executable="hello_moveit_ur",
name="hello_moveit_ur",
output="screen",
parameters=[
robot_description,
robot_description_semantic,
kinematics_yaml_path,
],
)
return launch.LaunchDescription([
config_dir_arg,
demo_node
])
The result of this is, ROS2 does not complain about the kinematics but the arm still does not move, also the program does not, it keeps 'waiting' :
ros2 launch hello_moveit_ur3e hello_moveit_ur_launch_k.py
[INFO] [launch]: All log files can be found below /home/pedro/.ros/log/2024-08-29-12-37-10-990719-pedro-B650-AORUS-ELITE-AX-15874
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [hello_moveit_ur-1]: process started with pid [15877]
[hello_moveit_ur-1] [INFO] [1724927831.219396973] [moveit_rdf_loader.rdf_loader]: Loaded robot model in 0.00265791 seconds
[hello_moveit_ur-1] [INFO] [1724927831.219427020] [moveit_robot_model.robot_model]: Loading robot model 'ur'...
[hello_moveit_ur-1] [INFO] [1724927831.219434995] [moveit_robot_model.robot_model]: No root/virtual joint specified in SRDF. Assuming fixed joint
I am not sure if the problem could be in the SRDF. I hope that helps.
Thanks a lot.
I think you managed to load the kinematics parameters now, although you didn't follow the suggested example, which is much simpler. I cannot help much with the remaining issue, as I have no idea about the purpose of hello_moveit_ur
. I suggest adding some prints to understand where the program hangs.
Hi Sorry, I think I was not very clear in the previous explanation of the problem. I don't have much experience in ROS2 yet.
I was just following this tutorial https://moveit.picknik.ai/humble/doc/tutorials/your_first_project/your_first_project.html (hello_moveit). The purpose is just to move the robot to a point. This tutorial is configured for PANDA. I need to change it for ur5e (ur3e would work too). But I couldn't change it. This tutorial just runs a file(using run command), it does not use a launch file ( example.launch.py).
According to this forum https://answers.ros.org/question/408096/using-universal-robot-instead-of-pandas-arm-in-moveit2-tutorial/ (it is the same question here https://forum.universal-robots.com/t/move-ur-with-a-moveit2-script/24497) the solution needs to be done through a launch file. The complete files are in : GitHub - LucaBross/simple_moveit2_universal_robots_movement But I couldn't run this project. So this is the problem I have, looks like I am trying the regular examples, but for some reason I can't make it work. I hope this helps.
Thanks a lot.
Hello @PedroMoreo, just started my master thesis and trying to do exactly the same here in the UPM, did you managed to move the robot into a desired point? Im quite new to ros so any info can be helpful, thanks in advance!
Hello @nachoorp , yes we did, but for the moment we have errors in the orientation. You can follow all the steps I did in the next link
I hope it helps
Description
My name is Pedro, working for the University of Granada lab. We are trying to move a Universal Robot arm and we want to move it through URSIM beforehand. To do this we are trying to adapt the hello_moveit_ur project (configured for panda) https://moveit.picknik.ai/humble/doc/tutorials/your_first_project/your_first_project.html to ur5e or ur3e.
In this project they explain how to make a launch file for this purpose: https://github.com/LucaBross/simple_moveit2_universal_robots_movement/blob/main/README.md But I cannot make it works
Your environment
Steps to reproduce
According to the README provided for Luca Bross in the same github mentioned before:
Shell 1: run the driver
ros2 launch ur_robot_driver ur_control.launch.py ur_type:=ur3e robot_ip:=172.17.0.2 launch_rviz:=false initial_joint_controller:=joint_trajectory_controller to connect to the Universal Robot.
Start the external control urcap on the UR to allow external control (172.17.0.2 ) whose answer is :
Shell 2: run the moveit controller
whose anser is :
Shell 3: launch the program hello Start the hello_moveit_ur file with a launchfile
ros2 launch hello_moveit_ur hello_moveit_ur_launch.py.
whose anser is:Expected behaviour
The robot to move in the UR SIM, to the selected point.
Actual behaviour
It gives a warning about the kinematics and keep waiting.
Thanks a lot.