RTAB-Map 0.23.10
Loading...
Searching...
No Matches
Link.h
1/*
2Copyright (c) 2010-2016, Mathieu Labbe - IntRoLab - Universite de Sherbrooke
3All rights reserved.
4
5Redistribution and use in source and binary forms, with or without
6modification, are permitted provided that the following conditions are met:
7 * Redistributions of source code must retain the above copyright
8 notice, this list of conditions and the following disclaimer.
9 * Redistributions in binary form must reproduce the above copyright
10 notice, this list of conditions and the following disclaimer in the
11 documentation and/or other materials provided with the distribution.
12 * Neither the name of the Universite de Sherbrooke nor the
13 names of its contributors may be used to endorse or promote products
14 derived from this software without specific prior written permission.
15
16THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
20DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*/
27
28#ifndef LINK_H_
29#define LINK_H_
30
31#include "rtabmap/core/rtabmap_core_export.h" // DLL export/import defines
32
33#include <rtabmap/core/Transform.h>
34#include <opencv2/core/core.hpp>
35
36namespace rtabmap {
37
54class RTABMAP_CORE_EXPORT Link
55{
56public:
64 enum Type {
75 kEnd,
76 kSelfRefLink = 97,
77 kAllWithLandmarks = 98,
78 kAllWithoutLandmarks = 99,
79 kUndef = 99};
82 static std::string typeName(Type type);
83
95 Link(int from,
96 int to,
97 Type type,
98 const Transform & transform,
99 const cv::Mat & infMatrix = cv::Mat::eye(6,6,CV_64FC1),
100 const cv::Mat & userData = cv::Mat());
101
103 bool isValid() const {return from_ != 0 && to_ != 0 && !transform_.isNull() && type_!=kUndef;}
104
105 int from() const {return from_;}
106 int to() const {return to_;}
107 const Transform & transform() const {return transform_;}
108 Type type() const {return type_;}
109 std::string typeName() const {return typeName(type_);}
110 const cv::Mat & infMatrix() const {return infMatrix_;}
111
117 double rotVariance(bool minimum = true) const;
122 double transVariance(bool minimum = true) const;
123
124 void setFrom(int from) {from_ = from;}
125 void setTo(int to) {to_ = to;}
126 void setTransform(const Transform & transform) {transform_ = transform;}
127 void setType(Type type) {type_ = type;}
129 void setInfMatrix(const cv::Mat & infMatrix);
130
131 const cv::Mat & userDataRaw() const {return _userDataRaw;}
132 const cv::Mat & userDataCompressed() const {return _userDataCompressed;}
136 cv::Mat uncompressUserDataConst() const;
137
150 Link merge(const Link & link, Type outputType) const;
152 Link inverse() const;
153
154private:
155 int from_;
156 int to_;
157 Transform transform_;
158 Type type_;
159 cv::Mat infMatrix_; // Information matrix = covariance matrix ^ -1
160
161 // user data
162 cv::Mat _userDataCompressed; // compressed data
163 cv::Mat _userDataRaw;
164};
165
166}
167
168
169#endif /* LINK_H_ */
Represents a 3D rigid body transformation (rotation + translation).
Definition Transform.h:53