Skip to content

Commit

Permalink
Reduce log level of scan drop count if small (#167)
Browse files Browse the repository at this point in the history
  • Loading branch information
at-wat authored Sep 10, 2024
1 parent 02fb017 commit e84034c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions include/urg_stamped/urg_stamped.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ class UrgStampedNode
int scan_drop_count_;
int scan_drop_continuous_;
int fallback_on_continuous_scan_drop_;
int log_scan_drop_more_than_;

ros::Duration tm_command_interval_;
std::string last_measurement_state_;
Expand Down
9 changes: 8 additions & 1 deletion src/urg_stamped.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,11 @@ void UrgStampedNode::estimateSensorClock(const ros::TimerEvent& event)
{
if (scan_drop_count_ > 0)
{
scip2::logger::info()
auto& logger =
scan_drop_count_ > log_scan_drop_more_than_ ?
scip2::logger::info() :
scip2::logger::debug();
logger
<< "Dropped "
<< scan_drop_count_
<< " scans with large time estimation error" << std::endl;
Expand Down Expand Up @@ -688,6 +692,9 @@ UrgStampedNode::UrgStampedNode()
pnh_.param("error_limit", error_count_max_, 4);
pnh_.param("fallback_on_continuous_scan_drop", fallback_on_continuous_scan_drop_, 5);

// 30s * 40Hz = 1200scans total, output info level log if dropped 90/1200scans or more
pnh_.param("log_scan_drop_more_than", log_scan_drop_more_than_, static_cast<int>(clock_estim_interval * 3));

double tm_interval, tm_timeout;
pnh_.param("tm_interval", tm_interval, 0.06);
tm_command_interval_ = ros::Duration(tm_interval);
Expand Down

0 comments on commit e84034c

Please sign in to comment.