Cartographer_slam package not found

HI,

Please help, this error issues when I try to launch the cartographer node:

user:~/ros2_ws$ ros2 launch project_mapping project_cartographer.launch.py
[INFO] [launch]: All log files can be found below /home/user/.ros/log/2023-09-18-14-26-35-978619-2_xterm-17882
[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(‘py’)>
Traceback (most recent call last):
File “/opt/ros/foxy/lib/python3.8/site-packages/ament_index_python/packages.py”, line 50, in get_package_prefix
content, package_prefix = get_resource(‘packages’, package_name)
File “/opt/ros/foxy/lib/python3.8/site-packages/ament_index_python/resources.py”, line 48, in get_resource
raise LookupError(
LookupError: Could not find the resource ‘cartographer_slam’ of type ‘packages’

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/opt/ros/foxy/lib/python3.8/site-packages/launch/launch_description_sources/any_launch_file_utilities.py”, line 53, in get_launch_description_from_any_launch_file
return loader(launch_file_path)
File “/opt/ros/foxy/lib/python3.8/site-packages/launch/launch_description_sources/python_launch_file_utilities.py”, line 68, in get_launch_description_from_python_launch_file
return getattr(launch_file_module, ‘generate_launch_description’)()
File “/home/user/ros2_ws/install/project_mapping/share/project_mapping/launch/project_cartographer.launch.py”, line 12, in generate_launch_description
cartographer_config_dir = os.path.join(get_package_share_directory(‘cartographer_slam’), ‘config’)
File “/opt/ros/foxy/lib/python3.8/site-packages/ament_index_python/packages.py”, line 70, in get_package_share_directory
return os.path.join(get_package_prefix(package_name), ‘share’, package_name)
File “/opt/ros/foxy/lib/python3.8/site-packages/ament_index_python/packages.py”, line 52, in get_package_prefix
raise PackageNotFoundError(
ament_index_python.packages.PackageNotFoundError: “package ‘cartographer_slam’ not found, searching: [‘/home/user/ros2_ws/install/project_mapping’, ‘/home/simulations/ros2_sims_ws/install/ros1_bridge’, ‘/home/user/ros2_ws/install/turtlebot3’, ‘/home/user/ros2_ws/install/turtlebot3_teleop’, ‘/home/user/ros2_ws/install/turtlebot3_navigation2’, ‘/home/user/ros2_ws/install/turtlebot3_example’, ‘/home/user/ros2_ws/install/turtlebot3_msgs’, ‘/home/user/ros2_ws/install/turtlebot3_bringup’, ‘/home/user/ros2_ws/install/turtlebot3_description’, ‘/opt/ros/foxy’]”

The above exception was the direct cause of the following exception:

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 125,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: Caught exception when trying to load file of format [py]: “package ‘cartographer_slam’ not found, searching: [‘/home/user/ros2_ws/install/project_mapping’, ‘/home/simulations/ros2_sims_ws/install/ros1_bridge’, ‘/home/user/ros2_ws/install/turtlebot3’, ‘/home/user/ros2_ws/install/turtlebot3_teleop’, ‘/home/user/ros2_ws/install/turtlebot3_navigation2’, ‘/home/user/ros2_ws/install/turtlebot3_example’, ‘/home/user/ros2_ws/install/turtlebot3_msgs’, ‘/home/user/ros2_ws/install/turtlebot3_bringup’, ‘/home/user/ros2_ws/install/turtlebot3_description’, ‘/opt/ros/foxy’]”

I try this actions:

  1. Delete the build, install and log folders, compile again, source the install folder and try again. Result: same.
  2. Try to install the cartographer_slam package for Foxy but it says:

user:~/ros2_ws$ sudo apt install ros-foxy-cartographer
Reading package lists… Done
Building dependency tree
Reading state information… Done
ros-foxy-cartographer is already the newest version (1.0.9001-1focal.20210901.031226).
The following package was automatically installed and is no longer required:
libdbus-glib-1-2
Use ‘sudo apt autoremove’ to remove it.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

So, could you help me with other ideas ?

Thanks.

@eblady
Could you please mention the specific unit of the course you are working on?

Hi,
I am working in the first phase of the project, the mapping phase.

thanks

Hi,
I already solve the problem, checking about the packages installed I realized that the correct name of the package was wrong…

Everything is running well…

thanks.

1 Like

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