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;
46 from, to,
typename my_graph_t::edge_t(RelativePose, mat));
50 graph.insertEdge(from, to, RelativePose);
56 my_graph_t& graph,
size_t N_VERTEX = 50,
double DIST_THRES = 7,
57 double NODES_XY_MAX = 20)
60 typename my_graph_t::global_poses_t real_node_poses;
73 for (
TNodeID j = 0; j < N_VERTEX; j++)
75 static double ang = 2 *
M_PI / N_VERTEX;
76 const double R = NODES_XY_MAX + 2 * (j % 2 ? 1 : -1);
77 CPose2D p(
R * cos(ang * j),
R * sin(ang * j), ang);
80 real_node_poses[j] =
p;
87 for (
TNodeID i = 0; i < N_VERTEX; i++)
89 for (
TNodeID j = i + 1; j < N_VERTEX; j++)
91 if (real_node_poses[i].distanceTo(real_node_poses[j]) <
93 addEdge(i, j, real_node_poses, graph);
98 addEdge(0, N_VERTEX / 2, real_node_poses, graph);
104 const my_graph_t graph_GT = graph;
107 for (
auto& edge : graph.edges)
122 if constexpr (my_graph_t::edge_t::is_PDF())
124 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;
149 edge.second +=
typename my_graph_t::edge_t(noise, mat);
153 edge.second +=
typename my_graph_t::edge_t(noise);
160 itNode != graph.nodes.end(); ++itNode)
161 if (itNode->first != graph.root)
163 ->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*...
void addEdge(TNodeID from, TNodeID to, const mrpt::aligned_std_map< TNodeID, CPose2D > &real_poses, CNetworkOfPoses2D &graph_links)
double DEG2RAD(const double x)
Degrees to radians.
Abstract graph and tree data structures, plus generic graph algorithms.
A numeric matrix of compile-time fixed size.
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