ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I am trying to subscribe to the Hoyuko Laser Finder's laser sensor messages. I want to go through the code published above.

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

void scanValues(const sensor_msgs::LaserScan laser)
{
    ROS_INFO("size[%d]: ", laser.intensities.size());
    for (unsigned int i=0; i<laser.intensities.size();i++)
    {
        intensities[i] = laser.intensities[i];
        ROS_INFO("intens[%f]: ", intensities[i]);

    }
}

int main(int argc, char **argv)
{
  ros::init(argc, argv, "hLaserReader");
  ros::NodeHandle n;
  ros::Subscriber hokuyoSubscriber = n.subscribe("/scan", 1, scanValues);
  ros::spin();
  return 0;
}

what should i add more. Thanks!