Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

hokuyo node laser message publishing

Hi Everyone, I am trying to publish the data of the laser scans of Hokuyo node.

#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;
}

this is the code, but i am getting this error

In function ‘void scanValues(sensor_msgs::LaserScan)’: x.cpp:10:9: error: ‘intensities’ was not declared in this scope