Robotics StackExchange | Archived questions

Autoware.ai - Build package - colcon

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)

ROSETCDIR=/opt/ros/melodic/etc/ros

ROS_ROOT=/opt/ros/melodic/share/ros

ROSMASTERURI=http://localhost:11311

ROSVERSION=1 ROSPYTHON_VERSION=2

ROSPACKAGEPATH=/home/autoware/Autoware/install/ymc/share:/home/autoware/Autoware/install/xsensdriver/share:/home/autoware/Autoware/install/wfsimulator/share:/home/autoware/Autoware/install/lattice_planner/share:

[........]

/home/autoware/Autoware/install/autowarebuildflags/share:/home/autoware/Autoware/install/autowarebagtools /share:/home/autoware/Autoware/install/adi_driver/share:/opt/ros/melodic/share

ROSLISPPACKAGEDIRECTORIES=

ROS_DISTRO=melodic

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

gcc (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0

Asked by Doug on 2019-12-02 19:55:02 UTC

Comments

Answers

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

Asked by Josh Whitley on 2019-12-03 14:10:52 UTC

Comments

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 ?

Asked by Doug on 2019-12-03 14:40:55 UTC

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

Asked by sgermanserrano on 2019-12-04 03:58:13 UTC

@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

/home/autoware/shared_dir//install/test_dg/share/

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/
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/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/chatter.py]: can't locate node [chatter.py] in package [test_dg]

Any thoughts on that ? Should I create a new topic ?

Asked by Doug on 2019-12-04 13:05:19 UTC

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

I'm following this tutorial on LGSVL documentation https://www.svlsimulator.com/docs/tutorials/create-ros2-ad-stack/ 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, setup.py 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!

Asked by meng100 on 2021-05-04 22:31:02 UTC

Comments