20 namespace mrpt {
namespace srba {
23 template <
class LM_TYPE>
33 const typename RBA::frameid2pose_map_t &spantree,
34 const typename RBA::TOpenGLRepresentationOptions &options,
44 gl_lms->setPointSize(5);
45 gl_lms->setColor(0,0,1);
49 vector<typename RBA::TRelativeLandmarkPosMap::const_iterator> lms_to_draw;
50 vector<const typename RBA::hessian_traits_t::TSparseBlocksHessian_f::matrix_t *> lms_to_draw_inf_covs;
54 lms_to_draw.push_back(itLM);
55 lms_to_draw_inf_covs.push_back( NULL );
58 const size_t nKnown = lms_to_draw.size();
60 if (options.draw_unknown_feats)
64 lms_to_draw.push_back(itLM);
68 if (it_inf != rba.get_rba_state().unknown_lms_inf_matrices.end())
69 lms_to_draw_inf_covs.push_back( &it_inf->second );
70 else lms_to_draw_inf_covs.push_back(NULL);
77 for (
size_t i=0;i<lms_to_draw.size();i++)
80 const bool is_known = (i<nKnown);
86 if (itLM->second.id_frame_base!=root_keyframe)
89 if(itBaseNode==spantree.end())
91 base_pose = itBaseNode->second.pose;
100 RBA::lm_type::relativeEuclideanLocation(itLM->second.pos, p_wrt_base);
105 gl_lms->insertPoint(p_global.
x,p_global.
y,p_global.
z);
107 if( options.show_unknown_feats_ids )
111 mrpt::format(
"%u",static_cast<unsigned int>( itLM->first)),
115 gl_txt->setColor( is_known ? col_known_lms : col_unknown_lms );
121 if (options.draw_unknown_feats_ellipses && lms_to_draw_inf_covs[i] )
123 double min_inf_diag=std::numeric_limits<double>::max();
124 for (
size_t k=0;k<RBA::LM_DIMS;k++)
126 if (min_inf_diag<1e-5)
continue;
129 lms_to_draw_inf_covs[i]->inv(cov);
132 gl_ellip->setQuantiles( options.draw_unknown_feats_ellipses_quantiles );
133 gl_ellip->enableDrawSolid3D(
false);
135 gl_ellip->setCovMatrix(cov);
136 CPose3D ellip_pose = base_pose;
137 ellip_pose.
x(p_global.
x);
138 ellip_pose.y(p_global.
y);
139 ellip_pose.z(p_global.
z);
141 gl_ellip->setPose(ellip_pose);
155 const typename RBA::frameid2pose_map_t &spantree,
156 const typename RBA::TOpenGLRepresentationOptions &options,
164 gl_edges->setLineWidth(1);
165 gl_edges->setColor(0,0,1);
173 const typename RBA::pose_flag_t & pf = it->second;
175 const typename RBA::keyframe_info &kfi = rba.get_rba_state().keyframes[kf_id];
177 for (
size_t i=0;i<kfi.adjacent_k2f_edges.size();i++)
179 const typename RBA::k2f_edge_t * k2f = kfi.adjacent_k2f_edges[i];
180 const TKeyFrameID other_kf_id = k2f->feat_rel_pos->id_frame_base;
181 if (kf_id==other_kf_id)
186 if (other_it==spantree.end())
continue;
188 const typename RBA::pose_flag_t & other_pf = other_it->second;
194 gl_edges->appendLine( p1.
x(),p1.
y(),p1.z()+0.10, p2.
x(),p2.
y(),p2.z()+0.10 );
208 const typename RBA::frameid2pose_map_t &spantree,
209 const typename RBA::TOpenGLRepresentationOptions &options,
static CEllipsoidPtr Create()
double DEG2RAD(const double x)
Degrees to radians.
A set of object, which are referenced to the coordinates framework established in this object...
static void render(const RBA &rba, const srba::TKeyFrameID root_keyframe, const typename RBA::frameid2pose_map_t &spantree, const typename RBA::TOpenGLRepresentationOptions &options, mrpt::opengl::CSetOfObjects &scene)
const Scalar * const_iterator
double z
X,Y,Z coordinates.
void keep_min(T &var, const K test_val)
If the second argument is below the first one, set the first argument to this lower value...
static CSetOfLinesPtr Create()
A numeric matrix of compile-time fixed size.
This base provides a set of functions for maths stuff.
void composePoint(double lx, double ly, double lz, double &gx, double &gy, double &gz, mrpt::math::CMatrixFixedNumeric< double, 3, 3 > *out_jacobian_df_dpoint=NULL, mrpt::math::CMatrixFixedNumeric< double, 3, 6 > *out_jacobian_df_dpose=NULL, mrpt::math::CMatrixFixedNumeric< double, 3, 6 > *out_jacobian_df_dse3=NULL, bool use_small_rot_approx=false) const
An alternative, slightly more efficient way of doing with G and L being 3D points and P this 6D pose...
double x() const
Common members of all points & poses classes.
#define MRPT_UNUSED_PARAM(a)
Can be used to avoid "not used parameters" warnings from the compiler.
Eigen::Matrix< typename MATRIX::Scalar, MATRIX::ColsAtCompileTime, MATRIX::ColsAtCompileTime > cov(const MATRIX &v)
Computes the covariance matrix from a list of samples in an NxM matrix, where each row is a sample...
static CText3DPtr Create()
std::string BASE_IMPEXP format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
Render "fake graph-slam-like landmarks" as keyframe-to-keyframe constraints.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
static void render(const RBA &rba, const srba::TKeyFrameID root_keyframe, const typename RBA::frameid2pose_map_t &spantree, const typename RBA::TOpenGLRepresentationOptions &options, mrpt::opengl::CSetOfObjects &scene)
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
void insert(const CRenderizablePtr &newObject)
Insert a new object to the list.
renders glyphs filled with antialiased outlines
static void render(const RBA &rba, const srba::TKeyFrameID root_keyframe, const typename RBA::frameid2pose_map_t &spantree, const typename RBA::TOpenGLRepresentationOptions &options, mrpt::opengl::CSetOfObjects &scene)
A RGB color - floats in the range [0,1].
Render 2D/3D point landmarks.
static CPointCloudPtr Create()
uint64_t TKeyFrameID
Numeric IDs for key-frames (KFs)