The package.xml in format 3 should look like as follow and does not need to be modified:
<packageformat="3">
<name>my_pkg</name>
...
<buildtool_depend>catkin</buildtool_depend>
<depend>ontologenius</depend>
<depend>rospy</depend>
<depend>roscpp</depend>
...
</package>
<packageformat="3">
<name>my_pkg</name>
...
<buildtool_depend>ament_cmake</buildtool_depend>
<depend>ontologenius</depend>
...
<exoprt>
<build_type>ament_cmake</build_type>
</exoprt>
</package>
<packageformat="3">
<name>my_pkg</name>
...
<depend>ontologenius</depend>
...
<exoprt>
<build_type>ament_python</build_type>
</exoprt>
</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.3 REQUIRED)
...
catkin_package(
# INCLUDE_DIRS include
# LIBRARIES my_pkg
CATKIN_DEPENDS ontologenius
# DEPENDS system_lib
)
...
# include
${catkin_INCLUDE_DIRS}
${ontologenius_INCLUDE_DIRS}
)
...
The CMakeLists.txt should look like this:
...
find_package(ament_cmake REQUIRED)
find_package(ontologenius REQUIRED)
...
We will require a minimal version of Ontologenius (optional) and export the dependency.
...
find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(ontologenius 0.4.3 REQUIRED)
include_directories(
${rclcpp_INCLUDE_DIRS}
${ontologenius_INCLUDE_DIRS}
)
ament_export_dependencies(ontologenius)
...
In Python you shoudl have a setup.py file and a setup.cfg but we will not modify them.
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:
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:
In this part, we will not write our program but we will only configure the setup.py file to declare our new node.
To do this, create your node file, in a folder named as your package, that we call my_node.py and simply complete the setup file with the following lines:
entry_points={
'console_scripts': [
'my_node = my_pkg.my_node:main'
],
},
You are now ready to write your program!
To see how to use ontologenius with its C++ or Python API, continue with the tutorial.