24 template <
typename node_pose_t,
typename world_limits_t,
typename tree_t>
36 double xyzcorners_scale;
41 double max_veh_radius = 0.;
42 if (!
params.robot_shape.empty())
44 gl_veh_shape->appendLine(
47 for (
size_t i = 2; i <=
params.robot_shape.size(); i++)
49 const size_t idx = i %
params.robot_shape.size();
51 gl_veh_shape->appendLineStrip(
params.robot_shape[idx].x,
params.robot_shape[idx].y, 0);
54 else if (
params.robot_shape_circular_radius>0)
56 const int NUM_VERTICES = 10;
57 const double R =
params.robot_shape_circular_radius;
58 for (
int i = 0; i <= NUM_VERTICES; i++)
60 const size_t idx = i % NUM_VERTICES;
61 const size_t idxn = (i + 1) % NUM_VERTICES;
62 const double ang = idx * 2 *
M_PI / (NUM_VERTICES - 1);
63 const double angn = idxn * 2 *
M_PI / (NUM_VERTICES - 1);
64 gl_veh_shape->appendLine(
65 R*cos(ang),
R*sin(ang), 0,
66 R*cos(angn),
R*sin(angn), 0);
71 xyzcorners_scale = max_veh_radius * 0.5;
89 string m_name =
"X_rand";
91 obj->enableShowName();
100 string m_name =
"X_near";
101 obj->setName(m_name);
102 obj->enableShowName();
108 typename tree_t::path_t best_path;
113 std::set<const typename tree_t::edge_t*> edges_best_path, edges_best_path_decim;
114 if (!best_path.empty())
120 if (it->edge_to_parent)
121 edges_best_path.insert(it->edge_to_parent);
127 if (it->edge_to_parent)
128 edges_best_path_decim.insert(it->edge_to_parent);
129 if (it == it_end_1)
break;
131 if (it == it_end || it == it_end_1)
break;
142 vehShape->setPose(shapePose);
148 const typename tree_t::node_map_t & lstNodes = result.
move_tree.getAllNodes();
152 const typename tree_t::node_t & node = itNode->second;
157 parent_state = lstNodes.find(node.parent_id)->second.state;
161 const bool is_new_one = (itNode == (lstNodes.end() - 1));
162 const bool is_best_path = edges_best_path.count(node.edge_to_parent) != 0;
163 const bool is_best_path_and_draw_shape = edges_best_path_decim.count(node.edge_to_parent) != 0;
167 const float corner_scale = xyzcorners_scale* (is_new_one ? 1.5f : 1.0f);
174 if (is_best_path_and_draw_shape)
179 vehShape->setPose(shapePose);
224 string m_name =
"X_new";
225 obj->setName(m_name);
226 obj->enableShowName();
260 obj->setName(
"START");
261 obj->enableShowName();
270 string m_name =
"GOAL";
271 obj->setName(m_name);
272 obj->enableShowName();
mrpt::utils::TColor color_goal
END indication color.
double vehicle_shape_z
(Default=0.01) Height (Z coordinate) for the vehicle shapes. Helps making it in the "first plane" ...
#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)...
CSetOfObjectsPtr OPENGL_IMPEXP CornerXYZ(float scale=1.0)
Returns three arrows representing a X,Y,Z 3D corner.
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)
static CSetOfLinesPtr Create()
This is the base class for any user-defined PTG.
void insert(const CRenderizablePtr &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::nav::TListPTGPtr m_PTGs
CSetOfObjectsPtr OPENGL_IMPEXP 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...
Options for renderMoveTree()
double vehicle_line_width
Robot line width for visualization - default 2.0.
mrpt::utils::TColor color_optimal_edge
static CText3DPtr Create()
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)
static CGridPlaneXYPtr Create()
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
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...
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
static CPointCloudPtr Create()
void renderMoveTree(mrpt::opengl::COpenGLScene &scene, const TPlannerInputTempl< node_pose_t, world_limits_t > &pi, const TPlannerResultTempl< tree_t > &result, const TRenderPlannedPathOptions &options)
A set of independent lines (or segments), one line with its own start and end positions (X...
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...
mrpt::utils::TColor color_local_obstacles
local obstacles color
tree_t move_tree
The generated motion tree that explores free space starting at "start".