Ask Your Question

How to Create a ROS2 new Package ?

asked 2018-04-18 06:31:09 -0600

aks gravatar image

I have an overlay workspace for ROS2 : ros_2_overlay_ws which have the build install and the src folders. Now i want to create a new package. In ROS, it could be created by sourcing the bash file and then catkin_create_package [package_name] [dependencies]. How can i use ament to create a new package ? Is there also some command like ament_create_package ?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2018-04-18 11:05:51 -0600

Karsten gravatar image

updated 2018-04-23 10:11:56 -0600

There is a pkg verb inside the ros2 command line tools. To create a new package, you can run the following command:

ros2 pkg create --dependencies [deps]

It is not as feature complete as catkin_create_pkg and currently only supports cmake and ament_cmake packages. Pure Python packages are not yet supported.


The create verb is not available in Ardent and has to be built from source (at the time of writing). IMO, the best way of doing so is to create an overlay workspace and then checkout the latest master release of ros2cli here.

edit flag offensive delete link more


@Karsten sorry but there doesnt seem to any create command associated with ros2 pkg

aks gravatar image aks  ( 2018-04-23 08:57:41 -0600 )edit

apologies for being unclear here: The create command got merged after the ardent release. So you have to build this package from source. I just updated my answer.

Karsten gravatar image Karsten  ( 2018-04-23 10:13:16 -0600 )edit

I am sorry but i still did not understand it :/

aks gravatar image aks  ( 2018-04-26 11:30:16 -0600 )edit

@Karsten means that the version of the ros2 pkg command in the most recent release does not have the create verb yet, so you need to download the source into your workspace and build then source your workspace to use it.

Geoff gravatar image Geoff  ( 2018-04-26 18:30:37 -0600 )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



Asked: 2018-04-18 06:31:09 -0600

Seen: 1,503 times

Last updated: Apr 23 '18