@@ -76,6 +76,8 @@ void RosSceneHypothesisAssessor::setNodeHandle(const ros::NodeHandle &nh)
76
76
77
77
nh.param (" best_hypothesis_only" ,best_hypothesis_only_,false );
78
78
nh.param (" small_obj_g_comp" ,GRAVITY_SCALE_COMPENSATION,3 );
79
+ nh.param (" sim_freq_multiplier" ,SIMULATION_FREQUENCY_MULTIPLIER,1 .);
80
+
79
81
SCALED_GRAVITY_MAGNITUDE = SCALING * GRAVITY_MAGNITUDE / GRAVITY_SCALE_COMPENSATION;
80
82
81
83
if (load_table){
@@ -104,6 +106,7 @@ void RosSceneHypothesisAssessor::setNodeHandle(const ros::NodeHandle &nh)
104
106
this ->scene_pcl_sub = this ->nh_ .subscribe (scene_pcl2_topic,1 ,&RosSceneHypothesisAssessor::addSceneCloud,this );
105
107
106
108
this ->done_message_pub = this ->nh_ .advertise <std_msgs::Empty>(" done_hypothesis_msg" ,1 );
109
+ this ->scene_graph_pub = this ->nh_ .advertise <sequential_scene_parsing::SceneGraph>(" scene_structure_list" ,1 );
107
110
108
111
// setup objrecransac tool
109
112
boost::split (object_names,objransac_model_list,boost::is_any_of (" ," ));
@@ -334,6 +337,12 @@ void RosSceneHypothesisAssessor::processDetectedObjectMsgs()
334
337
std::cerr << " Getting corrected object transform...\n " ;
335
338
std::map<std::string, ObjectParameter> object_transforms = this ->getCorrectedObjectTransform (best_hypothesis_only_);
336
339
this ->updateTfFromObjTransformMap (object_transforms);
340
+
341
+ if (best_hypothesis_only_)
342
+ {
343
+ this ->scene_graph_pub .publish (this ->generateSceneGraphMsgs ());
344
+ }
345
+
337
346
this ->mtx_ .unlock ();
338
347
339
348
this ->has_tf_ = true ;
@@ -415,5 +424,44 @@ void RosSceneHypothesisAssessor::processHypotheses()
415
424
std_msgs::Empty done_msg;
416
425
this ->done_message_pub .publish (done_msg);
417
426
427
+ this ->scene_graph_pub .publish (this ->generateSceneGraphMsgs ());
428
+
418
429
this ->mtx_ .unlock ();
419
430
}
431
+
432
+
433
+ sequential_scene_parsing::SceneGraph RosSceneHypothesisAssessor::generateSceneGraphMsgs () const
434
+ {
435
+ std::map<std::string, vertex_t > vertex_map;
436
+ SceneSupportGraph current_graph = this ->getSceneGraphData (vertex_map);
437
+ std::vector<vertex_t > all_base_structs = getAllChildVertices (current_graph, vertex_map[" background" ]);
438
+ sequential_scene_parsing::SceneGraph structure_graph_msg;
439
+ structure_graph_msg.structure .reserve (all_base_structs.size ());
440
+ structure_graph_msg.base_objects_id .reserve (all_base_structs.size ());
441
+ for (std::vector<vertex_t >::const_iterator it = all_base_structs.begin (); it != all_base_structs.end (); ++it)
442
+ {
443
+ sequential_scene_parsing::StructureGraph new_structure;
444
+ OrderedVertexVisitor all_connected_structures = getOrderedVertexList (current_graph, *it, true );
445
+ std::map<std::size_t , std::vector<vertex_t > > vertex_visit_by_distances = all_connected_structures.getVertexVisitOrderByDistances ();
446
+ for (std::map<std::size_t , std::vector<vertex_t > >::const_iterator dist_it = vertex_visit_by_distances.begin ();
447
+ dist_it != vertex_visit_by_distances.end (); ++dist_it)
448
+ {
449
+ // Do nothing for disconnected vertices;
450
+ if (dist_it->first == 0 ) continue ;
451
+
452
+ sequential_scene_parsing::SceneNodes nodes;
453
+ nodes.object_names .reserve (dist_it->second .size ());
454
+ for (std::vector<vertex_t >::const_iterator node_it = dist_it->second .begin (); node_it != dist_it->second .end (); ++node_it)
455
+ {
456
+ nodes.object_names .push_back (current_graph[*node_it].object_id_ );
457
+ }
458
+ new_structure.nodes_level .push_back (nodes);
459
+ }
460
+
461
+ structure_graph_msg.structure .push_back (new_structure);
462
+ structure_graph_msg.base_objects_id .push_back (current_graph[*it].object_id_ );
463
+ }
464
+
465
+ return structure_graph_msg;
466
+ }
467
+
0 commit comments