24 template <
class my_graph_t>
32 const typename my_graph_t::global_poses_t& real_poses,
35 typename my_graph_t::edge_t RelativePose =
36 real_poses.find(to)->second - real_poses.find(from)->second;
37 graph.insertEdge(from, to, RelativePose);
42 my_graph_t& graph,
size_t N_VERTEX = 50,
double DIST_THRES = 7,
43 double NODES_XY_MAX = 20)
46 typename my_graph_t::global_poses_t real_node_poses;
52 const double STD_NOISE_NODE_XYZ = 0.5;
53 const double STD_NOISE_NODE_ANG =
DEG2RAD(5);
56 const double STD_NOISE_EDGE_XYZ = 0;
57 const double STD_NOISE_EDGE_ANG = 0;
59 for (
TNodeID j = 0; j < N_VERTEX; j++)
61 static double ang = 2 *
M_PI / N_VERTEX;
62 const double R = NODES_XY_MAX + 2 * (j % 2 ? 1 : -1);
63 CPose2D p(
R * cos(ang * j),
R * sin(ang * j), ang);
66 real_node_poses[j] =
p;
73 for (
TNodeID i = 0; i < N_VERTEX; i++)
75 for (
TNodeID j = i + 1; j < N_VERTEX; j++)
77 if (real_node_poses[i].distanceTo(real_node_poses[j]) <
79 addEdge(i, j, real_node_poses, graph);
84 addEdge(0, N_VERTEX / 2, real_node_poses, graph);
90 const my_graph_t graph_GT = graph;
95 itEdge != graph.edges.end(); ++itEdge)
96 itEdge->second +=
typename my_graph_t::edge_t(
107 itNode != graph.nodes.end(); ++itNode)
108 if (itNode->first != graph.root)
109 itNode->second +=
typename my_graph_t::edge_t::type_value(
A namespace of pseudo-random numbers genrators of diferent distributions.
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values, timewatch, extensions to STL.
Abstract graph and tree data structures, plus generic graph algorithms.
This base provides a set of functions for maths stuff.
uint64_t TNodeID
The type for node IDs in graphs of different types.
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
static void addEdge(TNodeID from, TNodeID to, const typename my_graph_t::global_poses_t &real_poses, my_graph_t &graph)
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
A class used to store a 2D pose, including the 2D coordinate point and a heading (phi) angle...
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
static void create_ring_path(my_graph_t &graph, size_t N_VERTEX=50, double DIST_THRES=7, double NODES_XY_MAX=20)
CRandomGenerator & getRandomGenerator()
A static instance of a CRandomGenerator class, for use in single-thread applications.