You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
const ros::Time NodeDataManager::getNodeTimestamp( int i ) const
360
362
{
361
363
std::lock_guard<std::mutex> lk(node_mutex);
362
-
assert( i>=0 && i< node_timestamps.size() );
364
+
// cout << string( "you requested timestamp at i="+to_string(i)+", but node_timestamps.size="+to_string( node_timestamps.size()) ).c_str() << endl;
365
+
// assert( i>=0 && i< node_timestamps.size() && string( "you requested timestamp at i="+to_string(i)+", but node_timestamps.size="+to_string( node_timestamps.size()) ).c_str() );
366
+
__MY_ASSERT__( (i>=0 && i< node_timestamps.size()), "you requested timestamp at i="+to_string(i)+", but node_timestamps.size="+to_string( node_timestamps.size()) );
363
367
return node_timestamps[i];
364
368
}
365
369
@@ -753,6 +757,7 @@ ros::Time NodeDataManager::stamp_of_kidnap_i_started( int i ) const
753
757
return kidnap_starts[i];
754
758
}
755
759
760
+
assert( false && "[NodeDataManager::stamp_of_kidnap_i_started]no such kidnap" );
756
761
__KIDNAP_START_ENDS___debug( cout << "[NodeDataManager::stamp_of_kidnap_i_started]no such kidnap" << i << " kidnap_starts.size()=" << kidnap_starts.size() << endl; )
757
762
returnros::Time();
758
763
}
@@ -764,6 +769,7 @@ ros::Time NodeDataManager::stamp_of_kidnap_i_ended( int i ) const
764
769
return kidnap_ends[i];
765
770
}
766
771
772
+
assert( false && "[NodeDataManager::stamp_of_kidnap_i_ended]no such kidnap" );
767
773
__KIDNAP_START_ENDS___debug( cout << "[NodeDataManager::stamp_of_kidnap_i_ended]no such kidnap" << i << " kidnap_ends.size()=" << kidnap_ends.size() << endl; )
768
774
returnros::Time();
769
775
}
@@ -850,15 +856,16 @@ int NodeDataManager::which_world_is_this( int i ) //given the node idx, gets the
850
856
}
851
857
*/
852
858
853
-
854
859
// #define __WORLD_START_ENDS___debug( msg ) msg;
855
860
#define__WORLD_START_ENDS___debug( msg ) ;
861
+
862
+
#define__WORLD_START____errors( msg ) msg;
856
863
intNodeDataManager::nodeidx_of_world_i_started( int i ) const
857
864
{
858
865
859
866
if( i<0 )
860
867
{
861
-
__WORLD_START_ENDS___debug( cout << "[NodeDataManager::nodeidx_of_world_i_started] i cant be negative. no such world " << i << " exists\n"; )
868
+
__WORLD_START____errors( cout << TermColor::RED() << "[NodeDataManager::nodeidx_of_world_i_started] ERROR i cant be negative. no such world " << i << " exists" << TermColor::RESET() << endl; )
862
869
return -3;
863
870
}
864
871
if( i==0 ) {
@@ -876,7 +883,7 @@ int NodeDataManager::nodeidx_of_world_i_started( int i ) const
876
883
}
877
884
878
885
if( i>=1 && (i-1) <n ) {
879
-
__WORLD_START_ENDS___debug( cout << "[NodeDataManager::nodeidx_of_world_i_started] return nodeidx of kidnap_ends["<<i-1 <<"] as the start of world" << i << "\n"; )
886
+
__WORLD_START_ENDS___debug( cout << "[NodeDataManager::nodeidx_of_world_i_started] return nodeidx of kidnap_ends["<<i-1 <<"] as the start of world" << i << "\n"; )
880
887
std::lock_guard<std::mutex> lk(node_mutex);
881
888
882
889
int r=0;
@@ -890,10 +897,14 @@ int NodeDataManager::nodeidx_of_world_i_started( int i ) const
890
897
}
891
898
892
899
893
-
__WORLD_START_ENDS___debug( cout << "[NodeDataManager::nodeidx_of_world_i_started] no such world " << i << " exists\n"; )
900
+
__WORLD_START____errors( cout << TermColor::RED() << "[NodeDataManager::nodeidx_of_world_i_started] ERROR no such world " << i << " exists" << TermColor::RESET() << endl; )
894
901
return -4;
895
902
}
896
903
904
+
905
+
906
+
// #define __WORLD__ENDS___error( msg ) msg;
907
+
#define__WORLD__ENDS___error( msg ) ;
897
908
intNodeDataManager::nodeidx_of_world_i_ended( int i ) const
898
909
{
899
910
// returns a large number if the world i never ended
@@ -904,12 +915,12 @@ int NodeDataManager::nodeidx_of_world_i_ended( int i ) const
904
915
}
905
916
906
917
if( i<0 ) {
907
-
__WORLD_START_ENDS___debug( cout << "[NodeDataManager::nodeidx_of_world_i_ended] i cannot be negative. no such world\n");
918
+
__WORLD__ENDS___error( cout << TermColor::RED() << "[NodeDataManager::nodeidx_of_world_i_ended] ERROR i cannot be negative. no such world" << TermColor::RESET() << endl; );
908
919
return -1;
909
920
}
910
921
911
922
if( i>n_kidnap_ends ) {
912
-
__WORLD_START_ENDS___debug( cout << "[NodeDataManager::nodeidx_of_world_i_ended] no such world" << i << "\n"; )
923
+
__WORLD__ENDS___error( cout << TermColor::RED() << "[NodeDataManager::nodeidx_of_world_i_ended] ERROR no such world" << i << TermColor::RESET() << endl; )
913
924
return -1;
914
925
}
915
926
else {
@@ -937,5 +948,7 @@ int NodeDataManager::nodeidx_of_world_i_ended( int i ) const
assert( disjoint_set.exist( m ) && disjoint_set.exist( n ) && "Either of m of n doesn't seem to exist in the disjoint set. m="+to_string(m)+" n="+to_string(n) );
164
+
// assert( (disjoint_set.exists( m ) && disjoint_set.exists( n )) && "Either of m of n doesn't seem to exist in the disjoint set. m="+to_string(m)+" n="+to_string(n) );
165
+
assert( (disjoint_set.exists( m ) && disjoint_set.exists( n )) );
165
166
166
167
// ideally, disjoint_set.union_sets( m, n ), but doing the min max trick to retain the id of earliest sample.
int __i__start = manager->nodeidx_of_world_i_started(manager->n_worlds()-1); //0;
92
+
//
93
+
// try maximum 5 times. mili-seconds after unkidnapped the next world is not available
94
+
// which causes a seg fault. This little fix will sleep for say 5ms and try again
95
+
for( int _j=0 ; _j<25 ; _j++ ) {
96
+
if( __i__start>=0 )
97
+
break;
98
+
99
+
cout << "[periodic_publish_odoms] sleep() for 100milis. This is done just as a precaution because next world may not be immediately available after unkidnap. It takes usually upto 500milisec for vins to reinitialize. This warning is not very critial." << endl;
0 commit comments