RTAB-Map 0.23.10
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;}
105
107 int from() const {return from_;}
109 int to() const {return to_;}
111 const Transform & transform() const {return transform_;}
113 Type type() const {return type_;}
114 std::string typeName() const {return typeName(type_);}
115 const cv::Mat & infMatrix() const {return infMatrix_;}
116
122 double rotVariance(bool minimum = true) const;
127 double transVariance(bool minimum = true) const;
128
129 void setFrom(int from) {from_ = from;}
130 void setTo(int to) {to_ = to;}
131 void setTransform(const Transform & transform) {transform_ = transform;}
132 void setType(Type type) {type_ = type;}
134 void setInfMatrix(const cv::Mat & infMatrix);
135
137 const cv::Mat & userDataRaw() const {return _userDataRaw;}
139 const cv::Mat & userDataCompressed() const {return _userDataCompressed;}
143 cv::Mat uncompressUserDataConst() const;
144
157 Link merge(const Link & link, Type outputType) const;
159 Link inverse() const;
160
161private:
162 int from_;
163 int to_;
164 Transform transform_;
165 Type type_;
166 cv::Mat infMatrix_; // Information matrix = covariance matrix ^ -1
167
168 // user data
169 cv::Mat _userDataCompressed; // compressed data
170 cv::Mat _userDataRaw;
171};
172
173}
174
175
176#endif /* LINK_H_ */
Represents a 3D rigid body transformation (rotation + translation).
Definition Transform.h:53