ROS2 foxy on Jetson Xavier NX, raises InvalidLaunchFileError exception, while launching mavros

System Configuration:
Jetson Xavier NX 8GB
Jetpack 5.1.1
ROS2 foxy
mavros 2.4.0

A Pixhawk with px4 firmware(1.13.3) connected to Jetson over USB, when I launch px4.launch:

ros2 launch mavros px4.launch

I get the following exception:

from pkg_resources import load_entry_point
[INFO] [launch]: All log files can be found below /home/xav2/.ros/log/2023-07-07-17-59-16-703478-ubuntu-43752
[INFO] [launch]: Default logging verbosity is set to INFO
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=InvalidLaunchFileError('')>
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 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/actions/include_launch_description.py", line 130, in execute
    launch_description = self.__launch_description_source.get_launch_description(context)
  File "/opt/ros/foxy/lib/python3.8/site-packages/launch/launch_description_source.py", line 84, in get_launch_description
    self._get_launch_description(self.__expanded_location)
  File "/opt/ros/foxy/lib/python3.8/site-packages/launch/launch_description_sources/any_launch_description_source.py", line 53, in _get_launch_description
    return get_launch_description_from_any_launch_file(location)
  File "/opt/ros/foxy/lib/python3.8/site-packages/launch/launch_description_sources/any_launch_file_utilities.py", line 56, in get_launch_description_from_any_launch_file
    raise InvalidLaunchFileError(extension, likely_errors=exceptions)
launch.invalid_launch_file_error.InvalidLaunchFileError: The launch file may have a syntax error, or its format is unknown

Any help in this regard would be highly appreciated.

@sa.samahith as the error suggests, I would confirm that this is a valid launch file for ROS2 Foxy and that the project you are trying to run supports Foxy. It’s unclear if this is related to Jetson or not and you may want to check with the upstream package maintainers on the status.

Hello @dusty_nv thank you for the reply!

As per your suggestion I checked if the launch file is valid for ROS2 Foxy, by running mavros with the same launch files on a VM (Ubuntu 20.04 with ROS2 Foxy) on my PC. Got the same error:

[INFO] [launch]: All log files can be found below /home/vboxuser/.ros/log/2023-07-13-00-37-03-218366-u2004-52137
[INFO] [launch]: Default logging verbosity is set to INFO
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=InvalidLaunchFileError('')>
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 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/actions/include_launch_description.py", line 130, in execute
    launch_description = self.__launch_description_source.get_launch_description(context)
  File "/opt/ros/foxy/lib/python3.8/site-packages/launch/launch_description_source.py", line 84, in get_launch_description
    self._get_launch_description(self.__expanded_location)
  File "/opt/ros/foxy/lib/python3.8/site-packages/launch/launch_description_sources/any_launch_description_source.py", line 53, in _get_launch_description
    return get_launch_description_from_any_launch_file(location)
  File "/opt/ros/foxy/lib/python3.8/site-packages/launch/launch_description_sources/any_launch_file_utilities.py", line 56, in get_launch_description_from_any_launch_file
    raise InvalidLaunchFileError(extension, likely_errors=exceptions)
launch.invalid_launch_file_error.InvalidLaunchFileError: The launch file may have a syntax error, or its format is unknown

Seems to be a ROS2 Foxy issue rather than an issue with Jetpack.

The issue looks like it’s been fixed with ROS2 Humble, on my PC.
Probably Jetpack 6.0 or source build of ROS2 Humble on the current Jetpack might solve this issue.

Thank you again

OK gotcha - the ROS containers from jetson-containers build Humble from source, so that may include the update(s) you need:

the ROS containers from jetson-containers build Humble from source

Ah, okay. I don’t really have much experience with containers, will check this out and update the topic with my findings.

Thank you

Technically you don’t need containers to build ROS from source, it’s just a convenient way to keep your build environment tidy and to also be able to redistribute the built binaries (i.e. to other Jetson’s). Regardless, use of containers seems commonplace with ROS2.

My ROS2 dockerfile basically just calls this build script, which baring the lack of sudo instructions, could work outside of container too (probably with some minor modifications here and there)

Right, probably for the best if I start using containers.

Got it, I’ll give this a shot and update the topic.

Thank you

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.