23 template <
class my_graph_t>
31 const typename my_graph_t::global_poses_t& real_poses,
35 real_poses.find(to)->second - real_poses.find(from)->second;
38 if constexpr (my_graph_t::edge_t::is_PDF())
40 const auto N = my_graph_t::edge_t::state_length;
47 from, to,
typename my_graph_t::edge_t(RelativePose, mat));
51 graph.insertEdge(from, to, RelativePose);
57 my_graph_t& graph,
size_t N_VERTEX = 50,
double DIST_THRES = 7,
58 double NODES_XY_MAX = 20)
61 typename my_graph_t::global_poses_t real_node_poses;
74 for (
TNodeID j = 0; j < N_VERTEX; j++)
76 static double ang = 2 *
M_PI / N_VERTEX;
77 const double R = NODES_XY_MAX + 2 * (j % 2 ? 1 : -1);
78 CPose2D p(
R * cos(ang * j),
R * sin(ang * j), ang);
81 real_node_poses[j] = p;
88 for (
TNodeID i = 0; i < N_VERTEX; i++)
90 for (
TNodeID j = i + 1; j < N_VERTEX; j++)
92 if (real_node_poses[i].distanceTo(real_node_poses[j]) <
94 addEdge(i, j, real_node_poses, graph);
99 addEdge(0, N_VERTEX / 2, real_node_poses, graph);
105 const my_graph_t graph_GT = graph;
108 for (
auto& edge : graph.edges)
123 if constexpr (my_graph_t::edge_t::is_PDF())
125 const auto N = my_graph_t::edge_t::state_length;
129 edge.second +=
typename my_graph_t::edge_t(noise, mat);
133 edge.second +=
typename my_graph_t::edge_t(noise);
142 if constexpr (my_graph_t::edge_t::is_PDF())
144 const auto N = my_graph_t::edge_t::state_length;
148 edge.second +=
typename my_graph_t::edge_t(noise, mat);
152 edge.second +=
typename my_graph_t::edge_t(noise);
157 for (
auto itNode = graph.nodes.begin(); itNode != graph.nodes.end();
159 if (itNode->first != graph.root)
161 ->second +=
typename my_graph_t::edge_t::type_value(
CPose3D(
A namespace of pseudo-random numbers generators of diferent distributions.
MATRIX drawDefinitePositiveMatrix(const size_t dim, const double std_scale=1.0, const double diagonal_epsilon=1e-8)
Generates a random definite-positive matrix of the given size, using the formula C = v*v^t + epsilon*...
A compile-time fixed-size numeric matrix container.
void addEdge(TNodeID from, TNodeID to, const std::map< TNodeID, CPose2D > &real_poses, CNetworkOfPoses2D &graph_links)
size_t size(const MATRIXLIKE &m, const int dim)
Abstract graph and tree data structures, plus generic graph algorithms.
const double STD_NOISE_NODE_XYZ
This base provides a set of functions for maths stuff.
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)
const double STD_NOISE_EDGE_ANG
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).
uint64_t TNodeID
A generic numeric type for unique IDs of nodes or entities.
static void create_ring_path(my_graph_t &graph, size_t N_VERTEX=50, double DIST_THRES=7, double NODES_XY_MAX=20)
const double STD_NOISE_NODE_ANG
CRandomGenerator & getRandomGenerator()
A static instance of a CRandomGenerator class, for use in single-thread applications.
const double STD_NOISE_EDGE_XYZ