Skip to content

Commit

Permalink
bugfix (cra-ros-pkg#809): check if covariance values are specified or…
Browse files Browse the repository at this point in the history
… not

Signed-off-by: Daisuke Sato <daisukes@cmu.edu>
  • Loading branch information
daisukes committed May 3, 2023
1 parent 284c2ec commit ed9d0c4
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/ros_filter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1857,16 +1857,20 @@ void RosFilter<T>::loadParams()
RCLCPP_FATAL_STREAM(get_logger(), error);
throw std::invalid_argument(error);
}
return true;
}
return false;
};

load_covariance("process_noise_covariance", process_noise_covariance_);
RF_DEBUG("Process noise covariance is:\n" << process_noise_covariance_ << "\n");
filter_.setProcessNoiseCovariance(process_noise_covariance_);
if (load_covariance("process_noise_covariance", process_noise_covariance_)) {
RF_DEBUG("Process noise covariance is:\n" << process_noise_covariance_ << "\n");
filter_.setProcessNoiseCovariance(process_noise_covariance_);
}

load_covariance("initial_estimate_covariance", initial_estimate_error_covariance_);
RF_DEBUG("Initial estimate covariance is:\n" << initial_estimate_error_covariance_ << "\n");
filter_.setEstimateErrorCovariance(initial_estimate_error_covariance_);
if (load_covariance("initial_estimate_covariance", initial_estimate_error_covariance_)) {
RF_DEBUG("Initial estimate covariance is:\n" << initial_estimate_error_covariance_ << "\n");
filter_.setEstimateErrorCovariance(initial_estimate_error_covariance_);
}
}

template<typename T>
Expand Down

0 comments on commit ed9d0c4

Please sign in to comment.