Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Subscriber not generating output!!

Hello, I am making a simple subscriber which will subscribe to /lms200 topic on which Laser Data is being published.

I went through the ROS tutorial Writing a Simple Publisher and Subscriber (C++), and wrote the following subscriber node, it has been complied successfully but neither it generate any output not any error.

Here is my sample code:

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

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, "redirector");
    ros::NodeHandle n;
    ros::Subscriber sub = n.subscribe("lms200", 1000, chatterCallback);
    return 0;

following is the output when i executes the $rospotic echo /lms200

  seq: 296
    secs: 1417864716
    nsecs: 451817364
  frame_id: lms200
angle_min: -1.5707000494
angle_max: 1.5707000494
angle_increment: 0.0174000002444
time_increment: 0.0
scan_time: 0.0
range_min: 0.10000000149
range_max: 20.0
ranges: [9.380000114440918, 9.380000114440918, 9.380000114440918, 9.390000343322754, 9.390000343322754, 9.399999618530273, 9.420000076293945, 9.430000305175781, 9.449999809265137, 9.470000267028809, 9.5, 9.529999732971191, 9.5600004196167, 9.59000015258789, 9.630000114440918, 9.670000076293945, 1.7699999809265137, 1.7699999809265137]
intensities: []

and following is the output when i executes the following command:-

cr-lab-tu@crlabtu-HP-Z800-Workstation:~$ rostopic info /lms200
Type: sensor_msgs/LaserScan

 * /RosSim (http://crlabtu-HP-Z800-Workstation:55152/)

 * /redirector (http://crlabtu-HP-Z800-Workstation:40278/)


Please help me out to solve the problem.