@@ -73,8 +73,8 @@ void periodic_publish_odoms( const NodeDataManager * manager, const VizPoseGraph
7373{
7474 cout << " Start `periodic_publish`\n " ;
7575 ros::Rate loop_rate (15 );
76- // double offset_x = 30., offset_y=0., offset_z=0.;
77- double offset_x = 0 ., offset_y=0 ., offset_z=0 .;
76+ double offset_x = 30 ., offset_y=0 ., offset_z=0 .;
77+ // double offset_x = 0., offset_y=0., offset_z=0.;
7878
7979 map<int , vector<Matrix4d> > jmb;
8080 bool published_axis = false ;
@@ -108,7 +108,7 @@ void periodic_publish_odoms( const NodeDataManager * manager, const VizPoseGraph
108108
109109 // Publish all the odometries (unregistered) and also plot the loop edges.
110110 // make the follow to 1 if you need this.
111- #if 1
111+ #if 0
112112 for( auto it=jmb.begin() ; it!=jmb.end() ; it++ ) {
113113 string ns = "odom-world#"+to_string( it->first );
114114
@@ -135,7 +135,7 @@ void periodic_publish_odoms( const NodeDataManager * manager, const VizPoseGraph
135135
136136
137137
138- #if 0 // only publish the latest odometry. Set this to zero if you dont need this.
138+ #if 1 // only publish the latest odometry. Set this to zero if you dont need this.
139139 int to_publish_key = -1 ; // lets the largest key value
140140 for ( auto it=jmb.begin () ; it!=jmb.end () ; it++ ) {
141141
@@ -435,6 +435,7 @@ void opt_traj_publisher_colored_by_world( const NodeDataManager * manager, const
435435 else if ( world_id < 0 ) {
436436 // last_idx = ____solvedUntil;
437437 last_idx = manager->nodeidx_of_world_i_ended ( -world_id - 1 );
438+ // cout << "last_idx=" << last_idx << endl;
438439 } else {
439440 cout << " opt_traj_publisher_colored_by_world impossivle" ;
440441 exit (2 );
@@ -443,9 +444,15 @@ void opt_traj_publisher_colored_by_world( const NodeDataManager * manager, const
443444 }
444445
445446 if ( last_idx >= 0 ) {
446- Matrix4d w_T_last = slam->getNodePose (last_idx );
447- Matrix4d last_M_i = manager->getNodePose ( last_idx ).inverse () * manager->getNodePose ( i );
448- w_TM_i = w_T_last * last_M_i;}
447+ Matrix4d w_T_last;
448+ if ( slam->nodePoseExists (last_idx) )
449+ w_T_last = slam->getNodePose (last_idx );
450+ else
451+ w_T_last = manager->getNodePose (last_idx );
452+
453+ Matrix4d last_M_i = manager->getNodePose ( last_idx ).inverse () * manager->getNodePose ( i );
454+ w_TM_i = w_T_last * last_M_i;
455+ }
449456
450457
451458
0 commit comments