mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-19 03:33:34 +08:00
merge vehicle_angular_acceleration into vehicle_angular_velocity (#20531)
- vehicle_angular_velocity and vehicle_angular_acceleration are produced together from the same input data, consumed together, and share the the same metadata (timestamps) - individually these topics each have 16 bytes of metadata (2 timestamps) for 12 bytes of data (x,y,z float32)
This commit is contained in:
@@ -122,18 +122,14 @@ MulticopterRateControl::Run()
|
||||
|
||||
if (_vehicle_angular_velocity_sub.update(&angular_velocity)) {
|
||||
|
||||
// grab corresponding vehicle_angular_acceleration immediately after vehicle_angular_velocity copy
|
||||
vehicle_angular_acceleration_s v_angular_acceleration{};
|
||||
_vehicle_angular_acceleration_sub.copy(&v_angular_acceleration);
|
||||
|
||||
const hrt_abstime now = angular_velocity.timestamp_sample;
|
||||
|
||||
// Guard against too small (< 0.125ms) and too large (> 20ms) dt's.
|
||||
const float dt = math::constrain(((now - _last_run) * 1e-6f), 0.000125f, 0.02f);
|
||||
_last_run = now;
|
||||
|
||||
const Vector3f angular_accel{v_angular_acceleration.xyz};
|
||||
const Vector3f rates{angular_velocity.xyz};
|
||||
const Vector3f angular_accel{angular_velocity.xyz_derivative};
|
||||
|
||||
/* check for updates in other topics */
|
||||
_vehicle_control_mode_sub.update(&_vehicle_control_mode);
|
||||
|
||||
@@ -54,7 +54,6 @@
|
||||
#include <uORB/topics/manual_control_setpoint.h>
|
||||
#include <uORB/topics/parameter_update.h>
|
||||
#include <uORB/topics/rate_ctrl_status.h>
|
||||
#include <uORB/topics/vehicle_angular_acceleration.h>
|
||||
#include <uORB/topics/vehicle_angular_velocity.h>
|
||||
#include <uORB/topics/vehicle_control_mode.h>
|
||||
#include <uORB/topics/vehicle_land_detected.h>
|
||||
@@ -101,7 +100,6 @@ private:
|
||||
uORB::Subscription _control_allocator_status_sub{ORB_ID(control_allocator_status)};
|
||||
uORB::Subscription _landing_gear_sub{ORB_ID(landing_gear)};
|
||||
uORB::Subscription _manual_control_setpoint_sub{ORB_ID(manual_control_setpoint)};
|
||||
uORB::Subscription _vehicle_angular_acceleration_sub{ORB_ID(vehicle_angular_acceleration)};
|
||||
uORB::Subscription _vehicle_control_mode_sub{ORB_ID(vehicle_control_mode)};
|
||||
uORB::Subscription _vehicle_land_detected_sub{ORB_ID(vehicle_land_detected)};
|
||||
uORB::Subscription _vehicle_rates_setpoint_sub{ORB_ID(vehicle_rates_setpoint)};
|
||||
|
||||
Reference in New Issue
Block a user