Robotics StackExchange | Archived questions

ros2 launch autocomplete only finds some launch files

I have a package for launch files, with the following CMakeLists.txt:

cmake_minimum_required(VERSION 3.8)

project(launch_package)

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
  add_compile_options(-Wall -Wextra -Wpedantic)
endif()

# find dependencies
find_package(ament_cmake_auto REQUIRED)
ament_auto_find_build_dependencies()

ament_auto_package(INSTALL_TO_SHARE
  launch
)

and the following launch xml file:

<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
  <name>launch_package</name>
  <version>0.0.0</version>
  <description>Launch packages</description>
  <maintainer email="my@email.com">name</maintainer>
  <license>MIT</license>

<buildtool_depend>ament_cmake</buildtool_depend>

  <test_depend>ament_lint_auto</test_depend>
  <test_depend>ament_lint_common</test_depend>

  <exec_depend>ros2launch</exec_depend>
  <exec_depend>package1</exec_depend>
  <exec_depend>package2</exec_depend>
  <exec_depend>package3</exec_depend>
  <exec_depend>package4</exec_depend>

  <export>
    <build_type>ament_cmake</build_type>
  </export>
</package>

Further, I have a launch folder with different launch files. After I build and source the workspace, I run ros2 launch launch_package and press tab for autocomplete, I see 2 of the launch files. All other launch files are not recognized from autocomplete. However, I can still run the launch files by typing the names by hand. I also find all the files in the install folder. What coul be the reason that I do not see parts of the launch files in autocomplete, even though they reside in the same folder?

Asked by Peter1 on 2022-08-11 07:10:05 UTC

Comments

Answers

The package is called camera_launch in the package.xml file, and launch_package in the CMakeLists.txt file. If they are dummy names, make sure they match on disk.

Otherwise, I would recommend removing the install and build folders for these packages, build, source and try again. Looks like bash completion looks at one place, and ros2launch looks in another.

Asked by Per Edwardsson on 2022-08-12 01:54:58 UTC

Comments

You are right, they are dummy names, I corrected it in the initial post. I tried deleting and do a fresh install but it only finds part of the files.

Without sourcing the workspace, none are recognized. Do you have more insight on how ros2launch and bash completion interact? I do not see a difference between my files. Also the file permissions are the same.

Asked by Peter1 on 2022-08-12 03:26:37 UTC

Very unsure on how the bash completion works. I've seen many weird issues relating to this but never this particular case. Usually it has to do with some package containing several versions of itself due to never cleaning and building properly. I have even less of an idea of what ament_auto does tbh. Sorry. You can try to make a change to one of the files in the launch file and see if that change propagates. For instance, remove/rename one of the files that bash_completion can see. Does it disappear? Does the change propagate?

Asked by Per Edwardsson on 2022-08-12 08:47:37 UTC