@@ -209,6 +209,7 @@ bool SequentialSceneHypothesis::checkObjectReplaced(const std::string &model_nam
209
209
{
210
210
// use AABB to check if the original object volume has been occupied by something else
211
211
// TODO: IMPLEMENT THIS!!
212
+ // use bullet contactTest;
212
213
return false ;
213
214
}
214
215
@@ -246,32 +247,67 @@ std::map<std::string, AdditionalHypotheses> SequentialSceneHypothesis::generateO
246
247
247
248
std::map<std::string, std::string> &object_label_class_map = this ->previous_scene_observation_ .object_label_class_map_ ;
248
249
250
+ for (std::vector<std::string>::const_iterator it = change_in_scene.perturbed_objects_ .begin ();
251
+ it != change_in_scene.perturbed_objects_ .end (); ++it)
252
+ {
253
+ const std::string &object_id = *it;
254
+ const vertex_t &prev_obj_vertex = prev_vertex_map[object_id];
255
+ const btTransform &prev_transform = previous_best_scene_hypothesis.scene_support_graph_ [prev_obj_vertex].object_pose_ ;
256
+
257
+ const vertex_t &cur_obj_vertex = cur_vertex_map[object_id];
258
+ const std::size_t dist = current_best_data_scene_structure_.scene_support_graph_ [cur_obj_vertex].distance_to_ground_ ;
259
+ const btTransform &cur_transform = current_best_data_scene_structure_.scene_support_graph_ [cur_obj_vertex].object_pose_ ;
260
+
261
+ const std::string &model_name = object_label_class_map[object_id];
262
+
263
+ std::cerr << object_id << std::endl;
264
+
265
+ double current_data_confidence = this ->data_probability_check_ ->getIcpConfidenceResult (model_name, cur_transform);
266
+ // use previous best pose if the confidence difference between current pose and previous pose is small
267
+ if (current_data_confidence < 0.05 || this ->judgeHypothesis (model_name,prev_transform,0.7 *current_data_confidence))
268
+ {
269
+ std::cerr << " Retained previous pose\n " ;
270
+ object_pose_by_dist[dist][object_id] = prev_transform;
271
+ }
272
+ else
273
+ {
274
+ std::cerr << " Use current pose\n " ;
275
+ object_pose_by_dist[dist][object_id] = cur_transform;
276
+ }
277
+ }
278
+
249
279
for (std::vector<std::string>::const_iterator it = change_in_scene.support_retained_object_ .begin ();
250
280
it != change_in_scene.support_retained_object_ .end (); ++it)
251
281
{
252
282
// add the object pose by distance information for support retained objects
253
283
const std::string &object_id = *it;
254
284
const vertex_t &obj_vertex = prev_vertex_map[object_id];
255
-
285
+
256
286
// the object_pose_by_dist starts at 0 (already excludes background)
257
- const std::size_t dist = previous_best_scene_hypothesis.scene_support_graph_ [obj_vertex].distance_to_ground_ - 1 ;
287
+ const std::size_t prev_dist = previous_best_scene_hypothesis.scene_support_graph_ [obj_vertex].distance_to_ground_ ;
288
+ const std::size_t dist = prev_dist > 1 && prev_dist <= object_pose_by_dist.size ()
289
+ ? prev_dist - 1 : disconnected_object_dist;
290
+
258
291
const btTransform &prev_transform = previous_best_scene_hypothesis.scene_support_graph_ [obj_vertex].object_pose_ ;
259
292
260
293
const std::string &model_name = object_label_class_map[object_id];
261
294
262
295
const vertex_t &cur_obj_vertex = cur_vertex_map[object_id];
263
296
const btTransform &cur_transform = current_best_data_scene_structure_.scene_support_graph_ [cur_obj_vertex].object_pose_ ;
297
+
298
+ std::cerr << object_id << std::endl;
264
299
265
300
double current_data_confidence = this ->data_probability_check_ ->getIcpConfidenceResult (model_name, cur_transform);
266
-
267
301
// use previous best pose if the confidence difference between current pose and previous pose is small
268
302
if (current_data_confidence < 0.05 || this ->judgeHypothesis (model_name,prev_transform,0.7 *current_data_confidence))
269
303
{
270
- object_pose_by_dist[dist][object_id] = prev_transform;
304
+ std::cerr << " Retained previous pose\n " ;
305
+ object_pose_by_dist[dist][object_id] = prev_transform;
271
306
}
272
307
else
273
308
{
274
- object_pose_by_dist[dist][object_id] = cur_transform;
309
+ std::cerr << " Use current pose\n " ;
310
+ object_pose_by_dist[dist][object_id] = cur_transform;
275
311
}
276
312
277
313
// add the child information of this object and move the optimization order of the child to its proper distance
@@ -310,10 +346,12 @@ std::map<std::string, AdditionalHypotheses> SequentialSceneHypothesis::generateO
310
346
else
311
347
{
312
348
std::cerr << " Warning, found inconsistency of object " << *obj_it << " in current scene graph\n " ;
349
+ continue ;
313
350
}
314
351
}
315
352
object_childs_map[object_id] = obj_child_tf_supported;
316
353
}
354
+
317
355
if (additional_perturbed.size () > 0 ) result.insert (additional_perturbed.begin (),additional_perturbed.end ());
318
356
if (additional_static.size () > 0 ) result.insert (additional_static.begin (),additional_static.end ());
319
357
if (additional_support_retained.size () > 0 ) result.insert (additional_support_retained.begin (),additional_support_retained.end ());
@@ -332,6 +370,7 @@ std::map<std::string, AdditionalHypotheses> SequentialSceneHypothesis::generateO
332
370
result[it->first ] = AdditionalHypotheses (it->second .first , object_pose_hypotheses, ADD_OBJECT);
333
371
}
334
372
}
373
+
335
374
return result;
336
375
}
337
376
0 commit comments