Remove duplicite data from RPM message and enable logging of RPM message

This commit is contained in:
Roman Dvořák
2020-03-30 13:08:53 -04:00
committed by GitHub
parent 536cd6cb1a
commit b02e209507
3 changed files with 13 additions and 16 deletions
+4 -6
View File
@@ -127,15 +127,13 @@ void PCF8583::RunImpl()
_count = 0;
}
float indicated_frequency = (float)diffCount / _param_pcf8583_magnet.get() / ((float)diffTime / 1000000);
float estimated_accurancy = 1 / (float)_param_pcf8583_magnet.get() / ((float)diffTime / 1000000);
float indicated_rpm = (float)diffCount / _param_pcf8583_magnet.get() / ((float)diffTime / 1000000) * 60.f;
float estimated_accurancy = 1 / (float)_param_pcf8583_magnet.get() / ((float)diffTime / 1000000) * 60.f;
// publish
rpm_s msg{};
msg.indicated_frequency_hz = indicated_frequency;
msg.indicated_frequency_rpm = indicated_frequency * 60.f;
msg.estimated_accurancy_hz = estimated_accurancy;
msg.estimated_accurancy_rpm = estimated_accurancy * 60.f;
msg.indicated_frequency_rpm = indicated_rpm;
msg.estimated_accurancy_rpm = estimated_accurancy;
msg.timestamp = hrt_absolute_time();
_rpm_pub.publish(msg);
}