RTAB-Map 0.24.5
Real-Time Appearance-Based Mapping
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:
81
83 static std::string typeName(Type type);
84
96 Link(int from,
97 int to,
98 Type type,
99 const Transform & transform,
100 const cv::Mat & infMatrix = cv::Mat::eye(6,6,CV_64FC1),
101 const cv::Mat & userData = cv::Mat());
102
104 bool isValid() const {return from_ != 0 && to_ != 0 && !transform_.isNull() && type_!=kUndef;}
106 bool isLoopClosure() const {return type_ == kGlobalClosure || type_ == kLocalSpaceClosure || type_ == kLocalTimeClosure || type_ == kUserClosure;}
107
109 int from() const {return from_;}
111 int to() const {return to_;}
113 const Transform & transform() const {return transform_;}
115 Type type() const {return type_;}
116 std::string typeName() const {return typeName(type_);}
117 const cv::Mat & infMatrix() const {return infMatrix_;}
118
124 double rotVariance(bool minimum = true) const;
129 double transVariance(bool minimum = true) const;
130
131 void setFrom(int from) {from_ = from;}
132 void setTo(int to) {to_ = to;}
133 void setTransform(const Transform & transform) {transform_ = transform;}
134 void setType(Type type) {type_ = type;}
136 void setInfMatrix(const cv::Mat & infMatrix);
137
139 const cv::Mat & userDataRaw() const {return _userDataRaw;}
141 const cv::Mat & userDataCompressed() const {return _userDataCompressed;}
145 cv::Mat uncompressUserDataConst() const;
146
159 Link merge(const Link & link, Type outputType) const;
161 Link inverse() const;
162
163private:
164 int from_;
165 int to_;
166 Transform transform_;
167 Type type_;
168 cv::Mat infMatrix_; // Information matrix = covariance matrix ^ -1
169
170 // user data
171 cv::Mat _userDataCompressed; // compressed data
172 cv::Mat _userDataRaw;
173};
174
175}
176
177
178#endif /* LINK_H_ */
Represents a 3D rigid body transformation (rotation + translation).
Definition Transform.h:53