forked from Archive/PX4-Autopilot
Remove duplicite data from RPM message and enable logging of RPM message
This commit is contained in:
parent
536cd6cb1a
commit
b02e209507
|
@ -1,7 +1,4 @@
|
|||
uint64 timestamp # time since system start (microseconds)
|
||||
|
||||
float32 indicated_frequency_hz # indicated rotor Frequency in Hz
|
||||
float32 estimated_accurancy_hz # estimated accurancy in Hz
|
||||
float32 indicated_frequency_rpm # indicated rotor Frequency in Revolution per minute
|
||||
float32 estimated_accurancy_rpm # estimated accurancy in Revolution per minute
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
|
||||
/**
|
||||
* PCF8583 rotorfreq (i2c) pool interval
|
||||
* How often the sensor is readout.
|
||||
*
|
||||
* @reboot_required true
|
||||
* @group Sensors
|
||||
|
@ -45,30 +46,31 @@ PARAM_DEFINE_INT32(PCF8583_POOL, 1000000);
|
|||
*
|
||||
* @reboot_required true
|
||||
* @group Sensors
|
||||
* @value 80 0x50
|
||||
* @value 81 0x51
|
||||
* @value 80 Address 0x50 (80)
|
||||
* @value 81 Address 0x51 (81)
|
||||
*/
|
||||
PARAM_DEFINE_INT32(PCF8583_ADDR, 80);
|
||||
|
||||
/**
|
||||
* PCF8583 rotorfreq (i2c) counter reset value
|
||||
* PCF8583 rotorfreq (i2c) pulse reset value
|
||||
*
|
||||
* Internal device counter is reset to 0 when overun this value,
|
||||
* counter is able to store upto 6 digits
|
||||
* reset of counter takes some time - measurement with reset has worse accurancy
|
||||
* reset of counter takes some time - measurement with reset has worse accurancy.
|
||||
* 0 means reset counter after every measurement.
|
||||
*
|
||||
* @reboot_required true
|
||||
* @group Sensors
|
||||
* @value 0 - reset avter every measurement
|
||||
*/
|
||||
PARAM_DEFINE_INT32(PCF8583_RESET, 500000);
|
||||
|
||||
/**
|
||||
* PCF8583 rotorfreq (i2c) magnet count
|
||||
* PCF8583 rotorfreq (i2c) pulse count
|
||||
*
|
||||
* Nmumber of signals per rotation of rotor
|
||||
* Nmumber of signals per rotation of actuator
|
||||
*
|
||||
* @reboot_required true
|
||||
* @group Sensors
|
||||
* @min 1
|
||||
*/
|
||||
PARAM_DEFINE_INT32(PCF8583_MAGNET, 2);
|
||||
|
|
Loading…
Reference in New Issue