From a4217b0d48a32babfc3b1d81edc352e02ae329eb Mon Sep 17 00:00:00 2001 From: Matej Petrlik Date: Thu, 24 Oct 2024 23:45:40 +0200 Subject: [PATCH] mag field fusion seems working --- .../estimators/correction.h | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/include/mrs_uav_state_estimators/estimators/correction.h b/include/mrs_uav_state_estimators/estimators/correction.h index bbc9283..2a1a22f 100644 --- a/include/mrs_uav_state_estimators/estimators/correction.h +++ b/include/mrs_uav_state_estimators/estimators/correction.h @@ -199,6 +199,7 @@ class Correction { mrs_lib::PublisherHandler ph_correction_raw_; mrs_lib::PublisherHandler ph_correction_proc_; mrs_lib::PublisherHandler ph_delay_; + mrs_lib::PublisherHandler ph_mag_field_untilted_; const std::string est_name_; const std::string name_; @@ -387,6 +388,7 @@ Correction::Correction(ros::NodeHandle& nh, const std::string& e } case MessageType_t::MAG_FIELD: { sh_mag_field_ = mrs_lib::SubscribeHandler(shopts, msg_topic_, &Correction::callbackMagField, this); + ph_mag_field_untilted_ = mrs_lib::PublisherHandler(nh, est_name_ + "/correction/" + getName() + "/fcu_untilted", 10); break; } @@ -1887,7 +1889,14 @@ std::optional::measurement_t> Correctionheader.stamp; + mag_vec_msg.header.frame_id = transform_to_frame_; + mag_vec_msg.point.x = mag_vec.x; + mag_vec_msg.point.y = mag_vec.y; + mag_vec_msg.point.z = mag_vec.z; + ph_mag_field_untilted_.publish(mag_vec_msg); const double mag_hdg = atan2(mag_vec.y, mag_vec.x); /* const Eigen::Vector3d mag_vec(mag_vec_pt.x, mag_vec_pt.y, mag_vec_pt.z); */ /* const Eigen::Vector3d proj_mag_field = rot * mag_vec; */ @@ -1905,7 +1914,7 @@ std::optional::measurement_t> Correction