June 2018
Intermediate to advanced
484 pages
11h 36m
English
First of all, we will create a package called nodelet_hello_ros using the following command in our workspace:
$ catkin_create_pkg nodelet_hello_ros nodelet roscpp std_msgs
Here, the nodelet package provides APIs to build a ROS nodelet. Now, we will create a file called /src/hello_world.cpp, which contains the source code for nodelet implementation inside the package. Alternatively, we could use the existing package from chapter3_tutorials/nodelet_hello_ros on GitHub:
#include <pluginlib/class_list_macros.h> #include <nodelet/nodelet.h> #include <ros/ros.h> #include <std_msgs/String.h> #include <stdio.h> namespace nodelet_hello_ros { class Hello : public nodelet::Nodelet { private: virtual void onInit() { ros::NodeHandle& ...