Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef LINK_H_
00029 #define LINK_H_
00030
00031 #include <rtabmap/core/Transform.h>
00032 #include <rtabmap/utilite/ULogger.h>
00033 #include <rtabmap/utilite/UMath.h>
00034
00035 namespace rtabmap {
00036
00037 class Link
00038 {
00039 public:
00040 enum Type {kNeighbor, kGlobalClosure, kLocalSpaceClosure, kLocalTimeClosure, kUserClosure, kVirtualClosure, kUndef};
00041 Link() :
00042 from_(0),
00043 to_(0),
00044 type_(kUndef),
00045 rotVariance_(1.0f),
00046 transVariance_(1.0f)
00047 {
00048 }
00049 Link(int from, int to, Type type, const Transform & transform, float rotVariance, float transVariance) :
00050 from_(from),
00051 to_(to),
00052 transform_(transform),
00053 type_(type),
00054 rotVariance_(rotVariance),
00055 transVariance_(transVariance)
00056 {
00057 UASSERT_MSG(uIsFinite(rotVariance) && rotVariance>0 && uIsFinite(transVariance) && transVariance>0, "Rotational and transitional variances should not be null! (set to 1 if unknown)");
00058 }
00059
00060 bool isValid() const {return from_ > 0 && to_ > 0 && !transform_.isNull() && type_!=kUndef;}
00061
00062 int from() const {return from_;}
00063 int to() const {return to_;}
00064 const Transform & transform() const {return transform_;}
00065 Type type() const {return type_;}
00066 float rotVariance() const {return rotVariance_;}
00067 float transVariance() const {return transVariance_;}
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 void setVariance(float rotVariance, float transVariance) {
00074 UASSERT_MSG(uIsFinite(rotVariance) && rotVariance>0 && uIsFinite(transVariance) && transVariance>0, "Rotational and transitional variances should not be null! (set to 1 if unknown)");
00075 rotVariance_ = rotVariance;
00076 transVariance_ = transVariance;
00077 }
00078
00079 private:
00080 int from_;
00081 int to_;
00082 Transform transform_;
00083 Type type_;
00084 float rotVariance_;
00085 float transVariance_;
00086 };
00087
00088 }
00089
00090
00091 #endif