mrpt_rbpf_slam_wrapper.h
Go to the documentation of this file.
00001 /*
00002  * File: mrpt_rbpf_slam_wrapper.h
00003  * Author: Vladislav Tananaev
00004  *
00005  */
00006 
00007 #ifndef MRPT_RBPF_SLAM_WRAPPER_H
00008 #define MRPT_RBPF_SLAM_WRAPPER_H
00009 
00010 #include <iostream>  // std::cout
00011 #include <fstream>   // std::ifstream
00012 #include <string>
00013 #include "mrpt_rbpf_slam/mrpt_rbpf_slam.h"
00014 
00015 // add ros libraries
00016 #include <ros/ros.h>
00017 #include <ros/package.h>
00018 #include <tf/transform_listener.h>
00019 #include <tf/transform_broadcaster.h>
00020 // add ros msgs
00021 #include <nav_msgs/OccupancyGrid.h>
00022 #include "nav_msgs/MapMetaData.h"
00023 #include <std_msgs/String.h>
00024 #include <std_msgs/Int32.h>
00025 #include <nav_msgs/GetMap.h>
00026 #include <geometry_msgs/PoseArray.h>
00027 #include <geometry_msgs/PoseWithCovarianceStamped.h>
00028 #include <sensor_msgs/LaserScan.h>
00029 #include <visualization_msgs/MarkerArray.h>
00030 #include <visualization_msgs/Marker.h>
00031 // mrpt msgs
00032 #include "mrpt_msgs/ObservationRangeBeacon.h"
00033 // mrpt bridge libs
00034 #include <mrpt_bridge/pose.h>
00035 #include <mrpt_bridge/map.h>
00036 #include <mrpt_bridge/mrpt_log_macros.h>
00037 #include <mrpt_bridge/laser_scan.h>
00038 #include <mrpt_bridge/beacon.h>
00039 #include <mrpt_bridge/time.h>
00040 
00041 #if MRPT_VERSION >= 0x130
00042 #include <mrpt/obs/CObservationBeaconRanges.h>
00043 using namespace mrpt::obs;
00044 #else
00045 #include <mrpt/slam/CObservationBeaconRanges.h>
00046 using namespace mrpt::slam;
00047 #endif
00048 
00054 class PFslamWrapper : PFslam
00055 {
00056 public:
00060   PFslamWrapper();
00064   ~PFslamWrapper();
00068   void get_param();
00072   void init();
00078   bool rawlogPlay();
00083   void publishMapPose();
00084 
00090   bool is_file_exists(const std::string& name);
00091 
00102   void callbackBeacon(const mrpt_msgs::ObservationRangeBeacon& _msg);
00103 
00114   void laserCallback(const sensor_msgs::LaserScan& _msg);
00115 
00128   bool waitForTransform(mrpt::poses::CPose3D& des, const std::string& target_frame, const std::string& source_frame,
00129                         const ros::Time& time, const ros::Duration& timeout,
00130                         const ros::Duration& polling_sleep_duration = ros::Duration(0.01));
00131 
00138   void odometryForCallback(CObservationOdometryPtr& _odometry, const std_msgs::Header& _msg_header);
00139 
00145   void updateSensorPose(std::string frame_id);
00146 
00151   void publishTF();
00156   void vizBeacons();
00157 
00158 private:
00159   ros::NodeHandle n_;        
00160   double rawlog_play_delay;  
00161   bool rawlog_play_;         
00162 
00163   std::string rawlog_filename;  
00164   std::string ini_filename;     
00165   std::string global_frame_id;  
00166   std::string odom_frame_id;    
00167   std::string base_frame_id;    
00168 
00169   // Sensor source
00170   std::string sensor_source;  
00171 
00172   std::map<std::string, mrpt::poses::CPose3D> laser_poses_;   
00173   std::map<std::string, mrpt::poses::CPose3D> beacon_poses_;  
00174 
00175   // Subscribers
00176   std::vector<ros::Subscriber> sensorSub_;  
00177 
00178   // read rawlog file
00179   std::vector<std::pair<CActionCollection, CSensoryFrame>> data;  
00180 
00181 
00182   std::vector<mrpt::opengl::CEllipsoidPtr> viz_beacons;
00183 
00184   ros::Publisher pub_map_, pub_metadata_, pub_Particles_, pub_Particles_Beacons_,
00185       beacon_viz_pub_;  
00186 
00187   tf::TransformListener listenerTF_;         
00188   tf::TransformBroadcaster tf_broadcaster_;  
00189 
00190   CTicTac tictac;  
00191   float t_exec;    
00192 };
00193 
00194 #endif /*MRPT_RBPF_SLAM_WRAPPER_H*/


mrpt_rbpf_slam
Author(s): Vladislav Tananaev
autogenerated on Sun Sep 17 2017 03:02:13