Tango: fixed black clouds. Rtabmap: only add latest optimized pose to graph if localized.

This commit is contained in:
matlabbe
2016-12-05 13:27:29 -05:00
parent 3c17049084
commit e5524ddc1d
6 changed files with 23 additions and 12 deletions

View File

@@ -432,7 +432,9 @@ int RTABMapApp::Render()
}
// Did we lose OpenGL context? If so, recreate the context;
if(main_scene_.getAddedClouds().size() != createdMeshes_.size())
std::set<int> added = main_scene_.getAddedClouds();
added.erase(-1);
if(added.size() != createdMeshes_.size())
{
for(std::map<int, Mesh>::iterator iter=createdMeshes_.begin(); iter!=createdMeshes_.end(); ++iter)
{
@@ -668,7 +670,7 @@ int RTABMapApp::Render()
pcl::PointCloud<pcl::PointXYZRGB>::Ptr cloud;
pcl::IndicesPtr indices(new std::vector<int>);
cloud = rtabmap::util3d::cloudRGBFromSensorData(odomEvent.data(), meshDecimation_, maxCloudDepth_, 0.0f, indices.get());
if(cloud->size())
if(cloud->size() && indices->size())
{
LOGI("Created odom cloud (rgb=%dx%d depth=%dx%d cloud=%dx%d)",
odomEvent.data().imageRaw().cols, odomEvent.data().imageRaw().rows,

View File

@@ -336,7 +336,7 @@ void PointCloudDrawable::Render(const glm::mat4 & projectionMatrix, const glm::m
GLuint point_size_handle_ = glGetUniformLocation(cloud_shader_program_, "point_size");
glUniform1f(point_size_handle_, pointSize);
GLuint gain_handle = glGetUniformLocation(texture_shader_program_, "u_gain");
GLuint gain_handle = glGetUniformLocation(cloud_shader_program_, "u_gain");
glUniform1f(gain_handle, gain_);
GLint attribute_vertex = glGetAttribLocation(cloud_shader_program_, "vertex");