|
| 1 | +# wave/matching |
| 2 | + |
| 3 | +This module contains classes to perform scan matching/registration. There are (or |
| 4 | + will be) a variety of different scan matching algorithms available with a |
| 5 | + similar interface. |
| 6 | + |
| 7 | +## Matcher |
| 8 | + |
| 9 | + template <typename T> |
| 10 | + class Matcher { |
| 11 | + public: |
| 12 | + Matcher(float res) : resolution(res) {} |
| 13 | + Matcher() { |
| 14 | + resolution = -1; |
| 15 | + } |
| 16 | + |
| 17 | + const Eigen::Affine3d &getResult() { |
| 18 | + return this->result; |
| 19 | + }; |
| 20 | + const Eigen::MatrixXd &getInfo() { |
| 21 | + return this->information; |
| 22 | + }; |
| 23 | + float getRes() { |
| 24 | + return this->resolution; |
| 25 | + }; |
| 26 | + |
| 27 | + virtual void setRef(const T &ref) = 0; |
| 28 | + virtual void setTarget(const T &target) = 0; |
| 29 | + void setup(const T &ref, const T &target) { |
| 30 | + this->setRef(ref); |
| 31 | + this->setTarget(target); |
| 32 | + }; |
| 33 | + |
| 34 | + virtual bool match() { |
| 35 | + return 0; |
| 36 | + } |
| 37 | + |
| 38 | + protected: |
| 39 | + float resolution; |
| 40 | + Eigen::Affine3d result; |
| 41 | + Eigen::MatrixXd information; |
| 42 | + }; |
| 43 | + |
| 44 | + } // end of wave namespace |
| 45 | + |
| 46 | +This template class is inherited by each of the different matching algorithms. |
| 47 | + |
| 48 | +### Members |
| 49 | + |
| 50 | + float resolution |
| 51 | +The edge length (in the same distance-units as those used in the pointcloud) of |
| 52 | +a downsampling voxel filter. If no downsampling is happening, this will be -1 |
| 53 | + |
| 54 | +--- |
| 55 | + |
| 56 | + Eigen::Affine3d result |
| 57 | +This is the transformation calculated by the scan registration algorithm. It is |
| 58 | +the transformation needed to transform the target pointcloud to the reference |
| 59 | +pointcloud in the reference frame of the reference pointcloud. |
| 60 | + |
| 61 | +--- |
| 62 | + |
| 63 | + Eigen::MatrixXd information |
| 64 | + |
| 65 | +This is the information matrix calculated by the scan-matching algorithm. The |
| 66 | +diagonal elements correpond to translational perturbations in the x, y, and z |
| 67 | +directions and angular perturbations on the 3-2-1 euler angles, in that order |
| 68 | +and in the frame of the reference pointcloud. This may change as the kinematics |
| 69 | + module of libwave progresses. |
| 70 | + |
| 71 | +--- |
| 72 | + |
| 73 | +### Constructor |
| 74 | + |
| 75 | + Matcher() |
| 76 | +This constructor will set up the instance of the matcher to attempt to match |
| 77 | +using the full resolution of each point cloud (if possible). |
| 78 | + |
| 79 | +--- |
| 80 | + |
| 81 | + Matcher(float res) |
| 82 | + |
| 83 | +This constructor takes an argument in order to adjust how much downsampling is |
| 84 | +done before matching is attempted. Pointclouds are downsampled using a voxel filter, |
| 85 | +the argument is the edge length of each voxel. |
| 86 | + |
| 87 | +--- |
| 88 | + |
| 89 | +### Methods |
| 90 | + |
| 91 | + virtual void setRef(const T &ref) = 0; |
| 92 | + virtual void setTarget(const T &target) = 0; |
| 93 | + void setup(const T &ref, const T &target) { |
| 94 | + this->setRef(ref); |
| 95 | + this->setTarget(target); |
| 96 | + }; |
| 97 | + |
| 98 | +setRef and setTarget are implemented for each specific matching algorithm and are |
| 99 | +how the pointclouds are passed to the matching object. Note that there isn't a |
| 100 | +parameter for an initial transform; the initial transform is always assumed to |
| 101 | +be identity inside the matcher class. If an initial transform estimate is available, |
| 102 | +the target pointcloud should be transformed by it before being passed to the class |
| 103 | +as some algorithms require a good initial estimate to perform well. |
| 104 | + |
| 105 | +--- |
| 106 | + |
| 107 | + virtual bool match(); |
| 108 | + |
| 109 | +Actually performs the match. Any heavy processing is done here. |
| 110 | +Returns: |
| 111 | +* true if match was successful |
| 112 | +* false if match was not successful |
0 commit comments