00001 /*+-------------------------------------------------------------------------+ 00002 | MultiVehicle simulator (libmvsim) | 00003 | | 00004 | Copyright (C) 2014 Jose Luis Blanco Claraco (University of Almeria) | 00005 | Copyright (C) 2017 Borys Tymchenko (Odessa Polytechnic University) | 00006 | Distributed under GNU General Public License version 3 | 00007 | See <http://www.gnu.org/licenses/> | 00008 +-------------------------------------------------------------------------+ */ 00009 00010 #pragma once 00011 00012 #include <mutex> 00013 #include <mvsim/Sensors/SensorBase.h> 00014 #include <mrpt/poses/CPose2D.h> 00015 #include <mrpt/opengl/CPlanarLaserScan.h> 00016 00017 #include <mrpt/version.h> 00018 #if MRPT_VERSION >= 0x130 00019 #include <mrpt/obs/CObservation2DRangeScan.h> 00020 using mrpt::obs::CObservation2DRangeScan; 00021 #else 00022 #include <mrpt/slam/CObservation2DRangeScan.h> 00023 using mrpt::slam::CObservation2DRangeScan; 00024 using mrpt::slam::CObservation2DRangeScanPtr; 00025 #endif 00026 00027 namespace mvsim 00028 { 00029 class LaserScanner : public SensorBase 00030 { 00031 DECLARES_REGISTER_SENSOR(LaserScanner) 00032 public: 00033 LaserScanner(VehicleBase& parent, const rapidxml::xml_node<char>* root); 00034 virtual ~LaserScanner(); 00035 00036 virtual void loadConfigFrom( 00037 const rapidxml::xml_node<char>* root); 00038 virtual void gui_update( 00039 mrpt::opengl::COpenGLScene& scene); 00040 00041 virtual void simul_pre_timestep( 00042 const TSimulContext& context); 00043 virtual void simul_post_timestep( 00044 const TSimulContext& context); 00045 00046 protected: 00047 int m_z_order; 00048 mrpt::poses::CPose2D m_sensor_pose_on_veh; 00049 std::string m_name; 00050 double m_rangeStdNoise; 00051 double m_angleStdNoise; 00052 bool m_see_fixtures; 00053 00054 00055 CObservation2DRangeScan m_scan_model; 00056 00057 00058 00059 00060 std::mutex m_last_scan_cs; 00061 mrpt::obs::CObservation2DRangeScan::Ptr 00062 m_last_scan; 00063 mrpt::obs::CObservation2DRangeScan::Ptr m_last_scan2gui; 00064 00065 bool m_gui_uptodate; 00066 00067 mrpt::opengl::CPlanarLaserScan::Ptr m_gl_scan; 00068 }; 00069 }