Ask Your Question

Revision history [back]

You are missing a header file.

For the callback, in the tutorial there is a line containing

#include "std_msgs/String.h"

You should replace that with

#include "std_msgs/UInt16.h"

For the publisher you will want to replace the line containing

ros::Publisher chatter_pub = n.advertise<std_msgs::String>("chatter", 1000);

with

ros::Publisher chatter_pub = n.advertise<std_msgs::UInt16>("chatter", 1000);