ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
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[]
}
2 | No.2 Revision |
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"
.