Go to the documentation of this file.
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 gl_veh_shape->appendLineStrip(
53 params.robot_shape[idx].x,
params.robot_shape[idx].y, 0);
56 else if (
params.robot_shape_circular_radius > 0)
58 const int NUM_VERTICES = 10;
59 const double R =
params.robot_shape_circular_radius;
60 for (
int i = 0; i <= NUM_VERTICES; i++)
62 const size_t idx = i % NUM_VERTICES;
63 const size_t idxn = (i + 1) % NUM_VERTICES;
64 const double ang = idx * 2 *
M_PI / (NUM_VERTICES - 1);
65 const double angn = idxn * 2 *
M_PI / (NUM_VERTICES - 1);
66 gl_veh_shape->appendLine(
67 R * cos(ang),
R * sin(ang), 0,
R * cos(angn),
R * sin(angn),
73 xyzcorners_scale = max_veh_radius * 0.5;
83 mrpt::make_aligned_shared<mrpt::opengl::CGridPlaneXY>(
95 string m_name =
"X_rand";
97 obj->enableShowName();
107 string m_name =
"X_near";
108 obj->setName(m_name);
109 obj->enableShowName();
116 typename tree_t::path_t best_path;
122 std::set<const typename tree_t::edge_t *> edges_best_path,
123 edges_best_path_decim;
124 if (!best_path.empty())
128 std::advance(it_end_1, -1);
132 if (it->edge_to_parent) edges_best_path.insert(it->edge_to_parent);
139 if (it->edge_to_parent)
140 edges_best_path_decim.insert(it->edge_to_parent);
141 if (it == it_end_1)
break;
144 if (it == it_end || it == it_end_1)
break;
157 vehShape->setPose(shapePose);
163 const typename tree_t::node_map_t& lstNodes =
168 itNode != lstNodes.end(); ++itNode)
170 const typename tree_t::node_t& node = itNode->second;
175 parent_state = lstNodes.find(node.parent_id)->second.state;
179 const bool is_new_one = (itNode == (lstNodes.end() - 1));
180 const bool is_best_path =
181 edges_best_path.count(node.edge_to_parent) != 0;
182 const bool is_best_path_and_draw_shape =
183 edges_best_path_decim.count(node.edge_to_parent) != 0;
187 const float corner_scale =
188 xyzcorners_scale * (is_new_one ? 1.5f : 1.0f);
196 if (is_best_path_and_draw_shape)
203 vehShape->setPose(shapePose);
214 m_PTGs[node.edge_to_parent->ptg_index].get();
218 mrpt::make_aligned_shared<mrpt::opengl::CSetOfLines>();
227 node.edge_to_parent->ptg_K, *
obj, 0.25f ,
228 node.edge_to_parent->ptg_dist );
258 string m_name =
"X_new";
259 obj->setName(m_name);
260 obj->enableShowName();
269 mrpt::make_aligned_shared<mrpt::opengl::CPointCloud>();
288 mrpt::make_aligned_shared<mrpt::opengl::CPointCloud>();
303 obj->setName(
"START");
304 obj->enableShowName();
314 string m_name =
"GOAL";
315 obj->setName(m_name);
316 obj->enableShowName();
326 mrpt::make_aligned_shared<mrpt::opengl::CText3D>(
std::shared_ptr< CGridPlaneXY > Ptr
size_t draw_shape_decimation
(Default=1) Draw one out of N vehicle shapes along the highlighted path
std::shared_ptr< CSetOfLines > Ptr
double ground_xy_grid_frequency
(Default=10 meters) Set to 0 to disable
#define ASSERT_ABOVE_(__A, __B)
const Scalar * const_iterator
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).
mrpt::img::TColor color_obstacles
obstacles color
This class allows the user to create, load, save, and render 3D scenes using OpenGL primitives.
A set of independent lines (or segments), one line with its own start and end positions (X,...
GLsizei GLsizei GLuint * obj
mrpt::math::TPoint3D log_msg_position
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
#define ASSERT_(f)
Defines an assertion mechanism.
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...
std::shared_ptr< CPointCloud > Ptr
bool highlight_last_added_edge
(Default=false)
const mrpt::poses::CPose2D * x_rand_pose
mrpt::img::TColor color_local_obstacles
local obstacles color
double xyzcorners_scale
A scale factor to all XYZ corners (default=0, means auto determien from vehicle shape)
mrpt::img::TColor color_start
START indication color
bool draw_obstacles
(Default=true)
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.
mrpt::img::TColor color_goal
END indication color
A class used to store a 2D pose, including the 2D coordinate point and a heading (phi) angle.
double vehicle_line_width
Robot line width for visualization - default 2.0.
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
double vehicle_shape_z
(Default=0.01) Height (Z coordinate) for the vehicle shapes.
mrpt::img::TColor color_ground_xy_grid
Lightweight 3D pose (three spatial coordinates, plus three angular coordinates).
Options for renderMoveTree()
mrpt::img::TColor color_vehicle
Robot color
std::shared_ptr< CSetOfObjects > Ptr
mrpt::graphs::TNodeID highlight_path_to_node_id
Highlight the path from root towards this node (usually, the target)
const mrpt::poses::CPose2D * new_state
mrpt::img::TColor color_optimal_edge
tree_t move_tree
The generated motion tree that explores free space starting at "start".
std::shared_ptr< CText3D > Ptr
CSetOfObjects::Ptr CornerXYZ(float scale=1.0)
Returns three arrows representing a X,Y,Z 3D corner.
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)...
int point_size_local_obstacles
GLsizei const GLchar ** string
const mrpt::poses::CPose2D * x_nearest_pose
mrpt::nav::TListPTGPtr m_PTGs
const mrpt::maps::CPointsMap * local_obs_from_nearest_pose
void renderMoveTree(mrpt::opengl::COpenGLScene &scene, const TPlannerInputTempl< node_pose_t, world_limits_t > &pi, const TPlannerResultTempl< tree_t > &result, const TRenderPlannedPathOptions &options)
This is the base class for any user-defined PTG.
GLenum const GLfloat * params
mrpt::img::TColor color_normal_edge
mrpt::img::TColor color_last_edge
Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST | |