Skip to content

Commit

Permalink
Reintroduce nframe timestamp diff tolerance parameter.
Browse files Browse the repository at this point in the history
  • Loading branch information
Benjamin Hahn committed Dec 5, 2019
1 parent c1e3f77 commit 415c913
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
3 changes: 3 additions & 0 deletions applications/maplab_node/include/maplab-node/synchronizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,9 @@ class Synchronizer {
int64_t previous_nframe_timestamp_ns_;
// Threshold used to throttle the consecutively published NFrames.
const int64_t min_nframe_timestamp_diff_ns_;
// allow for slight variations in frame rate; relevant when camera frame rate
// and throttling rate nearly identical.
const float nframe_timestamp_diff_tolerance_;

// Number of received odometry measurements.
int64_t odometry_measurement_counter_;
Expand Down
12 changes: 9 additions & 3 deletions applications/maplab_node/src/synchronizer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ DEFINE_double(
vio_nframe_sync_max_output_frequency_hz, 10.0,
"Maximum output frequency of the synchronized NFrame structures "
"from the synchronizer.");
DEFINE_double(
vio_nframe_timestamp_diff_tolerance_, 0.95,
"Tolerance on the minimum timestamp differance required by throttler above "
"which an nframe is released. This is helpful when the desired throttling "
"frequency is close to the actual frame rate and the latter has slight "
"variations.");
DEFINE_int32(
vio_nframe_sync_max_queue_size, 50,
"Maximum queue size of the synchronization pipeline trying to match images "
Expand All @@ -23,7 +29,6 @@ DEFINE_int64(
odometry_buffer_max_forward_propagation_ns, aslam::time::milliseconds(500),
"Determines the maximum duration the odometry buffer can "
"forward-propagate using the IMU.");

DEFINE_bool(
enable_synchronizer_statistics, true,
"If enable, the synchronizer will keep data about the latency and other "
Expand Down Expand Up @@ -58,7 +63,8 @@ Synchronizer::Synchronizer(const vi_map::SensorManager& sensor_manager)
time_last_loop_closure_message_received_or_checked_ns_(
aslam::time::getInvalidTime()),
time_last_pointcloud_map_message_received_or_checked_ns_(
aslam::time::getInvalidTime()) {
aslam::time::getInvalidTime()),
nframe_timestamp_diff_tolerance_(FLAGS_vio_nframe_timestamp_diff_tolerance_) {
CHECK_GT(FLAGS_vio_nframe_sync_max_output_frequency_hz, 0.);

if (FLAGS_enable_synchronizer_statistics) {
Expand Down Expand Up @@ -350,7 +356,7 @@ void Synchronizer::releaseNFrameData(
// the following nodes are running (e.g. tracker).
if (aslam::time::isValidTime(previous_nframe_timestamp_ns_)) {
if (current_frame_timestamp_ns - previous_nframe_timestamp_ns_ <
min_nframe_timestamp_diff_ns_) {
min_nframe_timestamp_diff_ns_ * nframe_timestamp_diff_tolerance_) {
++frame_skip_counter_;
continue;
}
Expand Down

0 comments on commit 415c913

Please sign in to comment.