@@ -245,17 +245,23 @@ void periodic_publish_optimized_poses_smart( const NodeDataManager * manager, co
245245}
246246
247247
248- void monitor_disjoint_set_datastructure ( const NodeDataManager * manager )
248+ void monitor_disjoint_set_datastructure ( const NodeDataManager * manager, const VizPoseGraph * viz )
249249{
250250 ros::Rate loop_rate (1 );
251251
252252 #if 1
253253 while ( ros::ok () )
254254 {
255255 cv::Mat im_disp;
256- manager->getWorldsConstPtr ()->disjoint_set_status_image (im_disp);
256+ // manager->getWorldsConstPtr()->disjoint_set_status_image(im_disp); // will get bubles as well as the text
257+ manager->getWorldsConstPtr ()->disjoint_set_status_image (im_disp, true , false ); // only bubles
258+
259+ #if 1 // set this to zero to imshow the image. helpful for debugging.
260+ viz->publishImage ( im_disp );
261+ #else
257262 cv::imshow( "disjoint_set_status_image" , im_disp );
258263 cv::waitKey(30);
264+ #endif
259265
260266 loop_rate.sleep ();
261267 }
@@ -556,6 +562,11 @@ int main( int argc, char ** argv)
556562 ROS_INFO ( " Publish to %s" , marker_topic.c_str () );
557563 ros::Publisher pub = nh.advertise <visualization_msgs::Marker>( marker_topic , 1000 );
558564
565+ // --- Image ---//
566+ string im_topic = string ( " viz/disjoint_set_status_image" );
567+ ROS_INFO ( " Publish Image to %s" , im_topic.c_str () );
568+ ros::Publisher pub_im = nh.advertise <sensor_msgs::Image>( im_topic , 1000 );
569+
559570
560571 // --- Optimzied Path Publisher ---//
561572 string opt_path_topic = string ( " opt_path" );
@@ -583,13 +594,14 @@ int main( int argc, char ** argv)
583594 // another class for viz.
584595 VizPoseGraph * viz = new VizPoseGraph ( manager, slam );
585596 viz->setVisualizationPublisher ( pub );
597+ viz->setImagePublisher ( pub_im );
586598 viz->setPathPublisher ( pub_path );
587599 viz->setOdometryPublisher ( pub_odometry_opt );
588600
589601 // setup manager publishers threads - adhoc
590602 // std::thread th3( periodic_publish_optimized_poses_smart, manager, slam, viz );
591603 std::thread th4 ( periodic_publish_odoms, manager, viz );
592- std::thread th5 ( monitor_disjoint_set_datastructure, manager );
604+ std::thread th5 ( monitor_disjoint_set_datastructure, manager, viz );
593605
594606 opt_traj_publisher_options options;
595607 options.line_color_style = 10 ;
0 commit comments