mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-21 02:53:34 +08:00
cleanup sensor_combined: remove adc & differential_pressure fields
These are not really used. differential_pressure is just copied from the topic with the same name. for sdlog2 we assume no one needs the diff pressure fields and set it to 0. We plan to switch to the new logger soon anyway.
This commit is contained in:
@@ -63,6 +63,7 @@
|
||||
#include <uORB/topics/camera_trigger.h>
|
||||
#include <uORB/topics/cpuload.h>
|
||||
#include <uORB/topics/debug_key_value.h>
|
||||
#include <uORB/topics/differential_pressure.h>
|
||||
#include <uORB/topics/distance_sensor.h>
|
||||
#include <uORB/topics/estimator_status.h>
|
||||
#include <uORB/topics/fw_pos_ctrl_status.h>
|
||||
@@ -691,6 +692,9 @@ private:
|
||||
MavlinkOrbSubscription *_sensor_sub;
|
||||
uint64_t _sensor_time;
|
||||
|
||||
MavlinkOrbSubscription *_differential_pressure_sub;
|
||||
uint64_t _differential_pressure_time;
|
||||
|
||||
uint64_t _accel_timestamp;
|
||||
uint64_t _gyro_timestamp;
|
||||
uint64_t _mag_timestamp;
|
||||
@@ -704,6 +708,8 @@ protected:
|
||||
explicit MavlinkStreamHighresIMU(Mavlink *mavlink) : MavlinkStream(mavlink),
|
||||
_sensor_sub(_mavlink->add_orb_subscription(ORB_ID(sensor_combined))),
|
||||
_sensor_time(0),
|
||||
_differential_pressure_sub(_mavlink->add_orb_subscription(ORB_ID(differential_pressure))),
|
||||
_differential_pressure_time(0),
|
||||
_accel_timestamp(0),
|
||||
_gyro_timestamp(0),
|
||||
_mag_timestamp(0),
|
||||
@@ -713,6 +719,7 @@ protected:
|
||||
void send(const hrt_abstime t)
|
||||
{
|
||||
struct sensor_combined_s sensor;
|
||||
struct differential_pressure_s differential_pressure;
|
||||
|
||||
if (_sensor_sub->update(&_sensor_time, &sensor)) {
|
||||
uint16_t fields_updated = 0;
|
||||
@@ -740,6 +747,7 @@ protected:
|
||||
fields_updated |= (1 << 9) | (1 << 11) | (1 << 12);
|
||||
_baro_timestamp = sensor.baro_timestamp[0];
|
||||
}
|
||||
_differential_pressure_sub->update(&_differential_pressure_time, &differential_pressure);
|
||||
|
||||
mavlink_highres_imu_t msg;
|
||||
|
||||
@@ -754,7 +762,7 @@ protected:
|
||||
msg.ymag = sensor.magnetometer_ga[1];
|
||||
msg.zmag = sensor.magnetometer_ga[2];
|
||||
msg.abs_pressure = sensor.baro_pres_mbar[0];
|
||||
msg.diff_pressure = sensor.differential_pressure_pa[0];
|
||||
msg.diff_pressure = differential_pressure.differential_pressure_raw_pa;
|
||||
msg.pressure_alt = sensor.baro_alt_meter[0];
|
||||
msg.temperature = sensor.baro_temp_celcius[0];
|
||||
msg.fields_updated = fields_updated;
|
||||
|
||||
@@ -1705,10 +1705,6 @@ MavlinkReceiver::handle_message_hil_sensor(mavlink_message_t *msg)
|
||||
hil_sensors.accelerometer_timestamp[0] = timestamp;
|
||||
hil_sensors.accelerometer_priority[0] = ORB_PRIO_HIGH;
|
||||
|
||||
hil_sensors.adc_voltage_v[0] = 0.0f;
|
||||
hil_sensors.adc_voltage_v[1] = 0.0f;
|
||||
hil_sensors.adc_voltage_v[2] = 0.0f;
|
||||
|
||||
hil_sensors.magnetometer_raw[0] = imu.xmag * 1000.0f;
|
||||
hil_sensors.magnetometer_raw[1] = imu.ymag * 1000.0f;
|
||||
hil_sensors.magnetometer_raw[2] = imu.zmag * 1000.0f;
|
||||
@@ -1726,10 +1722,6 @@ MavlinkReceiver::handle_message_hil_sensor(mavlink_message_t *msg)
|
||||
hil_sensors.baro_temp_celcius[0] = imu.temperature;
|
||||
hil_sensors.baro_timestamp[0] = timestamp;
|
||||
|
||||
hil_sensors.differential_pressure_pa[0] = imu.diff_pressure * 1e2f; //from hPa to Pa
|
||||
hil_sensors.differential_pressure_filtered_pa[0] = hil_sensors.differential_pressure_pa[0];
|
||||
hil_sensors.differential_pressure_timestamp[0] = timestamp;
|
||||
|
||||
/* publish combined sensor topic */
|
||||
if (_sensors_pub == nullptr) {
|
||||
_sensors_pub = orb_advertise(ORB_ID(sensor_combined), &hil_sensors);
|
||||
|
||||
Reference in New Issue
Block a user