28 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;
36 graph.insertEdge(from, to, RelativePose);
46 template <
class my_graph_t>
49 const typename my_graph_t::global_poses_t& real_poses,
53 real_poses.find(to)->second - real_poses.find(from)->second;
54 graph.insertEdge(from, to, RelativePose);
63 template <
class my_graph_t>
66 const typename my_graph_t::global_poses_t& real_poses,
70 real_poses.find(to)->second - real_poses.find(from)->second;
72 const auto N = my_graph_t::edge_t::state_length;
77 from, to,
typename my_graph_t::edge_t(RelativePose, mat));
86 template <
class my_graph_t>
89 const typename my_graph_t::global_poses_t& real_poses,
93 real_poses.find(to)->second - real_poses.find(from)->second;
95 const auto N = my_graph_t::edge_t::state_length;
100 from, to,
typename my_graph_t::edge_t(RelativePose, mat));
109 template <
class my_graph_t>
116 my_graph_t& graph,
size_t N_VERTEX = 50,
double DIST_THRES = 7,
117 double NODES_XY_MAX = 20)
120 typename my_graph_t::global_poses_t real_node_poses;
126 const double STD_NOISE_NODE_XYZ = 0.5;
127 const double STD_NOISE_NODE_ANG =
DEG2RAD(5);
130 const double STD_NOISE_EDGE_XYZ = 1e-3;
131 const double STD_NOISE_EDGE_ANG =
DEG2RAD(0.01);
133 for (
TNodeID j = 0; j < N_VERTEX; j++)
135 static double ang = 2 *
M_PI / N_VERTEX;
136 const double R = NODES_XY_MAX + 2 * (j % 2 ? 1 : -1);
137 CPose2D p(
R * cos(ang * j),
R * sin(ang * j), ang);
140 real_node_poses[j] =
p;
157 for (
TNodeID i = 0; i < N_VERTEX; i++)
159 for (
TNodeID j = i + 1; j < N_VERTEX; j++)
161 if (real_node_poses[i].distanceTo(real_node_poses[j]) <
174 for (
auto& edge : graph.edges)
A namespace of pseudo-random numbers genrators of diferent distributions.
static void addNoise(mrpt::poses::CPose3D &p, const mrpt::poses::CPose3D &noise)
static void add(TNodeID from, TNodeID to, const typename my_graph_t::global_poses_t &real_poses, my_graph_t &graph)
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values, timewatch, extensions to STL.
static void addNoise(mrpt::poses::CPose2D &p, const mrpt::poses::CPose3D &noise)
static void addNoise(mrpt::poses::CPosePDFGaussianInf &p, const mrpt::poses::CPose3D &noise)
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.
static void add(TNodeID from, TNodeID to, const typename my_graph_t::global_poses_t &real_poses, my_graph_t &graph)
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...
mrpt::math::CMatrixDouble 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*...
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
A Probability Density function (PDF) of a 2D pose as a Gaussian with a mean and the inverse of the c...
static void add(TNodeID from, TNodeID to, const typename my_graph_t::global_poses_t &real_poses, my_graph_t &graph)
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).
Declares a class that represents a Probability Density function (PDF) of a 3D pose as a Gaussian des...
static void addNoise(mrpt::poses::CPose3DPDFGaussianInf &p, const mrpt::poses::CPose3D &noise)
static void create_ring_path(my_graph_t &graph, size_t N_VERTEX=50, double DIST_THRES=7, double NODES_XY_MAX=20)
static void add(TNodeID from, TNodeID to, const typename my_graph_t::global_poses_t &real_poses, my_graph_t &graph)