ros_control_demo example view_robot.launch.py fails to launch
Hi everyone, its my first post here so forgive me if i miss any details out.
I've followed the instructions here: https://docs.ros.org/en/humble/Installation/Ubuntu-Install-Debians.html, to install ros2 humble.
i've further installed ros-humble-ros2-control
& ros-humble-ros2-controllers
To recreate the issue I created my workspace:
mkdir -p robot_ws/src
from this link: https://github.com/ros-controls/ros2_control_demos/tree/humble, i cloned the humble branch and copied over example 2
to the src
directory.
I then built the workspace:
cd robot_ws
colcon build --symlink-install
After the build finished i sourced the workspace (i have ros2 sourced in .bashrc prior to this) and tried to launch view_robot.launch.py
:
source install/setup.bash
ros2 launch ros2_control_demo_example_2 view_robot.launch.py --debug
i receive the following:
[DEBUG] [launch.launch_context]: emitting event synchronously: 'launch.events.IncludeLaunchDescription'
[INFO] [launch]: All log files can be found below /home/oscar/.ros/log/2023-05-30-01-54-21-996563-oscar-ROG-Zephyrus-G14-GA401QE-GA401QE-41111
[INFO] [launch]: Default logging verbosity is set to DEBUG
[DEBUG] [launch]: processing event: '<launch.events.include_launch_description.IncludeLaunchDescription object at 0x7fea18887b20>'
[DEBUG] [launch]: processing event: '<launch.events.include_launch_description.IncludeLaunchDescription object at 0x7fea18887b20>' ✓ '<launch.event_handlers.on_include_launch_description.OnIncludeLaunchDescription object at 0x7fea19229030>'
[DEBUG] [launch]: An exception was raised in an async action/event
[DEBUG] [launch]: Traceback (most recent call last):
File "/opt/ros/humble/lib/python3.10/site-packages/launch/launch_service.py", line 336, in run_async
raise completed_tasks_exceptions[0]
File "/opt/ros/humble/lib/python3.10/site-packages/launch/launch_service.py", line 230, in _process_one_event
await self.__process_event(next_event)
File "/opt/ros/humble/lib/python3.10/site-packages/launch/launch_service.py", line 250, in __process_event
visit_all_entities_and_collect_futures(entity, self.__context))
File "/opt/ros/humble/lib/python3.10/site-packages/launch/utilities/visit_all_entities_and_collect_futures_impl.py", line 45, in visit_all_entities_and_collect_futures
futures_to_return += visit_all_entities_and_collect_futures(sub_entity, context)
File "/opt/ros/humble/lib/python3.10/site-packages/launch/utilities/visit_all_entities_and_collect_futures_impl.py", line 45, in visit_all_entities_and_collect_futures
futures_to_return += visit_all_entities_and_collect_futures(sub_entity, context)
File "/opt/ros/humble/lib/python3.10/site-packages/launch/utilities/visit_all_entities_and_collect_futures_impl.py", line 45, in visit_all_entities_and_collect_futures
futures_to_return += visit_all_entities_and_collect_futures(sub_entity, context)
[Previous line repeated 1 more time]
File "/opt/ros/humble/lib/python3.10/site-packages/launch/utilities/visit_all_entities_and_collect_futures_impl.py", line 38, in visit_all_entities_and_collect_futures
sub_entities = entity.visit(context)
File "/opt/ros/humble/lib/python3.10/site-packages/launch/action.py", line 108, in visit
return self.execute(context)
File "/opt/ros/humble/lib/python3.10/site-packages/launch_ros/actions/node.py", line 490, in execute
self._perform_substitutions(context)
File "/opt/ros/humble/lib/python3.10/site-packages/launch_ros/actions/node.py", line 445, in _perform_substitutions
evaluated_parameters = evaluate_parameters(context, self.__parameters)
File "/opt/ros/humble/lib/python3.10/site-packages/launch_ros/utilities/evaluate_parameters.py", line 164, in evaluate_parameters
output_params.append(evaluate_parameter_dict(context, param))
File "/opt/ros/humble/lib/python3.10/site-packages/launch_ros/utilities/evaluate_parameters.py", line 72, in evaluate_parameter_dict
evaluated_value = perform_substitutions(context, list(value))
File "/opt/ros/humble/lib/python3.10/site-packages/launch/utilities/perform_substitutions_impl.py", line 26, in perform_substitutions
return ''.join([context.perform_substitution(sub) for sub in subs])
File "/opt/ros/humble/lib/python3.10/site-packages/launch/utilities/perform_substitutions_impl.py", line 26, in <listcomp>
return ''.join([context.perform_substitution(sub) for sub in subs])
File "/opt/ros/humble/lib/python3.10/site-packages/launch/launch_context.py", line 240, in perform_substitution
return substitution.perform(self)
File "/opt/ros/humble/lib/python3.10/site-packages/launch/substitutions/command.py", line 94, in perform
command_str = perform_substitutions(context, self.command)
File "/opt/ros/humble/lib/python3.10/site-packages/launch/utilities/perform_substitutions_impl.py", line 26, in perform_substitutions
return ''.join([context.perform_substitution(sub) for sub in subs])
File "/opt/ros/humble/lib/python3.10/site-packages/launch/utilities/perform_substitutions_impl.py", line 26, in <listcomp>
return ''.join([context.perform_substitution(sub) for sub in subs])
File "/opt/ros/humble/lib/python3.10/site-packages/launch/launch_context.py", line 240, in perform_substitution
return substitution.perform(self)
File "/opt/ros/humble/lib/python3.10/site-packages/launch/substitutions/path_join_substitution.py", line 45, in perform
performed_substitutions = [sub.perform(context) for sub in self.__substitutions]
File "/opt/ros/humble/lib/python3.10/site-packages/launch/substitutions/path_join_substitution.py", line 45, in <listcomp>
performed_substitutions = [sub.perform(context) for sub in self.__substitutions]
File "/opt/ros/humble/lib/python3.10/site-packages/launch/substitutions/find_executable.py", line 66, in perform
raise SubstitutionFailure("executable '{}' not found on the PATH".format(self.name))
launch.substitutions.substitution_failure.SubstitutionFailure: executable '[<launch.substitutions.text_substitution.TextSubstitution object at 0x7fea186239a0>]' not found on the PATH
[ERROR] [launch]: Caught exception in launch (see debug for traceback): executable '[<launch.substitutions.text_substitution.TextSubstitution object at 0x7fea186239a0>]' not found on the PATH
[DEBUG] [launch.launch_context]: emitting event: 'launch.events.Shutdown'
[DEBUG] [launch]: processing event: '<launch.events.shutdown.Shutdown object at 0x7fea19229270>'
[DEBUG] [launch]: processing event: '<launch.events.shutdown.Shutdown object at 0x7fea19229270>' ✓ '<launch.event_handlers.on_shutdown.OnShutdown object at 0x7fea186e6c20>'
[DEBUG] [launch]: processing event: '<launch.events.shutdown.Shutdown object at 0x7fea19229270>' ✓ '<launch.event_handlers.on_shutdown.OnShutdown object at 0x7fea19228640>'
Here is the launch file I'm trying to run:
from launch import LaunchDescription
from launch.actions import DeclareLaunchArgument
from launch.substitutions import Command, FindExecutable, LaunchConfiguration, PathJoinSubstitution
from launch_ros.actions import Node
from launch_ros.substitutions import FindPackageShare
def generate_launch_description():
# Declare arguments
declared_arguments = []
declared_arguments.append(
DeclareLaunchArgument(
"description_package",
default_value="ros2_control_demo_example_2",
description="Description package with robot URDF/xacro files. Usually the argument \
is not set, it enables use of a custom description.",
)
)
declared_arguments.append(
DeclareLaunchArgument(
"description_file",
default_value="diffbot.urdf.xacro",
description="URDF/XACRO description file with the robot.",
)
)
declared_arguments.append(
DeclareLaunchArgument(
"prefix",
default_value='""',
description="Prefix of the joint names, useful for \
multi-robot setup. If changed than also joint names in the controllers' configuration \
have to be updated.",
)
)
# Initialize Arguments
description_package = LaunchConfiguration("description_package")
description_file = LaunchConfiguration("description_file")
prefix = LaunchConfiguration("prefix")
# Get URDF via xacro
robot_description_content = Command(
[
PathJoinSubstitution([FindExecutable(name="xacro")]),
" ",
PathJoinSubstitution(
[FindPackageShare(description_package), "urdf", description_file]
),
" ",
"prefix:=",
prefix,
]
)
robot_description = {"robot_description": robot_description_content}
rviz_config_file = PathJoinSubstitution(
[FindPackageShare(description_package), "rviz", "diffbot_view.rviz"]
)
joint_state_publisher_node = Node(
package="joint_state_publisher_gui",
executable="joint_state_publisher_gui",
)
robot_state_publisher_node = Node(
package="robot_state_publisher",
executable="robot_state_publisher",
output="both",
parameters=[robot_description],
)
rviz_node = Node(
package="rviz2",
executable="rviz2",
name="rviz2",
output="log",
arguments=["-d", rviz_config_file],
)
nodes = [
joint_state_publisher_node,
robot_state_publisher_node,
rviz_node,
]
return LaunchDescription(declared_arguments + nodes)
The launch file runs if i comment out robot_state_publisher_node
but I'm not sure how to fix this issue?
Many thanks!
ROS Environment Variables:
ROS_VERSION=2
ROS_PYTHON_VERSION=3
ROS_LOCALHOST_ONLY=0
ROS_DISTRO=humble
Platform: Ubuntu 22.04, kernel = 5.19.0-42-generic, GPU model: GeForce RTX 3050 Ti Mobile
Asked by Oscar1997 on 2023-05-29 20:21:49 UTC
Answers
I have managed to fixed this issue.
sudo apt install ros-humble-xacro
After installing this package, everything seems to launch as expected.
Asked by Oscar1997 on 2023-05-30 05:40:18 UTC
Comments