-
Notifications
You must be signed in to change notification settings - Fork 10
NewModule
The goal of this tutorial is to create a new module to be used in cs::APEX.
The package you are going to create will be in the main catkin workspace, if you are an experienced catkin user, you can also use another workspace.
Next Tutorial: How to create a new node?
Open a terminal and navigate to your catkin workspace where you cloned cs::APEX.
$ cd $WS/src/csapex/
Plugin packages can be built in any catkin workspace.
For now we assume, that plugins are in the subdirectory plugins
, which contains a few bash scripts that are helpful for maintance.
We are now creating a new package called csapex_tutorial
:
$ cd plugins
$ catkin_create_pkg csapex_tutorial csapex csapex_opencv
Which tells catkin that our package is dependent upon csapex
and csapex_opencv
(for image message support) and will produce output like
Created file csapex_tutorial/CMakeLists.txt
Created file csapex_tutorial/package.xml
Successfully created files in .../src/csapex_tutorial. Please adjust the values in package.xml.
Next we take a look at the meta files:
cd csapex_tutorial
gedit package.xml
Here we provide all necessary information (See the catkin tutorials).
When you are finished, you need to export a list of all provided plug-ins. Therefore we add an export to package.xml
:
<export>
<csapex plugin="${prefix}/plugins.xml" />
</export>
Which tells cs::APEX, in which file to look for plug-ins.
Next we create the file where we tell the plug-in system to use a dynamic library called libcsapex_tutorial
, which we will create in the next tutorial
echo '<library path="libcsapex_tutorial"></library>' > plugins.xml
We also need to install this file using catkin. This is achieved by adding
install(FILES plugins.xml
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION})
to CMakeLists.txt
.
At last we create a directory for our source code to be compliant to the convention. This is were all your code should go:
mkdir src
Now we can test if everything went okay by invoking catkin_make
:
cd $WS
catkin_make
and verifying that csapex_tutorial
is listed under the list of all packages
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- ~~ traversing xxx packages in topological order:
..
-- ~~ - csapex_tutorial
..
In the next tutorial we are going to create a new node