RPM: clean up message

This commit is contained in:
Matthias Grob
2024-12-10 19:14:48 +01:00
parent 6e90be1129
commit 71d0013d5e
5 changed files with 11 additions and 15 deletions
+2 -4
View File
@@ -1,7 +1,5 @@
uint64 timestamp # time since system start (microseconds) uint64 timestamp # time since system start (microseconds)
float32 indicated_frequency_rpm # indicated rotor Frequency in Revolution per minute float32 rpm_estimate # filtered revolutions per minute
float32 estimated_accurancy_rpm # estimated accuracy in Revolution per minute
float32 rpm_raw # measured rpm float32 rpm_raw # measured rpm
float32 rpm_estimate # filtered rpm float32 estimated_accurancy_rpm # estimated accuracy
+1 -1
View File
@@ -200,7 +200,7 @@ void PCF8583::RunImpl()
// publish data to uorb // publish data to uorb
rpm_s msg{}; rpm_s msg{};
msg.indicated_frequency_rpm = indicated_rpm; msg.rpm_estimate = indicated_rpm;
msg.estimated_accurancy_rpm = estimated_accurancy; msg.estimated_accurancy_rpm = estimated_accurancy;
msg.timestamp = hrt_absolute_time(); msg.timestamp = hrt_absolute_time();
_rpm_pub.publish(msg); _rpm_pub.publish(msg);
@@ -66,7 +66,7 @@ int rpm_simulator_main(int argc, char *argv[])
// prpepare RPM data message // prpepare RPM data message
rpm.timestamp = timestamp_us; rpm.timestamp = timestamp_us;
rpm.indicated_frequency_rpm = frequency; rpm.rpm_estimate = frequency;
rpm.estimated_accurancy_rpm = frequency / 100.0f; rpm.estimated_accurancy_rpm = frequency / 100.0f;
// Publish data and let the user know what was published // Publish data and let the user know what was published
+1 -1
View File
@@ -68,7 +68,7 @@ private:
mavlink_raw_rpm_t msg{}; mavlink_raw_rpm_t msg{};
msg.index = i; msg.index = i;
msg.frequency = rpm.indicated_frequency_rpm; msg.frequency = rpm.rpm_estimate;
mavlink_msg_raw_rpm_send_struct(_mavlink->get_channel(), &msg); mavlink_msg_raw_rpm_send_struct(_mavlink->get_channel(), &msg);
updated = true; updated = true;
@@ -388,14 +388,12 @@ void SimulatorMavlink::handle_message(const mavlink_message_t *msg)
break; break;
case MAVLINK_MSG_ID_RAW_RPM: case MAVLINK_MSG_ID_RAW_RPM:
mavlink_raw_rpm_t rpm; mavlink_raw_rpm_t rpm_mavlink;
mavlink_msg_raw_rpm_decode(msg, &rpm); mavlink_msg_raw_rpm_decode(msg, &rpm_mavlink);
rpm_s rpmmsg{}; rpm_s rpm_uorb{};
rpmmsg.timestamp = hrt_absolute_time(); rpm_uorb.timestamp = hrt_absolute_time();
rpmmsg.indicated_frequency_rpm = rpm.frequency; rpm_uorb.rpm_estimate = rpm_mavlink.frequency;
rpmmsg.estimated_accurancy_rpm = 0; _rpm_pub.publish(rpm_uorb);
_rpm_pub.publish(rpmmsg);
break; break;
} }
} }