time sync out of bound fix
This commit is contained in:
parent
5d06389f5e
commit
c5f0a3ddd4
|
@ -1477,11 +1477,12 @@ void roscontroller::time_sync_step()
|
|||
offsetCount++;
|
||||
if((it->second).age < BUZZRATE) (it->second).age++;
|
||||
else neighbours_time_map.erase(it);
|
||||
ROS_INFO("Size of nei time %i",neighbours_time_map.size());
|
||||
}
|
||||
avgRate = avgRate/(neighbours_time_map.size()+1);
|
||||
if(offsetCount>0 && !time_sync_jumped){
|
||||
int64_t correction = (int64_t)ceil(avgOffset / (offsetCount+1));
|
||||
if(std::abs(correction) < TIME_SYNC_JUMP_THR){
|
||||
if(correction < TIME_SYNC_JUMP_THR && correction > 0 ){
|
||||
set_logical_time_correction(correction);
|
||||
}
|
||||
}
|
||||
|
@ -1517,6 +1518,7 @@ void roscontroller::push_timesync_nei_msg(int nid, uint64_t nh, uint64_t nl, dou
|
|||
}
|
||||
buzz_utility::neighbor_time nt(nh, nl, ros::Time::now().toNSec(),
|
||||
logical_clock.toNSec(), nr, relativeRate);
|
||||
nt.age=0;
|
||||
neighbours_time_map.insert(make_pair(nid, nt));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue