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

Revision history [back]

As the error tells, your message types are inconsistent. Try the correct message type which is sensor_msgs::LaserScan instead of std_msgs::String.

void laser_msg_Callback(const sensor_msgs::LaserScan::ConstPtr& scan)
{
  //you can get readings with scan->ranges[]
}

As the error tells, your message types are inconsistent. Try the correct message type which is sensor_msgs::LaserScan instead of std_msgs::String.

void laser_msg_Callback(const sensor_msgs::LaserScan::ConstPtr& scan)
{
  //you can get readings with scan->ranges[]
}

And also of course you should add #include "sensor_msgs/LaserScan.h".