25 template <
class my_graph_t>
30 static void addEdge(
TNodeID from,
TNodeID to,
const typename my_graph_t::global_poses_t &real_poses,my_graph_t &graph)
32 typename my_graph_t::edge_t RelativePose = real_poses.find(to)->second - real_poses.find(from)->second;
33 graph.insertEdge(from,to, RelativePose );
40 double DIST_THRES = 7,
41 double NODES_XY_MAX = 20)
44 typename my_graph_t::global_poses_t real_node_poses;
50 const double STD_NOISE_NODE_XYZ = 0.5;
51 const double STD_NOISE_NODE_ANG =
DEG2RAD(5);
54 const double STD_NOISE_EDGE_XYZ = 0;
55 const double STD_NOISE_EDGE_ANG = 0;
58 for (
TNodeID j=0;j<N_VERTEX;j++)
60 static double ang = 2*
M_PI/N_VERTEX;
61 const double R = NODES_XY_MAX + 2 * (j % 2 ? 1:-1);
68 real_node_poses[j] =
p;
76 for (
TNodeID i=0;i<N_VERTEX;i++)
78 for (
TNodeID j=i+1;j<N_VERTEX;j++)
80 if ( real_node_poses[i].distanceTo(real_node_poses[j]) < DIST_THRES )
81 addEdge(i,j,real_node_poses,graph);
86 addEdge(0,N_VERTEX/2,real_node_poses,graph);
92 const my_graph_t graph_GT = graph;
96 itEdge->second +=
typename my_graph_t::edge_t(
CPose3D(
105 if (itNode->first!=graph.root)
106 itNode->second +=
typename my_graph_t::edge_t::type_value(
CPose3D(
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.
BASE_IMPEXP CRandomGenerator randomGenerator
A static instance of a CRandomGenerator class, for use in single-thread applications.
double drawGaussian1D(const double mean, const double std)
Generate a normally distributed pseudo-random number.
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)