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                 kUndef};
00050         Link();
00051         Link(int from,
00052                         int to,
00053                         Type type,
00054                         const Transform & transform,
00055                         const cv::Mat & infMatrix = cv::Mat::eye(6,6,CV_64FC1),
00056                         const cv::Mat & userData = cv::Mat());
00057         Link(int from,
00058                         int to,
00059                         Type type,
00060                         const Transform & transform,
00061                         double rotVariance,
00062                         double transVariance,
00063                         const cv::Mat & userData = cv::Mat());
00064 
00065         bool isValid() const {return from_ > 0 && to_ > 0 && !transform_.isNull() && type_!=kUndef;}
00066 
00067         int from() const {return from_;}
00068         int to() const {return to_;}
00069         const Transform & transform() const {return transform_;}
00070         Type type() const {return type_;}
00071         const cv::Mat & infMatrix() const {return infMatrix_;}
00072         double rotVariance() const;
00073         double transVariance() const;
00074 
00075         void setFrom(int from) {from_ = from;}
00076         void setTo(int to) {to_ = to;}
00077         void setTransform(const Transform & transform) {transform_ = transform;}
00078         void setType(Type type) {type_ = type;}
00079         void setInfMatrix(const cv::Mat & infMatrix);
00080         void setVariance(double rotVariance, double transVariance);
00081 
00082         void setUserDataRaw(const cv::Mat & userDataRaw); // only set raw
00083         void setUserData(const cv::Mat & userData); // detect automatically if raw or compressed. If raw, the data is compressed too.
00084         const cv::Mat & userDataRaw() const {return _userDataRaw;}
00085         const cv::Mat & userDataCompressed() const {return _userDataCompressed;}
00086         void uncompressUserData();
00087         cv::Mat uncompressUserDataConst() const;
00088 
00089         Link merge(const Link & link, Type outputType) const;
00090         Link inverse() const;
00091 
00092 private:
00093         int from_;
00094         int to_;
00095         Transform transform_;
00096         Type type_;
00097         cv::Mat infMatrix_; // Information matrix = covariance matrix ^ -1
00098 
00099         // user data
00100         cv::Mat _userDataCompressed;      // compressed data
00101         cv::Mat _userDataRaw;
00102 };
00103 
00104 }
00105 
00106 
00107 #endif /* LINK_H_ */


rtabmap
Author(s): Mathieu Labbe
autogenerated on Sat Jul 23 2016 11:44:16