Colcon Build from Any Directory and Need to Re-build for changes in Launch file

asked 2020-11-16 07:08:58 -0500

puru gravatar image

New to ROS2 and Nav2 here.

  1. Currently, my directory structure is like this: home>nav2_ws>src>navigation2. I need my build and install directory to be in nav2_ws. For which currently I call colcon build --symlink-install while in ~/nav2_ws. In ros1- catkin build, I used to call it from anywhere in the workspace (after initialization), and it used to build it at the same location. Is there a quick way to set a single build space and install space in colcon, so that colcon build could be called from anywhere in the workspace?

  2. while using colcon build --symlink-install, it ‘installs’ the workspace, due to which ros2 launch uses all the launch files from the “share” directory (not from the src directory). Now if we change anything in the launch file (src dir), it won’t be reflected in the share directory unless we again do colcon build --symlink-install. Is there way to simplify this? so that user doesn’t have to build it again and again for changes in the launch file?

Ros version - foxy

edit retag flag offensive close merge delete



There's been some talk about item 1 and a proposed change too, respectively and

christophebedard gravatar image christophebedard  ( 2020-11-16 08:25:40 -0500 )edit

As for item 2, there's a workaround here: It was mentioned in that issue that newer versions of setuptools should allow for symlinking instead of copying, but I'm not sure if it actually happened/is available through colcon.

christophebedard gravatar image christophebedard  ( 2020-11-16 08:36:50 -0500 )edit

Thought I'd clarify some potential confusion based on the question wording. colconalways installs things into the install/ dir and the ros2 tools never use anything from src/. What happens with --symlink-install is those files underneath install/ are just links back to the originals under src/ so you can change them and see it take effect without rebuilding. @christophebedard is referring to a bug where python packages don't create those links when they ideally should. It's not clear from the question if that's the problem you're running into.

jdlangs gravatar image jdlangs  ( 2020-11-16 14:16:30 -0500 )edit