Skip to Content
Robot Operating System Cookbook
book

Robot Operating System Cookbook

by Kumar Bipin
June 2018
Intermediate to advanced
484 pages
11h 36m
English
Packt Publishing
Content preview from Robot Operating System Cookbook

Creating a nodelet

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& ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Mobile Intelligent Autonomous Systems

Mobile Intelligent Autonomous Systems

Jitendra R. Raol, Ajith K. Gopal
Wheeled Mobile Robotics

Wheeled Mobile Robotics

Gregor Klancar, Andrej Zdesar, Saso Blazic, Igor Skrjanc

Publisher Resources

ISBN: 9781783987443Supplemental Content