AUV-Coop-Assembly
Master Thesis for Robotics Engineering. Cooperative peg-in-hole assembly with two underwater vehicles guided by vision
tracker.h
1 #ifndef TRACKER_H
2 #define TRACKER_H
3 
4 #include <iostream>
5 #include <vector>
6 #include <map>
7 #include <string>
8 #include <boost/filesystem/path.hpp>
9 
10 #include <visp3/gui/vpDisplayOpenCV.h>
11 #include <visp3/vision/vpKeyPoint.h>
12 #include <visp3/mbt/vpMbGenericTracker.h>
13 
14 #include <pcl_ros/io/pcd_io.h>
15 
16 #include "../../support/header/conversions.h"
17 
18 
19 //relative to source (tracker.cpp) path to config file and images used in algos
20 const std::string relative = "/data/";
21 const std::string configFile = relative + "camera_";
22 const std::string caoModelNoCil = relative + "blockHole.cao";
25 //const std::string caoModel = relative + "blockHoleCilinder.cao";
26 //const std::string caoModel = relative + "pegModelCircle.cao";
27 const std::string configFileDetector = relative + "detection-config-MONO.xml";
28 const std::string initFileClick = relative + "3DPointSquareFace4_";
29 //const std::string initFileClick = relative + "3DPointPeg_";
30 const std::string initFile_w2D = relative + "3DPointSquareFace4_w2d_";
31 const std::string learnData = relative + "blockHole_learning_data_";
32 //const std::string transfcameraLtoR = relative + "lTr.txt";
33 
35 {
36 public:
37  MonoTracker(std::string callerName, std::string cameraName,
38  int trackerType);
39  ~MonoTracker();
40 
41  int initTrackingByClick(vpImage<unsigned char> *I);
42  int initTrackingByPoint(vpImage<unsigned char> *I);
43  int monoTrack(vpImage<unsigned char> *I,
44  vpHomogeneousMatrix *cMo,
45  double *error, double* elapsedTime);
46  void getCameraParams(vpCameraParameters *param);
47  void display(vpImage<unsigned char> *I);
48 
49 private:
50  vpMbGenericTracker tracker;
51  std::string callerName;
52  std::string cameraName;
53  std::string sourcePath;
54  vpKeyPoint keypoint_detection;
55 
56 
57  int monoTrackInit_priv(vpImage<unsigned char> *I);
58 
59 };
60 
61 
63 {
64 public:
65  StereoTracker(std::string callerName, std::vector<std::string> cameraNames,
66  std::map<std::string, vpHomogeneousMatrix> mapCameraTransf,
67  std::vector<int> trackerTypes);
68  ~StereoTracker();
69 
70  int initTrackingByClick( std::map<std::string, const vpImage<unsigned char>*> mapOfImages);
71  int initTrackingByPoint(std::map<std::string, const vpImage<unsigned char>*> mapOfImages);
72  int stereoTrack(std::map<std::string, const vpImage<unsigned char>*> mapOfImages,
73  std::map<std::string, vpHomogeneousMatrix> *mapOfCameraPoses);
74  int stereoTrack(std::map<std::string, const vpImage<unsigned char>*> mapOfImages,
75  std::map<std::string, pcl::PointCloud< pcl::PointXYZ >::ConstPtr> mapOfPointclouds,
76  std::map<std::string, vpHomogeneousMatrix> *mapOfcameraToObj);
77  void getCamerasParams(std::map<std::string, vpCameraParameters> *mapOfCameraParams);
78  void display(std::map<std::string, const vpImage<unsigned char>*> mapOfImages);
79 
80 private:
81  vpMbGenericTracker *tracker;
82 
83  std::string callerName;
84  std::vector<std::string> cameraNames;
85 
86  std::string sourcePath;
87 
88 
89 };
90 
91 #endif // TRACKER_H