@@ -96,8 +96,15 @@ EOD_ROS::EOD_ROS(ros::NodeHandle nh, ros::NodeHandle nh_p){
9696#endif
9797 // set up publishers
9898 simple_objects_pub_ = nh_p_.advertise <extended_object_detection::SimpleObjectArray>(" simple_objects" ,1 );
99- if ( publish_markers)
99+ #ifdef USE_IGRAPH
100+ complex_objects_pub_ = nh_p_.advertise <extended_object_detection::ComplexObjectArray>(" complex_objects" ,1 );
101+ #endif
102+ if ( publish_markers){
100103 simple_objects_markers_pub_ = nh_p_.advertise <visualization_msgs::MarkerArray>(" simple_objects_markers" ,1 );
104+ #ifdef USE_IGRAPH
105+ complex_objects_markers_pub_ = nh_p_.advertise <visualization_msgs::MarkerArray>(" complex_objects_markers" ,1 );
106+ #endif
107+ }
101108
102109 private_it_ = new image_transport::ImageTransport (nh_p_);
103110 output_image_pub_ = private_it_->advertise (" detected_image" , 1 );
@@ -228,9 +235,15 @@ void EOD_ROS::detect(const eod::InfoImage& rgb, const eod::InfoImage& depth, std
228235 for (auto & c_it : selected_complex_objects){
229236 // ROS_INFO("Identifying complex...");
230237 c_it->Identify (rgb, depth, frame_sequence);
231- for (auto & eoi : c_it->complex_objects ){
238+ // for(auto& eoi : c_it->complex_objects){
239+ for ( size_t i = 0 ; i < c_it->complex_objects .size () ; i++ ){
232240 extended_object_detection::ComplexObject cmplx_msg;
233- cmplx_msg.complex_object = eoi_to_base_object (c_it->name , c_it->ID , &eoi, rgb.K ());
241+
242+ cmplx_msg.complex_object = eoi_to_base_object (c_it->name , c_it->ID , &(c_it->complex_objects [i]), rgb.K ());
243+
244+ for ( auto & name_eoi : c_it->simple_objects [i] ){// DANGER: I belive size complex_objects == size simple_objects
245+ cmplx_msg.simple_objects .push_back (eoi_to_base_object (name_eoi.first , -1 , name_eoi.second , rgb.K ()));
246+ }
234247 complex_msg.objects .push_back (cmplx_msg);
235248 }
236249 if (publish_image_output)
@@ -242,6 +255,9 @@ void EOD_ROS::detect(const eod::InfoImage& rgb, const eod::InfoImage& depth, std
242255 simples_msg.header .stamp = ros::Time::now ();
243256
244257 simple_objects_pub_.publish (simples_msg);
258+ #ifdef USE_IGRAPH
259+ complex_objects_pub_.publish (complex_msg);
260+ #endif
245261
246262 if (publish_markers){
247263 visualization_msgs::MarkerArray mrk_array_msg;
0 commit comments