Ask Your Question

ros2 tab completion not working after Bouncy

asked 2018-07-05 15:45:53 -0500

amosteo gravatar image

Before the Bouncy release I was developing my Ada client library against some ROS2 indeterminate rolling status, built from source (last checked out about a month ago). I was using ament at the time. Last time I tried, tab completion worked with the ros2 executable; both my packages and the executables within were offered and could be run.

After upgrading to Bouncy (from source, latest stable) tab completion no longer works. Neither the packages nor executables appear on hitting tab. Furthermore, even if I write a proper launch command, it says the package does not exist. Unfortunately, I'm not 100% sure I haven't changed anything important in my CMake files. On the other hand, I'm not sure either how one has to create executables so they're known to tab completion. I'm using plain cmake build method, with add_executable (which used to work).

Here is a sequence of compilation/sourcing:

$ cd ada4bouncy/
$ source ../ros2_bouncy/install/setup.bash   # ros2 installation from source
$ colcon build
Starting >>> rclada_common
Finished <<< rclada_common [3.89s]                      
Starting >>> rosidl_generator_ada
Finished <<< rosidl_generator_ada [15.70s]                        
Starting >>> rclada
Finished <<< rclada [13.37s]                        
Starting >>> rclada_examples
Finished <<< rclada_examples [6.12s]                        

Summary: 4 packages finished [39.34s]
$ source install/setup.bash 
$ find install -name rclada_selftest  # Check the executable is where it should be
$ ros2 run rclada rclada_selftest  # This fails
Package 'rclada' not found

argcomplete is version 1.8.1 from Ubuntu:

$ apt policy python3-argcomplete 
  Installed: 1.8.1-1ubuntu1

that matches the version offered by pip:

$ pip show argcomplete
Name: argcomplete
Version: 1.8.1

Any ideas on how to further diagnose this matter?

edit retag flag offensive close merge delete


In further testing I've created two dummy packages via ros2 pkg create and completion works when build method is ament_cmake but not for plain cmake

amosteo gravatar image amosteo  ( 2018-07-05 16:29:09 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted

answered 2018-07-05 16:32:54 -0500

Dirk Thomas gravatar image

If you want your custom package to appear in the completion you need to make sure to "register" it in the resource index. For that you need to install an empty file to <prefix>/share/ament_index/resource_index/packages/<pkgname>.

ament_cmake is just doing that for you when you invoke ament_package() in your CMake code (see ).

edit flag offensive delete link more


I will try that, thanks. Is there any chance that regular CMake install(EXPORTS) or export() where somehow doing that, or something else that was detected? Because I never did what you suggest (nor anything related to ament) and I had it working for some time.

amosteo gravatar image amosteo  ( 2018-07-06 02:31:10 -0500 )edit

The empty file wasn't enough, nor directly calling ament_index_register_package(PACKAGE_NAME ${PROJECT_NAME}) did the trick, so I guess there was something more under the wraps? In the end I've moved to ament_cmake build type in all of my packages.

amosteo gravatar image amosteo  ( 2018-07-06 05:59:41 -0500 )edit

answered 2018-11-01 19:51:20 -0500

itfanr gravatar image

My tab completion can complete some first args, but the second args usually work not good.

Are there some ways to refresh my bouncy and workspace packages and make tab completion work better ?

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2018-07-05 15:45:53 -0500

Seen: 637 times

Last updated: Nov 01 '18