2011-06-20 16:49:22 +00:00
|
|
|
/*
|
|
|
|
|
* GuiWrapper.h
|
|
|
|
|
*
|
|
|
|
|
* Created on: 4 févr. 2010
|
|
|
|
|
* Author: labm2414
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef GUIWRAPPER_H_
|
|
|
|
|
#define GUIWRAPPER_H_
|
|
|
|
|
|
|
|
|
|
#include <ros/ros.h>
|
2012-12-11 18:05:05 +00:00
|
|
|
#include "rtabmap/InfoEx.h"
|
2013-12-11 00:12:44 +00:00
|
|
|
#include "rtabmap/MapData.h"
|
2013-04-30 20:25:52 +00:00
|
|
|
#include "rtabmap/utilite/UEventsHandler.h"
|
2013-12-11 00:12:44 +00:00
|
|
|
|
|
|
|
|
#include <tf/transform_listener.h>
|
|
|
|
|
|
2012-06-24 17:19:34 +00:00
|
|
|
#include <geometry_msgs/TwistStamped.h>
|
2013-12-11 00:12:44 +00:00
|
|
|
#include <sensor_msgs/PointCloud2.h>
|
|
|
|
|
#include <sensor_msgs/Image.h>
|
|
|
|
|
#include <sensor_msgs/CameraInfo.h>
|
|
|
|
|
#include <sensor_msgs/LaserScan.h>
|
|
|
|
|
#include <nav_msgs/Odometry.h>
|
|
|
|
|
|
|
|
|
|
#include <message_filters/subscriber.h>
|
|
|
|
|
#include <message_filters/synchronizer.h>
|
|
|
|
|
#include <message_filters/sync_policies/approximate_time.h>
|
2014-07-06 19:58:15 +00:00
|
|
|
#include <message_filters/sync_policies/exact_time.h>
|
2013-12-11 00:12:44 +00:00
|
|
|
|
|
|
|
|
#include <image_transport/image_transport.h>
|
|
|
|
|
#include <image_transport/subscriber_filter.h>
|
2011-06-20 16:49:22 +00:00
|
|
|
|
|
|
|
|
namespace rtabmap
|
|
|
|
|
{
|
|
|
|
|
class MainWindow;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class QApplication;
|
|
|
|
|
|
|
|
|
|
class GuiWrapper : public UEventsHandler
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
GuiWrapper(int & argc, char** argv);
|
|
|
|
|
virtual ~GuiWrapper();
|
|
|
|
|
|
|
|
|
|
int exec();
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
virtual void handleEvent(UEvent * anEvent);
|
|
|
|
|
|
|
|
|
|
private:
|
2014-07-06 19:58:15 +00:00
|
|
|
void infoMapCallback(const rtabmap::InfoExConstPtr & infoMsg, const rtabmap::MapDataConstPtr & mapMsg);
|
2013-12-11 00:12:44 +00:00
|
|
|
|
|
|
|
|
void setupCallbacks(bool subscribeDepth, bool subscribeLaserScan, int queueSize);
|
|
|
|
|
void defaultCallback(const nav_msgs::OdometryConstPtr & odomMsg); // odom
|
|
|
|
|
void depthCallback(const sensor_msgs::ImageConstPtr& imageMsg,
|
|
|
|
|
const nav_msgs::OdometryConstPtr & odomMsg,
|
|
|
|
|
const sensor_msgs::ImageConstPtr& imageDepthMsg,
|
|
|
|
|
const sensor_msgs::CameraInfoConstPtr& camInfoMsg);
|
|
|
|
|
void scanCallback(const sensor_msgs::ImageConstPtr& imageMsg,
|
|
|
|
|
const nav_msgs::OdometryConstPtr & odomMsg,
|
|
|
|
|
const sensor_msgs::LaserScanConstPtr& scanMsg);
|
|
|
|
|
void depthScanCallback(const sensor_msgs::ImageConstPtr& imageMsg,
|
|
|
|
|
const nav_msgs::OdometryConstPtr & odomMsg,
|
|
|
|
|
const sensor_msgs::ImageConstPtr& imageDepthMsg,
|
|
|
|
|
const sensor_msgs::CameraInfoConstPtr& camInfoMsg,
|
|
|
|
|
const sensor_msgs::LaserScanConstPtr& scanMsg);
|
2011-06-20 16:49:22 +00:00
|
|
|
|
2014-07-06 19:58:15 +00:00
|
|
|
void processRequestedMap(const rtabmap::MapData & map);
|
|
|
|
|
|
2011-06-20 16:49:22 +00:00
|
|
|
private:
|
|
|
|
|
QApplication * app_;
|
|
|
|
|
rtabmap::MainWindow * mainWindow_;
|
2013-12-11 00:12:44 +00:00
|
|
|
std::string cameraNodeName_;
|
2011-06-20 16:49:22 +00:00
|
|
|
|
2013-12-11 00:12:44 +00:00
|
|
|
// odometry subscription stuffs
|
|
|
|
|
std::string frameId_;
|
|
|
|
|
tf::TransformListener tfListener_;
|
2011-06-20 16:49:22 +00:00
|
|
|
|
2014-07-06 19:58:15 +00:00
|
|
|
message_filters::Subscriber<rtabmap::InfoEx> infoExTopic_;
|
|
|
|
|
message_filters::Subscriber<rtabmap::MapData> mapDataTopic_;
|
|
|
|
|
|
2013-12-11 00:12:44 +00:00
|
|
|
ros::Subscriber defaultSub_; // odometry only
|
|
|
|
|
image_transport::SubscriberFilter imageSub_;
|
|
|
|
|
image_transport::SubscriberFilter imageDepthSub_;
|
|
|
|
|
message_filters::Subscriber<sensor_msgs::CameraInfo> cameraInfoSub_;
|
|
|
|
|
message_filters::Subscriber<nav_msgs::Odometry> odomSub_;
|
|
|
|
|
message_filters::Subscriber<sensor_msgs::LaserScan> scanSub_;
|
|
|
|
|
|
2014-07-06 19:58:15 +00:00
|
|
|
typedef message_filters::sync_policies::ExactTime<
|
|
|
|
|
rtabmap::InfoEx,
|
|
|
|
|
rtabmap::MapData> MyInfoMapSyncPolicy;
|
|
|
|
|
message_filters::Synchronizer<MyInfoMapSyncPolicy> * infoMapSync_;
|
|
|
|
|
|
2013-12-11 00:12:44 +00:00
|
|
|
typedef message_filters::sync_policies::ApproximateTime<
|
|
|
|
|
sensor_msgs::Image,
|
|
|
|
|
nav_msgs::Odometry,
|
|
|
|
|
sensor_msgs::Image,
|
|
|
|
|
sensor_msgs::CameraInfo,
|
|
|
|
|
sensor_msgs::LaserScan> MyDepthScanSyncPolicy;
|
|
|
|
|
message_filters::Synchronizer<MyDepthScanSyncPolicy> * depthScanSync_;
|
|
|
|
|
|
|
|
|
|
typedef message_filters::sync_policies::ApproximateTime<
|
|
|
|
|
sensor_msgs::Image,
|
|
|
|
|
nav_msgs::Odometry,
|
|
|
|
|
sensor_msgs::Image,
|
|
|
|
|
sensor_msgs::CameraInfo> MyDepthSyncPolicy;
|
|
|
|
|
message_filters::Synchronizer<MyDepthSyncPolicy> * depthSync_;
|
|
|
|
|
|
|
|
|
|
typedef message_filters::sync_policies::ApproximateTime<
|
|
|
|
|
sensor_msgs::Image,
|
|
|
|
|
nav_msgs::Odometry,
|
|
|
|
|
sensor_msgs::LaserScan> MyScanSyncPolicy;
|
|
|
|
|
message_filters::Synchronizer<MyScanSyncPolicy> * scanSync_;
|
2011-06-20 16:49:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif /* GUIWRAPPER_H_ */
|