Set Up Your Environnement

To set up your environment, we will first create a new package that represents your application.

cd ~/catkin_ws/src

catkin_create_pkg <my_pkg> roscpp rospy ontologenius

The package.xml in format 3 should look like as follow and does not need to be modified:

<package format="3">
<name>my_pkg</name>
...
<buildtool_depend>catkin</buildtool_depend>
<depend>ontologenius</depend>
<depend>rospy</depend>
<depend>roscpp</depend>
...
</package>

The CMakeLists.txt should look like this:

...
find_package(catkin REQUIRED COMPONENTS
ontologenius
rospy
roscpp
)
...
catkin_package(
# INCLUDE_DIRS include
# LIBRARIES my_pkg
# CATKIN_DEPENDS ontologenius rospy roscpp
# DEPENDS system_lib
)
...
# include
${catkin_INCLUDE_DIRS}
)
...

We will require a minimal version of Ontologenius (optional) and include the ontologenius API.

find_package(ontologenius 0.4.4 REQUIRED)
...
catkin_package(
# INCLUDE_DIRS include
# LIBRARIES my_pkg
CATKIN_DEPENDS ontologenius
# DEPENDS system_lib
)
...
# include
${catkin_INCLUDE_DIRS}
${ontologenius_INCLUDE_DIRS}
)
...

Create your executable

Now we can create our executable that will use ontologenius.

In this part, we will not write our program but we will only configure the CMakeLists.txt file to compile our file by linking it to ontologenius. To do this, create your main file that we call main.cpp and simply add the following lines:

add_executable(my_exe src/main.cpp)
target_link_libraries(my_exe ${catkin_LIBRARIES})
target_link_libraries(my_exe ${ontologenius_LIBRARIES})

You are now ready to write your program!

To see how to use ontologenius with its C++ or Python API, continue with the tutorial.