Skip to content

Commit 816b1b9

Browse files
denisvooon
authored andcommitted
Fix: Corrected compass calibration result report to match mavlink documentation (MAG_CAL_REPORT (192))
1 parent 44fa2f9 commit 816b1b9

File tree

2 files changed

+42
-5
lines changed

2 files changed

+42
-5
lines changed

mavros_extras/src/plugins/mag_calibration_status.cpp

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,14 +104,32 @@ class MagCalStatusPlugin : public plugin::Plugin
104104
}
105105
if (calibration_show[mr.compass_id]) {
106106
auto mcr = mavros_msgs::msg::MagnetometerReporter();
107-
108107
mcr.header.stamp = node->now();
109108
mcr.header.frame_id = std::to_string(mr.compass_id);
109+
110110
mcr.report = mr.cal_status;
111111
mcr.confidence = mr.orientation_confidence;
112-
113-
mcr_pub->publish(mcr);
114-
calibration_show[mr.compass_id] = false;
112+
mcr.compass_id = mr.compass_id;
113+
mcr.cal_mask = mr.cal_mask;
114+
mcr.cal_status = mr.cal_status;
115+
mcr.autosaved = mr.autosaved;
116+
mcr.fitness = mr.fitness;
117+
mcr.ofs_x = mr.ofs_x;
118+
mcr.ofs_y = mr.ofs_y;
119+
mcr.ofs_z = mr.ofs_z;
120+
mcr.diag_x = mr.diag_x;
121+
mcr.diag_y = mr.diag_y;
122+
mcr.diag_z = mr.diag_z;
123+
mcr.offdiag_x = mr.offdiag_x;
124+
mcr.offdiag_y = mr.offdiag_y;
125+
mcr.offdiag_z = mr.offdiag_z;
126+
mcr.orientation_confidence = mr.orientation_confidence;
127+
mcr.old_orientation = mr.old_orientation;
128+
mcr.new_orientation = mr.new_orientation;
129+
mcr.scale_factor = mr.scale_factor;
130+
131+
mcr_pub->publish(mcr);
132+
calibration_show[mr.compass_id] = false;
115133
}
116134
}
117135
};
Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,23 @@
11
std_msgs/Header header
22

33
uint8 report
4-
float32 confidence
4+
float32 confidence
5+
uint8 compass_id
6+
uint8 cal_mask
7+
uint8 cal_status
8+
uint8 autosaved
9+
float32 fitness
10+
float32 ofs_x
11+
float32 ofs_y
12+
float32 ofs_z
13+
float32 diag_x
14+
float32 diag_y
15+
float32 diag_z
16+
float32 offdiag_x
17+
float32 offdiag_y
18+
float32 offdiag_z
19+
float32 orientation_confidence
20+
uint8 old_orientation
21+
uint8 new_orientation
22+
float32 scale_factor
23+

0 commit comments

Comments
 (0)