Quantcast
Channel: ROS Answers: Open Source Q&A Forum - RSS feed
Viewing all articles
Browse latest Browse all 135

Subscriber not generating output!!

$
0
0
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++)](http://wiki.ros.org/ROS/Tutorials/WritingPublisherSubscriber%28c%2B%2B%29), 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); ros::spin(); return 0; } following is the output when i executes the **$rospotic echo /lms200** header: seq: 296 stamp: 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 Publishers: * /RosSim (http://crlabtu-HP-Z800-Workstation:55152/) Subscribers: * /redirector (http://crlabtu-HP-Z800-Workstation:40278/) cr-lab-tu@crlabtu-HP-Z800-Workstation:~$ **Please help me out to solve the problem.**

Viewing all articles
Browse latest Browse all 135

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>