Search
 
SCRIPT & CODE EXAMPLE
 

CPP

c++ ros subscriber

#include "ros/ros.h"
#include "std_msgs/String.h"

/**
 * This tutorial demonstrates simple receipt of messages over the ROS system.
 */
void chatterCallback(const std_msgs::String::ConstPtr& msg)
{
  ROS_INFO("I heard: [%s]", msg->data.c_str());
}

int main(int argc, char **argv)
{
  ros::init(argc, argv, "listener");

  ros::NodeHandle n;

  ros::Subscriber sub = n.subscribe("chatter", 1000, chatterCallback);

  ros::spin();

  return 0;
}
Comment

PREVIOUS NEXT
Code Example
Cpp :: initialize 2d vector as 0 
Cpp :: merge images opencv c++ 
Cpp :: eosio parse string 
Cpp :: have unique vector after sorting vector 
Cpp :: rotation to vector2 godot 
Cpp :: ue4 get bone location c++ 
Cpp :: multiply image mat by value c++ 
Cpp :: exp() c++ 
Cpp :: C++ Third angle of a Triangle 
Cpp :: c++ converting centimeters to meters 
Cpp :: cannot open include file unreal 
Cpp :: cuda kernel extern shared memory 
Cpp :: exit() in c++ 
Cpp :: qt qmessagebox 
Cpp :: convert vector to set c++ 
Cpp :: c++ randomization 
Cpp :: use regex replace in c++ 
Cpp :: __lg(x) in c++ 
Cpp :: how to print text on C++ 
Cpp :: cpp float to int 
Cpp :: hello world C++, C plus plus hello world 
Cpp :: fork was not declared in this scope 
Cpp :: all of the stars lyrics 
Cpp :: sort function descending c++ 
Cpp :: g++ optimization flags 
Cpp :: convert int to enum c++ 
Cpp :: c++ program to find prime number using function 
Cpp :: reverse string c++ 
Cpp :: for in c++ 
Cpp :: height of bst cpp 
ADD CONTENT
Topic
Content
Source link
Name
1+5 =