moveit2: servo_teleop for a custom robot not working
Invalid move group name: panda_arm error while using servo_teleop.launch.py in moveit2
Hello, I am working on creating a package to teleop control a ur10 robotic arm using keyboard keys. The moveit2 comes with a launch file servo_teleop.launch.py that enables the panda_arm to be teleop controlled. I used the same launch files to make changes acc. to my robot and tried to implement the same, but when launched, it shows some unusual error. Below is my launch file:
import os
import yaml
from launch import LaunchDescription
from launch_ros.actions import Node
from ament_index_python.packages import get_package_share_directory
from launch_ros.actions import ComposableNodeContainer
from launch_ros.descriptions import ComposableNode
from launch.actions import ExecuteProcess
import xacro
def load_file(package_name, file_path):
package_path = get_package_share_directory(package_name)
absolute_file_path = os.path.join(package_path, file_path)
try:
with open(absolute_file_path, "r") as file:
return file.read()
except EnvironmentError: # parent of IOError, OSError *and* WindowsError where available
return None
def load_yaml(package_name, file_path):
package_path = get_package_share_directory(package_name)
absolute_file_path = os.path.join(package_path, file_path)
try:
with open(absolute_file_path, "r") as file:
return yaml.safe_load(file)
except EnvironmentError: # parent of IOError, OSError *and* WindowsError where available
return None
def generate_launch_description():
# Get parameters for the Servo node
servo_yaml = load_yaml("ur10_config", "config/simulated_config.yaml")
servo_params = {"ur10_config": servo_yaml}
# Get URDF and SRDF
robot_description_config = xacro.process_file(
os.path.join(
get_package_share_directory("ur10_config"),
"config",
"ur10.urdf.xacro",
)
)
robot_description = {"robot_description": robot_description_config.toxml()}
robot_description_semantic_config = load_file(
"ur10_config", "config/ur10.srdf"
)
robot_description_semantic = {
"robot_description_semantic": robot_description_semantic_config
}
# RViz
rviz_config_file = (
get_package_share_directory("ur10_config")
+ "/rviz/moveit.rviz"
)
rviz_node = Node(
package="rviz2",
executable="rviz2",
name="rviz2",
output="log",
arguments=["-d", rviz_config_file],
prefix=['gdb -ex run --args'],
parameters=[robot_description, robot_description_semantic],
)
# ros2_control using FakeSystem as hardware
ros2_controllers_path = os.path.join(
get_package_share_directory("ur10_config"),
"config",
"ros_controllers.yaml",
)
ros2_control_node = Node(
package="controller_manager",
executable="ros2_control_node",
prefix=['gdb -ex run --args'],
parameters=[robot_description, ros2_controllers_path],
output={
"stdout": "screen",
"stderr": "screen",
},
)
# Load controllers
load_controllers = []
for controller in ["robot_controller", "joint_state_broadcaster"]:
load_controllers += [
ExecuteProcess(
cmd=["ros2 run controller_manager spawner.py {}".format(controller)],
shell=True,
output="screen",
)
]
# Launch as much as possible in components
container = ComposableNodeContainer(
name="moveit_servo_demo_container",
namespace="/",
package="rclcpp_components",
executable="component_container",
prefix=['gdb -ex run --args'],
composable_node_descriptions=[
ComposableNode(
package="robot_state_publisher",
plugin="robot_state_publisher::RobotStatePublisher",
name="robot_state_publisher",
parameters=[robot_description],
),
ComposableNode(
package="tf2_ros",
plugin="tf2_ros::StaticTransformBroadcasterNode",
name="static_tf2_broadcaster",
parameters=[{"child_frame_id": "/base_link", "frame_id": "/world"}],
),
# ComposableNode(
# package="moveit_servo",
# plugin="moveit_servo::ServoNode",
# name="servo_server",
# prefix=['gdb -ex run --args'],
# parameters=[
# servo_params,
# robot_description,
# robot_description_semantic,
# ],
# # extra_arguments=[{"use_intra_process_comms": True}],
# ),
ComposableNode(
package="moveit_servo",
plugin="moveit_servo::JoyToServoPub",
name="controller_to_servo_node",
# extra_arguments=[{"use_intra_process_comms": True}],
),
ComposableNode(
package="joy",
plugin="joy::Joy",
name="joy_node",
# extra_arguments=[{"use_intra_process_comms": True}],
),
],
output="screen",
)
servo_node = Node(
package="moveit_servo",
executable="servo_node_main",
prefix=['gdb -ex run --args'],
parameters=[
servo_params,
robot_description,
robot_description_semantic,
],
output={
"stdout": "screen",
"stderr": "screen",
},
)
return LaunchDescription(
[rviz_node, ros2_control_node, servo_node, container] + load_controllers
)
When launched the error shows up that says,
[servo_node_main-5] [New Thread 0x7fffe9b0a700 (LWP 39246)]
[servo_node_main-5] [ERROR] [1650702741.577403458] [moveit_robot_model.robot_model]: Group 'panda_arm' not found in model 'ur10'
[servo_node_main-5] [ERROR] [1650702741.577441880] [moveit_servo.servo_calcs]: Invalid move group name: `panda_arm`
[servo_node_main-5] terminate called after throwing an instance of 'std::runtime_error'
[servo_node_main-5] what(): Invalid move group name
[servo_node_main-5]
[servo_node_main-5] Thread 1 "servo_node_main" received signal SIGABRT, Aborted.
[servo_node_main-5] __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
[servo_node_main-5] 50 ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
I have checked and verified multiple times, i do not have panda_arm written on any section of the whole package, I wonder if any node callbacks internally have been constrained to the group_name ‘panda_arm’. I am relatively a newbie in ROS2 space, a guidance would be appreciated. PFA the project package. You may build the same on your side too. ur10_assembly.zip
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 16 (4 by maintainers)
To reply back to this, my issue is that I didn’t have a servo config yaml as shown in this example for panda arms, and I wasn’t passing it along properly as shown in this launch file.
Once I added that, it seems to be starting now.
This error is still active in the “humble” branch.
For those wondering, this is caused by:
The JoyToServoPub plugin is based on the joystick_servo_example.cpp which declares:
Meaning the “servoing” is done using panda specific joint names and publishing a
/planning_sceneusingpanda_link0asframe_id. This also means the Xbox controller will not work when using another arm then the panda. Replacing this plugin with a node or plugin that publishes a/planning_sceneshould fix this and some future errors.