Ask Your Question

ros2 roscd feature

asked 2017-12-11 09:51:51 -0500

Vincent R gravatar image

I do not found an equivalent to roscd in ros2. Is it implemented ? Does ament support that feature ?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2017-12-21 02:38:55 -0500

Dirk Thomas gravatar image

updated 2019-09-30 12:55:28 -0500

While a verb like cd can easily be contributed to the ros2cli tools the question is what should the semantic of that command be? In ROS 1 when using the devel space it brought you to the source folder of a package. In ROS 2 there is no concept of a devel space and after installing a package there is no correlation to the source space anymore. So the only possible location to switch to would be the install prefix of the package or the location where the package manifest is (in the subfolder share/<pkgname> in the install space). I am just not sure how useful that would be...


The ros2 command is only available after installation and at that time the source code of packages is potentially not available anymore (and also its location is generally not known). Therefore I created a colcon specific shell function named colcon_cdwhich only operates on the filesystem and doesn't utilize any installed ROS workspace. The PR for this functionality is here: Please feel free to comment / provide feedback on how it works for you - I am probably not a good tested of this functionality since I have never used roscd in the first place.

edit flag offensive delete link more

answered 2017-12-20 20:15:56 -0500

tfoote gravatar image

It has not been implemented yet. It is likely that we will implement a command like that since many people find it useful. The underlying capabilities are definitely available from ament. (Try src/ament/ament_tools/scripts/ list_packages ./src)

A contribution of a verb cd for the ros2 command would be appreciated. This is probably an easy way to get involved if anyone is interested.

edit flag offensive delete link more


I will see what I can do and if it makes sense to do it.

Vincent R gravatar image Vincent R  ( 2018-01-10 09:10:08 -0500 )edit

Any news on this feature? I couldn't find it as a verb of the ros2 command.

Georg Bartels gravatar image Georg Bartels  ( 2019-09-05 02:49:07 -0500 )edit

Please read the accepted answer which describes why such a command isn't implemented.

Dirk Thomas gravatar image Dirk Thomas  ( 2019-09-05 11:39:50 -0500 )edit

Thank you for the answer! From the accepted answer it was not 100% clear to me whether this verb was in the development cue or not. Now, it is. Still, after developing with ROS2 for a couple of weeks I still miss such a verb to quickly navigate to source packages that I have checked out in an overlay. I liked that in ROS1, and some of my colleagues share the impression...

Georg Bartels gravatar image Georg Bartels  ( 2019-09-16 08:04:10 -0500 )edit

If gets implemented it would be possible to provide a function which goes to the source directory of the package within the same workspace (basically colcon list --packages-select <PKGNAME> --paths-only if it returns exactly one path).

Dirk Thomas gravatar image Dirk Thomas  ( 2019-09-16 13:43:35 -0500 )edit

That would be great! I'll make sure to watch that issue. :)

Georg Bartels gravatar image Georg Bartels  ( 2019-09-17 05:42:08 -0500 )edit

Your Answer

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

Add Answer

Question Tools

1 follower


Asked: 2017-12-11 09:51:51 -0500

Seen: 4,173 times

Last updated: Sep 30 '19