Skip to content

Commit

Permalink
SpeedTracker: sanitized the timeouting
Browse files Browse the repository at this point in the history
  • Loading branch information
klaxalk committed Jun 20, 2024
1 parent 6645a59 commit b7b70e9
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/speed_tracker/speed_tracker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@ class SpeedTracker : public mrs_uav_managers::Tracker {

// | ---------------- the tracker's inner state --------------- |

bool is_initialized_ = false;
bool is_active_ = false;
bool first_iteration_ = true;
std::atomic<bool> is_initialized_ = false;
std::atomic<bool> is_active_ = false;
std::atomic<bool> first_iteration_ = true;

double _external_command_timeout_;

Expand Down Expand Up @@ -566,6 +566,9 @@ void SpeedTracker::callbackCommand(const mrs_msgs::SpeedTrackerCommand::ConstPtr
if (!is_initialized_)
return;

if (!is_active_)
return;

mrs_lib::Routine profiler_routine = profiler_.createRoutine("callbackCommand");
mrs_lib::ScopeTimer timer = mrs_lib::ScopeTimer("SpeedTracker::callbackCommand", common_handlers_->scope_timer.logger, common_handlers_->scope_timer.enabled);

Expand Down

0 comments on commit b7b70e9

Please sign in to comment.