Error: launch.substitutions.substitution_failure.SubstitutionFailure: executed command failed. Command: xacro /path_to_robot_description/robot.urdf.xacro use_ros2_control:=true sim_mode:=false
Hello! I am using ROS2 foxy with ubuntu 20.04, and I am getting this error when I try to launch a .launch.py launch file. The launch file includes launching gazebo and spawning the mobile robot described in the robot.urdf.xacro file in the launched gazebo world (let me if you need the launch file code). Below is the full terminal output of the error:
[DEBUG] [launch.launch_context]: emitting event synchronously: 'launch.events.IncludeLaunchDescription' [INFO] [launch]: All log files can be found below /home/user/.ros/log/2023-04-18-12-48-42-463391-user-Alienware-m15-R4-33093 [INFO] [launch]: Default logging verbosity is set to DEBUG [DEBUG] [launch]: processing event: '<launch.events.include_launch_description.IncludeLaunchDescription object at 0x7fe154c754f0>' [DEBUG] [launch]: processing event: '<launch.events.include_launch_description.IncludeLaunchDescription object at 0x7fe154c754f0>' ✓ '<launch.event_handlers.on_include_launch_description.OnIncludeLaunchDescription object at 0x7fe154c75130>' [DEBUG] [launch.launch_context]: emitting event: 'launch.events.Shutdown' Task exception was never retrieved future: <Task finished name='Task-2' coro=<LaunchService._process_one_event() done, defined at /opt/ros/foxy/lib/python3.8/site-packages/launch/launch_service.py:226> exception=SubstitutionFailure('executed command failed. Command: xacro /home/user/ugv_ws/install/articubot_one/share/articubot_one/description/robot.urdf.xacro use_ros2_control:=true sim_mode:=true') created at /opt/ros/foxy/lib/python3.8/site-packages/launch/launch_service.py:314> source_traceback: Object created at (most recent call last): File "/opt/ros/foxy/bin/ros2", line 11, in <module>
load_entry_point('ros2cli==0.9.13', 'console_scripts', 'ros2')() File "/opt/ros/foxy/lib/python3.8/site-packages/ros2cli/cli.py", line 67, in main
rc = extension.main(parser=parser, args=args) File "/opt/ros/foxy/lib/python3.8/site-packages/ros2launch/command/launch.py", line 151, in main
return launch_a_launch_file( File "/opt/ros/foxy/lib/python3.8/site-packages/ros2launch/api/api.py", line 167, in launch_a_launch_file
ret = launch_service.run() File "/opt/ros/foxy/lib/python3.8/site-packages/launch/launch_service.py", line 360, in run
return loop.run_until_complete(run_async_task) File "/usr/lib/python3.8/asyncio/base_events.py", line 603, in run_until_complete
self.run_forever() File "/usr/lib/python3.8/asyncio/base_events.py", line 570, in run_forever
self._run_once() File "/usr/lib/python3.8/asyncio/base_events.py", line 1859, in _run_once
handle._run() File "/usr/lib/python3.8/asyncio/events.py", line 81, in _run
self._context.run(self._callback, *self._args) File "/opt/ros/foxy/lib/python3.8/site-packages/launch/launch_service.py", line 314, in run_async
process_one_event_task = this_loop.create_task(self._process_one_event()) Traceback (most recent call last): File "/opt/ros/foxy/lib/python3.8/site-packages/launch/launch_service.py", line 228, in _process_one_event
await self.__process_event(next_event) File "/opt/ros/foxy/lib/python3.8/site-packages/launch/launch_service.py", line 248, in __process_event
visit_all_entities_and_collect_futures(entity, self.__context)) File "/opt/ros/foxy/lib/python3.8/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/foxy/lib/python3.8/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/foxy/lib/python3.8/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 3 more times] File "/opt/ros/foxy/lib/python3.8/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/foxy/lib/python3.8/site-packages/launch/action.py", line 108, in visit
return self.execute(context) File "/opt/ros/foxy/lib/python3.8/site-packages/launch_ros/actions/node.py", line 444, in execute
self._perform_substitutions(context) File "/opt/ros/foxy/lib/python3.8/site-packages/launch_ros/actions/node.py", line 399, in _perform_substitutions
evaluated_parameters = evaluate_parameters(context, self.__parameters) File "/opt/ros/foxy/lib/python3.8/site-packages/launch_ros/utilities/evaluate_parameters.py", line 164, in evaluate_parameters
output_params.append(evaluate_parameter_dict(context, param)) File "/opt/ros/foxy/lib/python3.8/site-packages/launch_ros/utilities/evaluate_parameters.py", line 71, in evaluate_parameter_dict
evaluated_value = perform_substitutions(context, list(value)) File "/opt/ros/foxy/lib/python3.8/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/foxy/lib/python3.8/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/foxy/lib/python3.8/site-packages/launch/launch_context.py", line 232, in perform_substitution
**return substitution.perform(self) File "/opt/ros/foxy/lib/python3.8/site-packages/launch/substitutions/command.py", line 116, in perform
raise SubstitutionFailure(f'executed command failed. Command: {command_str}') launch.substitutions.substitution_failure.SubstitutionFailure: executed command failed. Command: xacro /home/user/ugv_ws/install/articubot_one/share/articubot_one/description/robot.urdf.xacro use_ros2_control:=true sim_mode:=true [DEBUG] [launch]: processing event: '<launch.events.shutdown.Shutdown object at 0x7fe154c75190>' [DEBUG] [launch]: processing event: '<launch.events.shutdown.Shutdown object at 0x7fe154c75190>' ✓ '<launch.event_handlers.on_shutdown.OnShutdown object at 0x7fe154c752e0>**'
The fixes I found online for this error were restarting the terminal or rebuilding the package that contains the launch file, but both these fixes didn't work for me. Any help on how to solve this error would be greatly appreciated. Thank you!
Asked by Terence_IRUMVA on 2023-04-18 12:56:50 UTC
Answers
My guess is that /path_to_robot_description/robot.urdf.xacro is probably not the path to the robot model.
This file (robot.urdf.xacro) should lie in some package and you can retrieve it using get_package_share_directory:
from ament_index_python.packages import get_package_share_directory
import os
// a bit later
model = os.path.join(get_package_share_directory('my_pkg'), 'sub_folder', 'robot.urdf.xacro')
Again, 'my_pkg' and 'sub_folder' should be replaced with your package and folder where the model is.
Asked by Olivier Kermorgant on 2023-06-09 02:04:42 UTC
Comments
I am also facing same issue. I tried restarting the system and rebuilding the package that contains the launch file, but both these didn't work for me. please let me know if anyone came across any solution.
Asked by Hri on 2023-06-05 07:11:07 UTC