35 const char * h = hostname.c_str();
36 sickLMS400 = asr_sick_lms_400::asr_sick_lms_400((
char *)h, 2111, 2);
40 ROS_ERROR(
"Could not connect to LMS400!");
56 ROS_INFO(
"LMS400: Initialization successful");
63 unsigned int microseconds = 20000;
64 ROS_INFO(
"LMS400: Start Measurement...");
67 ROS_ERROR(
"LMS400: Could not start Measurement!");
71 sensor_msgs::LaserScan msg;
78 if (msg.ranges.size() == 0)
80 ROS_ERROR(
"Received data is invalid! Using old data instead.");
83 {
msg_ptr = sensor_msgs::LaserScan::Ptr(
new sensor_msgs::LaserScan());
85 msg_ptr->header.frame_id =
"map";
86 msg_ptr->header.seq = msg.header.seq;
88 msg_ptr->angle_min = msg.angle_min;
89 msg_ptr->angle_max = msg.angle_max;
90 msg_ptr->angle_increment = msg.angle_increment;
91 msg_ptr->range_max= msg.range_max;
92 msg_ptr->range_min= msg.range_min;
93 msg_ptr->time_increment = msg.time_increment;
94 msg_ptr->scan_time = msg.scan_time;
95 for (
unsigned int i = 0; i< msg.ranges.size(); i++)
97 msg_ptr->ranges.push_back(msg.ranges[i]);
103 usleep(microseconds);
111 ROS_INFO(
"LMS400: Stop Measurement...");
115 ROS_ERROR(
"LMS400: Could not stop Measurement!");
sensor_msgs::LaserScan::Ptr msg_ptr
int calibration_scan_values
LaserScanner_LMS400(std::string hostname, int framerate)
static constexpr float SCANNER_TARGET_RESOLUTION
static constexpr float SCANNER_ANGLE_SPREAD
static constexpr float SCANNER_STARTING_ANGLE
void newData(const sensor_msgs::LaserScan::ConstPtr &msg)
float calibration_starting_angle
#define ROS_INFO_STREAM(args)
asr_sick_lms_400::asr_sick_lms_400 sickLMS400
ROSCPP_DECL void spinOnce()
float calibration_angle_spread