[ros-users] SICK LMS Subscriber Node

Rishi Bedi rbedi100 at gmail.com
Thu Jul 15 18:55:07 UTC 2010


Hi,
I'm trying to write a node that subscribes to the "/scan" topic, which is
published by sicktoolbox_wrapper. I tried to modify some of the code given
in the "Writing a Simple Publisher/Subscriber" tutorial:

#include <ros/ros.h>
#include <std_msgs/String.h>
#include <sensor_msgs/LaserScan.h>

void scanCallback (const sensor_msgs::LaserScan::ConstPtr& scan_msg)

{
  ROS_INFO("Received [%s]", scan_msg);
}

int main(int argc, char** argv)
{
  ros::init(argc, argv, "listener");
  ros::NodeHandle n;
  ros::Subscriber scan_sub = n.subscribe("scan", 100, scanCallback);
  ros::spin();
}

The part where I think I'm getting tripped up is line 8 (the ROS_INFO
command) -- how do I handle the unique data type LaserScan that
sicktoolbox_wrapper uses to publish the scan data? I want to print the range
values out, preferably as one long string -- what is the best way to convert
the LaserScan type data into a string (or array)?

Thanks a lot --
Rishi

Rishi Bedi
rbedi100 at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osuosl.org/pipermail/ros-users/attachments/20100715/0f13f4ff/attachment-0002.html>


More information about the ros-users mailing list