Using subscriber to subscribe the Lidar's signal Topic
Hello ROS users, I am using a subscriber to subscribe lidar's signal. I have watched the subscriber and publisher example(C++) tutorial's video and use catkin_ws to build a package, and I make a sick_listen roscpp file which the coding is copied from the listener in the tutorial. And I modify the coding for using it to subscribe the my lidar's signal topic. The coding as below is what I modified and my spec of my ROS
include "ros/ros.h"
include "std_msgs/String.h"
void laser_msg_Callback(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, "sick_listener");
ros::NodeHandle n;
ros::Subscriber sub = n.subscribe("scan", 811, laser_msg_Callback);
ros::spin();
return 0;
}
Spec: ubuntu 14.04LTS, Jade ROS, sick tim 561 lidar
And These are the message type of the "lidar's topic" and "talker's topic which is from the tutorial" comparison:
1. terry@terry-All-Series:~$ rostopic type /chatter std_msgs/String
2. terry@terry-All-Series:~$ rostopic type /scan sensor_msgs/LaserScan
When I run the code of sick_listen, it shows the error as below:
[ INFO] [1451458683.021191460]: Waiting 50 seconds for device to connect.
[ INFO] [1451458683.021602292]: Succesfully connected to 192.168.1.144:2111
[ERROR] [1451458683.224815412]: Client [/sick_listener] wants topic /scan to have datatype/md5sum [std_msgs/String/992ce8a1687cec8c8bd883ec73ca41d1], but our version has [sensor_msgs/LaserScan/90c7ef2dc6895d81024acba2ac42f369]. Dropping connection.
I am a niewbe in the ROS and not to familiar to the c code,so do I need to use the other header of the code for the lidar? I would be thankful if someone can give me some direction.