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 GRAPH_H_
00029 #define GRAPH_H_
00030
00031 #include "rtabmap/core/RtabmapExp.h"
00032
00033 #include <map>
00034 #include <list>
00035 #include <rtabmap/core/Link.h>
00036 #include <rtabmap/core/GeodeticCoords.h>
00037
00038 namespace rtabmap {
00039 class Memory;
00040
00041 namespace graph {
00042
00044
00046
00047 bool RTABMAP_EXP exportPoses(
00048 const std::string & filePath,
00049 int format,
00050 const std::map<int, Transform> & poses,
00051 const std::multimap<int, Link> & constraints = std::multimap<int, Link>(),
00052 const std::map<int, double> & stamps = std::map<int, double>(),
00053 bool g2oRobust = false);
00054
00055 bool RTABMAP_EXP importPoses(
00056 const std::string & filePath,
00057 int format,
00058 std::map<int, Transform> & poses,
00059 std::multimap<int, Link> * constraints = 0,
00060 std::map<int, double> * stamps = 0);
00061
00062 bool RTABMAP_EXP exportGPS(
00063 const std::string & filePath,
00064 const std::map<int, GPS> & gpsValues,
00065 unsigned int rgba = 0xFFFFFFFF);
00066
00075 void RTABMAP_EXP calcKittiSequenceErrors(
00076 const std::vector<Transform> &poses_gt,
00077 const std::vector<Transform> &poses_result,
00078 float & t_err,
00079 float & r_err);
00080
00089 Transform RTABMAP_EXP calcRMSE(
00090 const std::map<int, Transform> &groundTruth,
00091 const std::map<int, Transform> &poses,
00092 float & translational_rmse,
00093 float & translational_mean,
00094 float & translational_median,
00095 float & translational_std,
00096 float & translational_min,
00097 float & translational_max,
00098 float & rotational_rmse,
00099 float & rotational_mean,
00100 float & rotational_median,
00101 float & rotational_std,
00102 float & rotational_min,
00103 float & rotational_max);
00104
00105 std::multimap<int, Link>::iterator RTABMAP_EXP findLink(
00106 std::multimap<int, Link> & links,
00107 int from,
00108 int to,
00109 bool checkBothWays = true);
00110 std::multimap<int, int>::iterator RTABMAP_EXP findLink(
00111 std::multimap<int, int> & links,
00112 int from,
00113 int to,
00114 bool checkBothWays = true);
00115 std::multimap<int, Link>::const_iterator RTABMAP_EXP findLink(
00116 const std::multimap<int, Link> & links,
00117 int from,
00118 int to,
00119 bool checkBothWays = true);
00120 std::multimap<int, int>::const_iterator RTABMAP_EXP findLink(
00121 const std::multimap<int, int> & links,
00122 int from,
00123 int to,
00124 bool checkBothWays = true);
00125
00126 std::multimap<int, Link> RTABMAP_EXP filterDuplicateLinks(
00127 const std::multimap<int, Link> & links);
00128 std::multimap<int, Link> RTABMAP_EXP filterLinks(
00129 const std::multimap<int, Link> & links,
00130 Link::Type filteredType);
00131 std::map<int, Link> RTABMAP_EXP filterLinks(
00132 const std::map<int, Link> & links,
00133 Link::Type filteredType);
00134
00135
00136 std::map<int, Transform> RTABMAP_EXP frustumPosesFiltering(
00137 const std::map<int, Transform> & poses,
00138 const Transform & cameraPose,
00139 float horizontalFOV = 45.0f,
00140 float verticalFOV = 45.0f,
00141 float nearClipPlaneDistance = 0.1f,
00142 float farClipPlaneDistance = 100.0f,
00143 bool negative = false);
00144
00153 std::map<int, Transform> RTABMAP_EXP radiusPosesFiltering(
00154 const std::map<int, Transform> & poses,
00155 float radius,
00156 float angle,
00157 bool keepLatest = true);
00158
00166 std::multimap<int, int> RTABMAP_EXP radiusPosesClustering(
00167 const std::map<int, Transform> & poses,
00168 float radius,
00169 float angle);
00170
00171 void reduceGraph(
00172 const std::map<int, Transform> & poses,
00173 const std::multimap<int, Link> & links,
00174 std::multimap<int, int> & hyperNodes,
00175 std::multimap<int, Link> & hyperLinks);
00176
00186 std::list<std::pair<int, Transform> > RTABMAP_EXP computePath(
00187 const std::map<int, rtabmap::Transform> & poses,
00188 const std::multimap<int, int> & links,
00189 int from,
00190 int to,
00191 bool updateNewCosts = false);
00192
00203 std::list<int> RTABMAP_EXP computePath(
00204 const std::multimap<int, Link> & links,
00205 int from,
00206 int to,
00207 bool updateNewCosts = false,
00208 bool useSameCostForAllLinks = false);
00209
00219 std::list<std::pair<int, Transform> > RTABMAP_EXP computePath(
00220 int fromId,
00221 int toId,
00222 const Memory * memory,
00223 bool lookInDatabase = true,
00224 bool updateNewCosts = false,
00225 float linearVelocity = 0.0f,
00226 float angularVelocity = 0.0f);
00227
00228 int RTABMAP_EXP findNearestNode(
00229 const std::map<int, rtabmap::Transform> & nodes,
00230 const rtabmap::Transform & targetPose);
00231
00232 std::vector<int> RTABMAP_EXP findNearestNodes(
00233 const std::map<int, rtabmap::Transform> & nodes,
00234 const rtabmap::Transform & targetPose,
00235 int k);
00236
00244 std::map<int, float> RTABMAP_EXP getNodesInRadius(
00245 int nodeId,
00246 const std::map<int, Transform> & nodes,
00247 float radius);
00248 std::map<int, Transform> RTABMAP_EXP getPosesInRadius(
00249 int nodeId,
00250 const std::map<int, Transform> & nodes,
00251 float radius,
00252 float angle = 0.0f);
00253
00254 float RTABMAP_EXP computePathLength(
00255 const std::vector<std::pair<int, Transform> > & path,
00256 unsigned int fromIndex = 0,
00257 unsigned int toIndex = 0);
00258
00259
00260 float RTABMAP_EXP computePathLength(
00261 const std::map<int, Transform> & path);
00262
00263 std::list<std::map<int, Transform> > RTABMAP_EXP getPaths(
00264 std::map<int, Transform> poses,
00265 const std::multimap<int, Link> & links);
00266
00267
00268 }
00269
00270 }
00271 #endif