diff --git a/msg/Rpm.msg b/msg/Rpm.msg index 7a6b179b84..fcec7edaf8 100644 --- a/msg/Rpm.msg +++ b/msg/Rpm.msg @@ -1,7 +1,4 @@ -uint64 timestamp # time since system start (microseconds) - -float32 indicated_frequency_rpm # indicated rotor Frequency in Revolution per minute -float32 estimated_accurancy_rpm # estimated accuracy in Revolution per minute +uint64 timestamp # time since system start (microseconds) +float32 rpm_estimate # filtered revolutions per minute float32 rpm_raw # measured rpm -float32 rpm_estimate # filtered rpm diff --git a/src/drivers/rpm/pcf8583/PCF8583.cpp b/src/drivers/rpm/pcf8583/PCF8583.cpp index 085015247f..f72c200efb 100644 --- a/src/drivers/rpm/pcf8583/PCF8583.cpp +++ b/src/drivers/rpm/pcf8583/PCF8583.cpp @@ -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); diff --git a/src/drivers/rpm/rpm_simulator/rpm_simulator.cpp b/src/drivers/rpm/rpm_simulator/rpm_simulator.cpp index 5e1e8b016c..4926d1ca9f 100644 --- a/src/drivers/rpm/rpm_simulator/rpm_simulator.cpp +++ b/src/drivers/rpm/rpm_simulator/rpm_simulator.cpp @@ -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); diff --git a/src/modules/mavlink/streams/RAW_RPM.hpp b/src/modules/mavlink/streams/RAW_RPM.hpp index 9d2088123f..cfc4ceb54d 100644 --- a/src/modules/mavlink/streams/RAW_RPM.hpp +++ b/src/modules/mavlink/streams/RAW_RPM.hpp @@ -68,7 +68,7 @@ private: mavlink_raw_rpm_t msg{}; msg.index = i; - msg.frequency = rpm.indicated_frequency_rpm; + msg.frequency = rpm.rpm_estimate; mavlink_msg_raw_rpm_send_struct(_mavlink->get_channel(), &msg); updated = true; diff --git a/src/modules/simulation/simulator_mavlink/SimulatorMavlink.cpp b/src/modules/simulation/simulator_mavlink/SimulatorMavlink.cpp index c1bdfb6dc1..58e6ece481 100644 --- a/src/modules/simulation/simulator_mavlink/SimulatorMavlink.cpp +++ b/src/modules/simulation/simulator_mavlink/SimulatorMavlink.cpp @@ -388,14 +388,12 @@ void SimulatorMavlink::handle_message(const mavlink_message_t *msg) break; case MAVLINK_MSG_ID_RAW_RPM: - mavlink_raw_rpm_t rpm; - mavlink_msg_raw_rpm_decode(msg, &rpm); - rpm_s rpmmsg{}; - rpmmsg.timestamp = hrt_absolute_time(); - rpmmsg.indicated_frequency_rpm = rpm.frequency; - rpmmsg.estimated_accurancy_rpm = 0; - - _rpm_pub.publish(rpmmsg); + mavlink_raw_rpm_t rpm_mavlink; + mavlink_msg_raw_rpm_decode(msg, &rpm_mavlink); + rpm_s rpm_uorb{}; + rpm_uorb.timestamp = hrt_absolute_time(); + rpm_uorb.rpm_estimate = rpm_mavlink.frequency; + _rpm_pub.publish(rpm_uorb); break; } }