mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-22 07:33:34 +08:00
vehicle_global_position: remove velocity fields (duplicates of local vx, vy, vz)
* attitude_estimator_q: get velocity from local position (if available)
This commit is contained in:
@@ -51,6 +51,7 @@
|
||||
#include <uORB/topics/position_controller_status.h>
|
||||
#include <uORB/topics/tecs_status.h>
|
||||
#include <uORB/topics/vehicle_attitude_setpoint.h>
|
||||
#include <uORB/topics/vehicle_local_position.h>
|
||||
#include <uORB/topics/vehicle_global_position.h>
|
||||
#include <uORB/topics/vehicle_gps_position.h>
|
||||
#include <uORB/topics/vehicle_status.h>
|
||||
@@ -76,6 +77,8 @@ MavlinkStreamHighLatency2::MavlinkStreamHighLatency2(Mavlink *mavlink) : Mavlink
|
||||
_pos_ctrl_status_time(0),
|
||||
_geofence_sub(_mavlink->add_orb_subscription(ORB_ID(geofence_result))),
|
||||
_geofence_time(0),
|
||||
_local_pos_sub(_mavlink->add_orb_subscription(ORB_ID(vehicle_local_position))),
|
||||
_local_pos_time(0),
|
||||
_global_pos_sub(_mavlink->add_orb_subscription(ORB_ID(vehicle_global_position))),
|
||||
_global_pos_time(0),
|
||||
_gps_sub(_mavlink->add_orb_subscription(ORB_ID(vehicle_gps_position))),
|
||||
@@ -503,7 +506,7 @@ void MavlinkStreamHighLatency2::update_data()
|
||||
|
||||
update_battery_status();
|
||||
|
||||
update_global_position();
|
||||
update_local_position();
|
||||
|
||||
update_gps();
|
||||
|
||||
@@ -543,14 +546,13 @@ void MavlinkStreamHighLatency2::update_battery_status()
|
||||
}
|
||||
}
|
||||
|
||||
void MavlinkStreamHighLatency2::update_global_position()
|
||||
void MavlinkStreamHighLatency2::update_local_position()
|
||||
{
|
||||
vehicle_global_position_s global_pos;
|
||||
vehicle_local_position_s local_pos;
|
||||
|
||||
if (_global_pos_sub->update(&global_pos)) {
|
||||
_climb_rate.add_value(fabsf(global_pos.vel_d), _update_rate_filtered);
|
||||
_groundspeed.add_value(sqrtf(global_pos.vel_n * global_pos.vel_n + global_pos.vel_e * global_pos.vel_e),
|
||||
_update_rate_filtered);
|
||||
if (_local_pos_sub->update(&local_pos)) {
|
||||
_climb_rate.add_value(fabsf(local_pos.vz), _update_rate_filtered);
|
||||
_groundspeed.add_value(sqrtf(local_pos.vx * local_pos.vx + local_pos.vy * local_pos.vy), _update_rate_filtered);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -113,6 +113,9 @@ private:
|
||||
MavlinkOrbSubscription *_geofence_sub;
|
||||
uint64_t _geofence_time;
|
||||
|
||||
MavlinkOrbSubscription *_local_pos_sub;
|
||||
uint64_t _local_pos_time;
|
||||
|
||||
MavlinkOrbSubscription *_global_pos_sub;
|
||||
uint64_t _global_pos_time;
|
||||
|
||||
@@ -193,7 +196,7 @@ protected:
|
||||
|
||||
void update_battery_status();
|
||||
|
||||
void update_global_position();
|
||||
void update_local_position();
|
||||
|
||||
void update_gps();
|
||||
|
||||
|
||||
@@ -2067,7 +2067,7 @@ public:
|
||||
private:
|
||||
MavlinkOrbSubscription *_local_pos_sub;
|
||||
uint64_t _local_pos_time = 0;
|
||||
vehicle_local_position_s _local_position = {};
|
||||
vehicle_local_position_s _local_position = {};
|
||||
|
||||
MavlinkOrbSubscription *_global_pos_sub;
|
||||
uint64_t _global_pos_time = 0;
|
||||
|
||||
@@ -2492,9 +2492,6 @@ MavlinkReceiver::handle_message_hil_state_quaternion(mavlink_message_t *msg)
|
||||
hil_global_pos.lat = hil_state.lat / ((double)1e7);
|
||||
hil_global_pos.lon = hil_state.lon / ((double)1e7);
|
||||
hil_global_pos.alt = hil_state.alt / 1000.0f;
|
||||
hil_global_pos.vel_n = hil_state.vx / 100.0f;
|
||||
hil_global_pos.vel_e = hil_state.vy / 100.0f;
|
||||
hil_global_pos.vel_d = hil_state.vz / 100.0f;
|
||||
hil_global_pos.eph = 2.0f;
|
||||
hil_global_pos.epv = 4.0f;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user