00001 /* 00002 * This file is part of CrsmSlam. 00003 CrsmSlam is free software: you can redistribute it and/or modify 00004 it under the terms of the GNU General Public License as published by 00005 the Free Software Foundation, either version 3 of the License, or 00006 (at your option) any later version. 00007 00008 CrsmSlam is distributed in the hope that it will be useful, 00009 but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00011 GNU General Public License for more details. 00012 00013 You should have received a copy of the GNU General Public License 00014 along with CrsmSlam. If not, see <http://www.gnu.org/licenses/>. 00015 * 00016 * Author : Manos Tsardoulias, etsardou@gmail.com 00017 * Organization : AUTH, PANDORA Robotics Team 00018 * */ 00019 00020 #include <crsm_slam/crsm_laser.h> 00021 00022 namespace crsm_slam{ 00023 00027 CrsmLaser::CrsmLaser(void){ 00028 initialized=false; 00029 } 00030 00036 void CrsmLaser::initialize(const sensor_msgs::LaserScanConstPtr& msg){ 00037 00038 ROS_ASSERT(angles.size()==0); 00039 ROS_ASSERT(msg->angle_min<msg->angle_max); 00040 float angle=msg->angle_min; 00041 int count=0; 00042 00043 while(count<msg->ranges.size()){ 00044 angles.push_back(angle); 00045 count++; 00046 angle= msg->angle_min + msg->angle_increment*count; 00047 } 00048 00049 initialized=true; 00050 00051 info.laserRays=msg->ranges.size(); 00052 info.laserMax=msg->range_max; 00053 info.laserAngle=msg->angle_max-msg->angle_min; 00054 info.laserAngleBegin=msg->angle_min; 00055 info.laserAngleEnd=msg->angle_max; 00056 00057 scan=CrsmLaserScan(msg->ranges.size()); 00058 00059 ROS_INFO("[CrsmSlam] CRSM Laser initialized"); 00060 } 00061 00062 }