Skip to content

Commit e645359

Browse files
committed
fixd
1 parent 3a8b0bb commit e645359

2 files changed

Lines changed: 16 additions & 9 deletions

File tree

src/PoseGraphSLAM.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1899,14 +1899,13 @@ void PoseGraphSLAM::reinit_ceres_problem_onnewloopedge_optimize6DOF()
18991899
regularization_terms_list.push_back( resi_id );
19001900
}
19011901

1902-
1903-
19041902
}
19051903
else {
19061904
__reint_node_regularization_info( cout << "skip\n"; )
19071905
}
19081906

19091907

1908+
#if 0
19101909
// check if this world is in change set aka `changes_to_setid_on_set_union`. Add regularization if not in changeset
19111910
if( changes_to_setid_on_set_union.count( ww ) > 0 ) {
19121911
__reint_node_regularization_info( cout << "World#" << ww << " is in `changes_to_setid_on_set_union`. This indicates it was changed.So no regularization needed\n"; )
@@ -1922,6 +1921,7 @@ void PoseGraphSLAM::reinit_ceres_problem_onnewloopedge_optimize6DOF()
19221921
regularization_terms_list.push_back( resi_id );
19231922
}
19241923
}
1924+
#endif
19251925

19261926
}
19271927
___trigger_header( cout << "\n[ETA Total elements in `regularization_terms_list` = " << regularization_terms_list.size() << " done in milli-secs=" << eta.toc_milli() << " node_len="<< node_len << endl; )

src/keyframe_pose_graph_slam_node.cpp

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)