RPM: clean up message

This commit is contained in:
Matthias Grob
2024-12-19 07:30:25 +01:00
parent a60591378c
commit c463cc42d0
5 changed files with 11 additions and 19 deletions
+1 -3
View File
@@ -196,12 +196,10 @@ void PCF8583::RunImpl()
// Calculate RPM and accuracy estimation
float indicated_rpm = (((float)diffCount / _param_pcf8583_magnet.get()) / ((float)diffTime / 1e6f)) * 60.f;
float estimated_accurancy = 1 / (float)_param_pcf8583_magnet.get() / ((float)diffTime / 1e6f) * 60.f;
// publish data to uorb
rpm_s msg{};
msg.indicated_frequency_rpm = indicated_rpm;
msg.estimated_accurancy_rpm = estimated_accurancy;
msg.rpm_estimate = indicated_rpm;
msg.timestamp = hrt_absolute_time();
_rpm_pub.publish(msg);
@@ -66,8 +66,7 @@ int rpm_simulator_main(int argc, char *argv[])
// prpepare RPM data message
rpm.timestamp = timestamp_us;
rpm.indicated_frequency_rpm = frequency;
rpm.estimated_accurancy_rpm = frequency / 100.0f;
rpm.rpm_estimate = frequency;
// Publish data and let the user know what was published
rpm_pub.publish(rpm);