24 template <
typename node_pose_t,
typename world_limits_t,
typename tree_t>
35 mrpt::make_aligned_shared<mrpt::opengl::CSetOfLines>();
42 double max_veh_radius = 0.;
43 if (!
params.robot_shape.empty())
45 gl_veh_shape->appendLine(
48 for (
size_t i = 2; i <=
params.robot_shape.size(); i++)
50 const size_t idx = i %
params.robot_shape.size();
52 max_veh_radius,
params.robot_shape[idx].norm());
53 gl_veh_shape->appendLineStrip(
54 params.robot_shape[idx].x,
params.robot_shape[idx].y, 0);
57 else if (
params.robot_shape_circular_radius > 0)
59 const int NUM_VERTICES = 10;
60 const double R =
params.robot_shape_circular_radius;
61 for (
int i = 0; i <= NUM_VERTICES; i++)
63 const size_t idx = i % NUM_VERTICES;
64 const size_t idxn = (i + 1) % NUM_VERTICES;
65 const double ang = idx * 2 *
M_PI / (NUM_VERTICES - 1);
66 const double angn = idxn * 2 *
M_PI / (NUM_VERTICES - 1);
67 gl_veh_shape->appendLine(
68 R * cos(ang),
R * sin(ang), 0,
R * cos(angn),
R * sin(angn),
74 xyzcorners_scale = max_veh_radius * 0.5;
84 mrpt::make_aligned_shared<mrpt::opengl::CGridPlaneXY>(
96 string m_name =
"X_rand";
98 obj->enableShowName();
108 string m_name =
"X_near";
109 obj->setName(m_name);
110 obj->enableShowName();
117 typename tree_t::path_t best_path;
123 std::set<const typename tree_t::edge_t *> edges_best_path,
124 edges_best_path_decim;
125 if (!best_path.empty())
129 std::advance(it_end_1, -1);
133 if (it->edge_to_parent) edges_best_path.insert(it->edge_to_parent);
140 if (it->edge_to_parent)
141 edges_best_path_decim.insert(it->edge_to_parent);
142 if (it == it_end_1)
break;
145 if (it == it_end || it == it_end_1)
break;
158 vehShape->setPose(shapePose);
164 const typename tree_t::node_map_t& lstNodes =
169 itNode != lstNodes.end(); ++itNode)
171 const typename tree_t::node_t& node = itNode->second;
176 parent_state = lstNodes.find(node.parent_id)->second.state;
180 const bool is_new_one = (itNode == (lstNodes.end() - 1));
181 const bool is_best_path =
182 edges_best_path.count(node.edge_to_parent) != 0;
183 const bool is_best_path_and_draw_shape =
184 edges_best_path_decim.count(node.edge_to_parent) != 0;
188 const float corner_scale =
189 xyzcorners_scale * (is_new_one ? 1.5f : 1.0f);
197 if (is_best_path_and_draw_shape)
204 vehShape->setPose(shapePose);
215 m_PTGs[node.edge_to_parent->ptg_index].get();
219 mrpt::make_aligned_shared<mrpt::opengl::CSetOfLines>();
228 node.edge_to_parent->ptg_K, *
obj, 0.25f ,
229 node.edge_to_parent->ptg_dist );
259 string m_name =
"X_new";
260 obj->setName(m_name);
261 obj->enableShowName();
270 mrpt::make_aligned_shared<mrpt::opengl::CPointCloud>();
289 mrpt::make_aligned_shared<mrpt::opengl::CPointCloud>();
304 obj->setName(
"START");
305 obj->enableShowName();
315 string m_name =
"GOAL";
316 obj->setName(m_name);
317 obj->enableShowName();
327 mrpt::make_aligned_shared<mrpt::opengl::CText3D>(
mrpt::utils::TColor color_goal
END indication color.
double vehicle_shape_z
(Default=0.01) Height (Z coordinate) for the vehicle shapes.
#define ASSERT_ABOVE_(__A, __B)
virtual void renderPathAsSimpleLine(const uint16_t k, mrpt::opengl::CSetOfLines &gl_obj, const double decimate_distance=0.1, const double max_path_distance=-1.0) const
Returns the representation of one trajectory of this PTG as a 3D OpenGL object (a simple curved line)...
const mrpt::maps::CPointsMap * local_obs_from_nearest_pose
const mrpt::poses::CPose2D * x_rand_pose
const Scalar * const_iterator
mrpt::math::TPoint3D log_msg_position
GLsizei GLsizei GLuint * obj
mrpt::utils::TColor color_ground_xy_grid
mrpt::utils::TNodeID highlight_path_to_node_id
Highlight the path from root towards this node (usually, the target)
double xyzcorners_scale
A scale factor to all XYZ corners (default=0, means auto determien from vehicle shape) ...
bool highlight_last_added_edge
(Default=false)
std::shared_ptr< CText3D > Ptr
This is the base class for any user-defined PTG.
mrpt::nav::TListPTGPtr m_PTGs
std::shared_ptr< CSetOfObjects > Ptr
Options for renderMoveTree()
double vehicle_line_width
Robot line width for visualization - default 2.0.
mrpt::utils::TColor color_optimal_edge
GLsizei const GLchar ** string
double ground_xy_grid_frequency
(Default=10 meters) Set to 0 to disable
const mrpt::poses::CPose2D * x_nearest_pose
bool draw_obstacles
(Default=true)
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
int point_size_local_obstacles
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).
const mrpt::poses::CPose2D * new_state
CSetOfObjects::Ptr CornerXYZ(float scale=1.0)
Returns three arrows representing a X,Y,Z 3D corner.
CSetOfObjects::Ptr CornerXYZSimple(float scale=1.0, float lineWidth=1.0)
Returns three arrows representing a X,Y,Z 3D corner (just thick lines instead of complex arrows for f...
Lightweight 3D pose (three spatial coordinates, plus three angular coordinates).
mrpt::utils::TColor color_vehicle
Robot color.
This class allows the user to create, load, save, and render 3D scenes using OpenGL primitives...
std::shared_ptr< CSetOfLines > Ptr
size_t draw_shape_decimation
(Default=1) Draw one out of N vehicle shapes along the highlighted path
mrpt::utils::TColor color_last_edge
mrpt::utils::TColor color_start
START indication color.
mrpt::utils::TColor color_obstacles
obstacles color
void renderMoveTree(mrpt::opengl::COpenGLScene &scene, const TPlannerInputTempl< node_pose_t, world_limits_t > &pi, const TPlannerResultTempl< tree_t > &result, const TRenderPlannedPathOptions &options)
std::shared_ptr< CPointCloud > Ptr
A set of independent lines (or segments), one line with its own start and end positions (X...
void insert(const CRenderizable::Ptr &newObject, const std::string &viewportName=std::string("main"))
Insert a new object into the scene, in the given viewport (by default, into the "main" viewport)...
GLenum const GLfloat * params
mrpt::utils::TColor color_normal_edge
void keep_max(T &var, const K test_val)
If the second argument is above the first one, set the first argument to this higher value...
std::shared_ptr< CGridPlaneXY > Ptr
mrpt::utils::TColor color_local_obstacles
local obstacles color
tree_t move_tree
The generated motion tree that explores free space starting at "start".