Skip to Content
ROS Programming: Building Powerful Robots
book

ROS Programming: Building Powerful Robots

by Anil Mahtani, Luis Sanchez, Enrique Fernandez, Aaron Martinez, Lentin Joseph
March 2018
Intermediate to advanced content levelIntermediate to advanced
1396 pages
42h 14m
English
Packt Publishing
Content preview from ROS Programming: Building Powerful Robots

Step 3 - Explanation of hello_world.cpp

Here is the explanation of the code:

#include <pluginlib/class_list_macros.h> 
#include <nodelet/nodelet.h> 
#include <ros/ros.h> 
#include <std_msgs/String.h> 
#include <stdio.h> 

These are the header files of this code. We should include class_list_macro.h and nodelet.h to access pluginlib APIs and nodelets APIs:

namespace nodelet_hello_world 
{ 
  class Hello : public nodelet::Nodelet 
  { 

Here, we create a nodelet class called Hello, which inherits a standard nodelet base class. All nodelet classes should inherit from the nodelet base class and be dynamically loadable using pluginlib. Here, the Hello class is going to be used for dynamic loading:

 virtual void onInit() { ros::NodeHandle& private_nh ...
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

Programming Robots with ROS

Programming Robots with ROS

Morgan Quigley, Brian Gerkey, William D. Smart
Machine Learning Design Patterns

Machine Learning Design Patterns

Valliappa Lakshmanan, Sara Robinson, Michael Munn

Publisher Resources

ISBN: 9781788627436Supplemental Content