ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1 - Build package - colcon

asked 2019-12-02 18:55:02 -0500

Doug gravatar image

Hi all,

I am running on Ubuntu 16.04 with ROS Kinetic and Autoware's Docker image (Generic amd64 (64-bit x86) Docker). I am trying to add a package that would run simultaneously to other packages. I've only been using catkin so far but more recent versions of Autoware use colcon for building, which I have never used and find myself confused about.

What would be a proper way to build this package and where should I put my package ?

Thanks in advance for any help :)

Output of - env | grep ROS - : (Inside container)







/home/autoware/Autoware/install/autoware_build_flags/share:/home/autoware/Autoware/install/autoware_bag_tools /share:/home/autoware/Autoware/install/adi_driver/share:/opt/ros/melodic/share



Output of - gcc --version - : (Inside container)

gcc (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2019-12-03 13:10:52 -0500

Josh Whitley gravatar image

updated 2019-12-03 13:12:22 -0500

Hey, @Doug! Thanks for your question. If you are using the pre-built version of the Docker container (autoware/autoware:latest-melodic or autoware/autoware:latest-melodic-cuda), then I recommend doing the following:

  1. Create a new workspace in the shared_dir folder on your machine (cd $HOME/shared_dir && mkdir my_workspace).
  2. Create a src folder in the workspace.
  3. Run the Docker container using the script in the docker repository.

In the Docker container, you should now see the ~/shared_dir/my_workspace/src folder. Inside this folder, run colcon create pkg <package_name> to create your new package. Once you've modified the package to your liking and added your code, go up to the root of the workspace (cd ~/shared_dir/my_workspace) and run colcon build. This should build your new package. To access the package, you'll need to "source" the workspace by running source /home/autoware/shared_dir/my_workspace/install/setup.bash --extend and you should then have access to your package through the normal ROS tools (roscd, rosrun, etc.).

Just a note: anything you do in the Docker container will be wiped out except data you store in the shared_dir folder, which will be available on your local machine in /home/<your_username>/shared_dir after you shut down the container.

edit flag offensive delete link more


Thanks ! It helps a lot !

Little concern about colcon create pkg <package_name> though. I'm getting the following error:

/usr/bin/colcon: error: argument verb_name: invalid choice: 'create' (choose from 'build', 'extension-points', 'extensions', 'graph', 'info', 'list', 'metadata', 'test', 'test-result', 'version-check')

Which seems normal given that colcon doesn't seem to provide a create arg. Am I wrong ?

Doug gravatar image Doug  ( 2019-12-03 13:40:55 -0500 )edit

@Doug I think @Maximus5684 meant catkin_create_package since the Autoware packages are catkin pkgs but are all build using colcon

sgermanserrano gravatar image sgermanserrano  ( 2019-12-04 02:58:13 -0500 )edit

@sgermanserrano@Maximus5684 Yes thanks, this is what I thought.

After sourcing, roscd works fine. However, I added a .launch file but I can't launch it. No error, there is just no autocompletion when I type roslaunch <my_pkg>

I noticed there is no launch folder in


However I noticed here is one when I copy, build and source any other Autoware package. I don't know if this is the reason why, but I noticed that in other Autoware packages' CMakeLists.txt, there is:

install( DIRECTORY launch/

I added the same paragraph in my package's CMakeLists.txt. After building and sourcing, I can run roslaunch test_dg chatter.launch but I get the following error: ERROR: cannot launch node of type [test_dg/]: can't locate node [] in package [test_dg]

Any thoughts on that ? Should I ...(more)

Doug gravatar image Doug  ( 2019-12-04 12:05:19 -0500 )edit

answered 2021-05-04 22:31:02 -0500

meng100 gravatar image

Hi I know it's been quite a while, any update on this?

I'm following this tutorial on LGSVL documentation However after running colcon build --symlink-install and sourcing the file I'm still unable to find my package installed.

Basically, I followed the steps of creating the directory structure, and package.xml, and then ran colcon build to build the package. After that I sourced both local_setup.bash and local_setup.bash in install directory. Still not able to find it when using rospack list-names | grep lane_following or using rosrun lane_following drive.

autoware@meng:/home/autoware/shared_dir/autoware-data/ros2_ws$ colcon build --symlink-install
Starting >>> lane_following
Finished <<< lane_following [0.48s]          

Summary: 1 package finished [0.56s]
autoware@meng:/home/autoware/shared_dir/autoware-data/ros2_ws$ source install/local_setup.bash;source install/setup.bash 
autoware@meng:/home/autoware/shared_dir/autoware-data/ros2_ws$ rospack list-names | grep lane_following
autoware@meng:/home/autoware/shared_dir/autoware-data/ros2_ws$ rosrun lane_following drive
[rospack] Error: package 'lane_following' not found

Anyone knows how to do it correctly? Please help! Thanks in advance!

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2019-12-02 18:55:02 -0500

Seen: 1,208 times

Last updated: May 04 '21