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

How to Create a ROS2 new Package ?

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

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

Karsten gravatar image

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

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

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

aks gravatar image aks  ( 2018-04-26 11:30:16 -0500 )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 -0500 )edit

Question Tools



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

Seen: 1,857 times

Last updated: Apr 23 '18