How to Create a ROS2 new Package ?
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
?
Asked by aks on 2018-04-18 06:31:09 UTC
Answers
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.
EDIT:
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.
Asked by Karsten on 2018-04-18 11:05:51 UTC
Comments
@karsten sorry but there doesnt seem to any create
command associated with ros2 pkg
Asked by aks on 2018-04-23 08:57:41 UTC
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.
Asked by Karsten on 2018-04-23 10:13:16 UTC
I am sorry but i still did not understand it :/
Asked by aks on 2018-04-26 11:30:16 UTC
@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.
Asked by Geoff on 2018-04-26 18:30:37 UTC
Comments