Skip to content

Commit

Permalink
Changes in opengl object export
Browse files Browse the repository at this point in the history
Added option for showing/hiding landmarks IDs when exporting map to an
opengl object.

Exported Keyframes now show their IDs.

Fixed gcc warning with Keyframe ID.

Changed edges color in order to make them different from the standard XY
grid plane lines.
  • Loading branch information
famoreno committed Feb 21, 2014
1 parent 8ea894b commit 4c81001
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 12 deletions.
4 changes: 3 additions & 1 deletion libs/srba/include/mrpt/srba/RbaEngine.h
Original file line number Diff line number Diff line change
Expand Up @@ -218,14 +218,16 @@ namespace srba
span_tree_max_depth(static_cast<size_t>(-1)),
draw_unknown_feats(true),
draw_unknown_feats_ellipses(true),
draw_unknown_feats_ellipses_quantiles(1)
draw_unknown_feats_ellipses_quantiles(1),
show_unknown_feats_ids(true)
{
}

size_t span_tree_max_depth; //!< Maximum spanning tree depth for reconstructing relative poses (default=-1 : infinity)
bool draw_unknown_feats; //!< Draw features with non-fixed rel.pos as well?
bool draw_unknown_feats_ellipses;
double draw_unknown_feats_ellipses_quantiles;
bool show_unknown_feats_ids;
};

/** Build an opengl representation of the current state of this RBA problem
Expand Down
4 changes: 3 additions & 1 deletion libs/srba/include/mrpt/srba/impl/export_opengl.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ void RbaEngine<KF2KF_POSE_TYPE,LM_TYPE,OBS_TYPE,RBA_OPTIONS>::build_opengl_repre

mrpt::opengl::CSetOfObjectsPtr o = mrpt::opengl::stock_objects::CornerXYZSimple(0.75,2.0);
o->setPose(p);
o->setName( mrpt::format("%d",itP->first).c_str() );
o->setName( mrpt::format("%d",int(itP->first)).c_str() );
o->enableShowName();
out_scene->insert(o);
}
// And a bigger one for the root:
Expand All @@ -63,6 +64,7 @@ void RbaEngine<KF2KF_POSE_TYPE,LM_TYPE,OBS_TYPE,RBA_OPTIONS>::build_opengl_repre

// Draw all edges between frames:
mrpt::opengl::CSetOfLinesPtr gl_edges = mrpt::opengl::CSetOfLines::Create();
gl_edges->setColor(1,0,1); // Magenta, in order to not confuse them with the standard lines of a grid plane
#ifdef SRBA_WORKAROUND_MSVC9_DEQUE_BUG
for (typename rba_problem_state_t::k2k_edges_deque_t::const_iterator itEdge2 = rba_state.k2k_edges.begin();itEdge2!=rba_state.k2k_edges.end();++itEdge2)
{
Expand Down
23 changes: 13 additions & 10 deletions libs/srba/include/mrpt/srba/impl/export_opengl_landmark_renderers.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,16 +97,19 @@ template <> struct LandmarkRendererBase<landmark_rendering_as_point>
base_pose.composePoint(p_wrt_base,p_global);

gl_lms->insertPoint(p_global.x,p_global.y,p_global.z);

// Add text label:
mrpt::opengl::CText3DPtr gl_txt = mrpt::opengl::CText3D::Create(
mrpt::format("%u",static_cast<unsigned int>( itLM->first)),
"mono", 0.15,
mrpt::opengl::NICE );
gl_txt->setPose(CPose3D(p_global.x,p_global.y,p_global.z,DEG2RAD(-90),DEG2RAD(0),DEG2RAD(90)));
gl_txt->setColor( is_known ? col_known_lms : col_unknown_lms );

scene.insert(gl_txt);

if( options.show_unknown_feats_ids )
{
// Add text label:
mrpt::opengl::CText3DPtr gl_txt = mrpt::opengl::CText3D::Create(
mrpt::format("%u",static_cast<unsigned int>( itLM->first)),
"mono", 0.15,
mrpt::opengl::NICE );
gl_txt->setPose(CPose3D(p_global.x,p_global.y,p_global.z,DEG2RAD(-90),DEG2RAD(0),DEG2RAD(90)));
gl_txt->setColor( is_known ? col_known_lms : col_unknown_lms );

scene.insert(gl_txt);
}

// Uncertainty ellipse?
if (options.draw_unknown_feats_ellipses && lms_to_draw_inf_covs[i] )
Expand Down

0 comments on commit 4c81001

Please sign in to comment.