pose_estimation.h
Go to the documentation of this file.
00001 
00014 #ifndef UCL_POSE_ESTIMATION_H
00015 #define UCL_POSE_ESTIMATION_H
00016 
00017 #include <ucl_drone/ucl_drone.h>
00018 
00019 // #define USE_PROFILING  // Uncomment this line to display timing print in the standard output
00020 #include <ucl_drone/profiling.h>
00021 
00022 // Header files
00023 #include <ardrone_autonomy/Navdata.h>
00024 #include <ros/ros.h>
00025 #include <signal.h>
00026 #include <tf/transform_broadcaster.h>
00027 #include <tf/transform_datatypes.h>
00028 #include <tf/transform_listener.h>
00029 #include <queue>
00030 
00031 // messages
00032 #include <nav_msgs/Odometry.h>
00033 #include <sensor_msgs/Imu.h>
00034 #include <std_msgs/Empty.h>
00035 #include <std_srvs/Empty.h>
00036 #include <ucl_drone/Pose3D.h>
00037 
00042 class PoseEstimator
00043 {
00044 private:
00045   ros::NodeHandle nh;
00046 
00047   // Subscribers:
00048   ros::Subscriber navdata_sub;      
00049   ros::Subscriber odometry_sub;     
00050   ros::Subscriber pose_visual_sub;  
00051   ros::Subscriber reset_sub;        
00052 
00053   // Publishers:
00054   ros::Publisher pose_pub;            
00055   ros::Publisher end_reset_pose_pub;  
00056 
00057   // Paths to topics:
00058   std::string navdata_channel;
00059   std::string odometry_channel;
00060   std::string pose_channel;
00061   std::string end_reset_pose_channel;
00062   std::string pose_visual_channel;
00063   std::string pose_visual_correction_channel;
00064   std::string imu_channel;
00065   std::string reset_channel;
00066 
00068   ardrone_autonomy::Navdata lastNavdataReceived;
00069 
00071   nav_msgs::Odometry lastOdometryReceived;
00072 
00074   ucl_drone::Pose3D lastposeVisualReceived;
00075 
00076   ros::Time odom_time;
00077   double odometry_x;  
00078   std::queue< std::vector< double > > queue_dx;
00079   double odometry_y;  
00080   std::queue< std::vector< double > > queue_dy;
00081   double odometry_rotX;  
00082   double odometry_rotY;
00083   double odometry_rotZ;
00084   std::queue< std::vector< double > > queue_drotZ;
00085   double rot_Z_offset;   
00086   double lastRotX;       
00087   double lastRotY;       
00088   double lastRotZ;       
00089   double previous_rotX;  
00090   double previous_rotY;  
00091   double previous_rotZ;  
00092 
00094   void navdataCb(const ardrone_autonomy::Navdata::ConstPtr navdataPtr);
00095 
00097   void odometryCb(const nav_msgs::Odometry::ConstPtr odometryPtr);
00098 
00100   void poseVisualCb(const ucl_drone::Pose3D::ConstPtr poseVisualPtr);
00101 
00103   bool poseFusion(ucl_drone::Pose3D& pose_msg);
00104 
00106   bool queuePoseFusion(ucl_drone::Pose3D& pose_msg);
00107 
00109   void processQueue(std::queue< std::vector< double > >& myqueue, double& result);
00110 
00112   void pushQueue(std::queue< std::vector< double > >& myqueue, double item);
00113 
00115   bool poseCopy(ucl_drone::Pose3D& pose_msg);
00116 
00118   void resetCb(const std_msgs::Empty msg);
00119 
00120   bool use_visual_pose;  
00121 
00122 public:
00124   PoseEstimator();
00125 
00127   ~PoseEstimator();
00128 
00129   bool odometry_publishing;       
00130   bool visual_pose_available;     
00131   bool pending_reset;             
00132   void publish_pose();            
00133   void publish_end_reset_pose();  
00134   void doReset();                 
00135   void doFlatTrim();              
00136 };
00137 
00138 #endif /* UCL_POSE_ESTIMATION_H */


ucl_drone
Author(s): dronesinma
autogenerated on Sat Jun 8 2019 20:51:53