Link.h
Go to the documentation of this file.
00001 /*
00002 Copyright (c) 2010-2016, Mathieu Labbe - IntRoLab - Universite de Sherbrooke
00003 All rights reserved.
00004 
00005 Redistribution and use in source and binary forms, with or without
00006 modification, are permitted provided that the following conditions are met:
00007     * Redistributions of source code must retain the above copyright
00008       notice, this list of conditions and the following disclaimer.
00009     * Redistributions in binary form must reproduce the above copyright
00010       notice, this list of conditions and the following disclaimer in the
00011       documentation and/or other materials provided with the distribution.
00012     * Neither the name of the Universite de Sherbrooke nor the
00013       names of its contributors may be used to endorse or promote products
00014       derived from this software without specific prior written permission.
00015 
00016 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
00017 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
00018 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00019 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
00020 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
00021 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00022 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
00023 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00024 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00025 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00026 */
00027 
00028 #ifndef LINK_H_
00029 #define LINK_H_
00030 
00031 #include "rtabmap/core/RtabmapExp.h" // DLL export/import defines
00032 
00033 #include <rtabmap/core/Transform.h>
00034 #include <opencv2/core/core.hpp>
00035 
00036 namespace rtabmap {
00037 
00038 class RTABMAP_EXP Link
00039 {
00040 public:
00041         enum Type {
00042                 kNeighbor,
00043                 kGlobalClosure,
00044                 kLocalSpaceClosure,
00045                 kLocalTimeClosure,
00046                 kUserClosure,
00047                 kVirtualClosure,
00048                 kNeighborMerged,
00049                 kPosePrior,
00050                 kUndef = 99};
00051         Link();
00052         Link(int from,
00053                         int to,
00054                         Type type,
00055                         const Transform & transform,
00056                         const cv::Mat & infMatrix = cv::Mat::eye(6,6,CV_64FC1), // information matrix: inverse of covariance matrix
00057                         const cv::Mat & userData = cv::Mat());
00058 
00059         bool isValid() const {return from_ > 0 && to_ > 0 && !transform_.isNull() && type_!=kUndef;}
00060 
00061         int from() const {return from_;}
00062         int to() const {return to_;}
00063         const Transform & transform() const {return transform_;}
00064         Type type() const {return type_;}
00065         const cv::Mat & infMatrix() const {return infMatrix_;}
00066         double rotVariance() const;
00067         double transVariance() const;
00068 
00069         void setFrom(int from) {from_ = from;}
00070         void setTo(int to) {to_ = to;}
00071         void setTransform(const Transform & transform) {transform_ = transform;}
00072         void setType(Type type) {type_ = type;}
00073 
00074         const cv::Mat & userDataRaw() const {return _userDataRaw;}
00075         const cv::Mat & userDataCompressed() const {return _userDataCompressed;}
00076         void uncompressUserData();
00077         cv::Mat uncompressUserDataConst() const;
00078 
00079         Link merge(const Link & link, Type outputType) const;
00080         Link inverse() const;
00081 
00082 private:
00083         void setInfMatrix(const cv::Mat & infMatrix);
00084 
00085 private:
00086         int from_;
00087         int to_;
00088         Transform transform_;
00089         Type type_;
00090         cv::Mat infMatrix_; // Information matrix = covariance matrix ^ -1
00091 
00092         // user data
00093         cv::Mat _userDataCompressed;      // compressed data
00094         cv::Mat _userDataRaw;
00095 };
00096 
00097 }
00098 
00099 
00100 #endif /* LINK_H_ */


rtabmap
Author(s): Mathieu Labbe
autogenerated on Thu Jun 6 2019 21:59:20