How to use MRPT libraries from a ROS node?
Contents
1. In short:
Install the mrpt_common
stack.
Simply declare
mrpt_libs
as a ROS dependency of your node in the manifest.xml
. When creating a new package, just append mrpt_libs
to the list of dependencies, for example:
1 |
$ roscreate-pkg my_package roscpp mrpt_libs |
No further modifications are needed: you don’t have to touch your
CMakeLists.txt
file.2. Ready-to-use examples
Refer to the directory within the MRPT source tree.
To build and test the sample ROS (C++) nodes which use MRPT classes, follow the step-by-step instructions (also in the README file):
2.1. Preparation:
Set-up your ROS environment to find the tutorial packages:
1 2 |
$ cd [MRPT_DIR]/samples-ros $ export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:$(pwd)/mrpt_ros_tutorial |
2.2. Build example nodes:
1 |
$ rosmake mrpt_ros_tutorial |
2.3. Execute and test them:
In a console, launch “roscore
“. In another one:
1 |
$ rosrun mrpt_ros_tutorial example1 |
1 |
$ rostopic echo /chatter |