ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
2

ros2 roscd feature

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

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

3 Answers

Sort by ยป oldest newest most voted
3

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

Dirk Thomas gravatar image

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

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...

Update:

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: https://github.com/colcon/colcon-cd/p... 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
1

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

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/ament.py 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

Comments

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 -0600 )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 -0600 )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 -0600 )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 -0600 )edit

If https://github.com/colcon/colcon-core... 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 -0600 )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 -0600 )edit
0

answered 2023-02-04 04:06:27 -0600

LTF gravatar image

For those who want a straightforward answer the terminal command colcon_cd mentioned in the older comments is now available

If you installed colcon as a debian package, run the following to source the command (or put in your ./.bashrc for convenience)

source /usr/share/colcon_cd/function/colcon_cd.sh

Then run

colcon_cd [package_name]

For the full installation instructions see:

https://colcon.readthedocs.io/en/rele...

edit flag offensive delete link more

Question Tools

2 followers

Stats

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

Seen: 10,055 times

Last updated: Feb 04 '23