mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-24 06:43:33 +08:00
VTOL: remove virtual actuator_controls and instead use virtual torque/thrust topics
MC/FW rate controller and auto tuner: remove actuator_controls AirshipAttControl: remove actuator_controls MulticopterLandDetector: remove actuator_controls mavlink streams vfr_hud and high_latency2: remove actuator_controls RoverPositionController: remove actuator_controls UUVAttitudeController: remove actuator_controls battery: use length of thrust_setpoint for throttle compensation VehicleMagnetometer: use length of thrust_setpoint for throttle compensation Signed-off-by: Silvan Fuhrer
This commit is contained in:
@@ -39,7 +39,6 @@
|
||||
#include <lib/matrix/matrix/math.hpp>
|
||||
|
||||
#include <uORB/Subscription.hpp>
|
||||
#include <uORB/topics/actuator_controls.h>
|
||||
#include <uORB/topics/airspeed.h>
|
||||
#include <uORB/topics/battery_status.h>
|
||||
#include <uORB/topics/estimator_selector_status.h>
|
||||
@@ -51,6 +50,7 @@
|
||||
#include <uORB/topics/wind.h>
|
||||
#include <uORB/topics/vehicle_attitude_setpoint.h>
|
||||
#include <uORB/topics/vehicle_global_position.h>
|
||||
#include <uORB/topics/vehicle_thrust_setpoint.h>
|
||||
#include <uORB/topics/sensor_gps.h>
|
||||
#include <uORB/topics/vehicle_local_position.h>
|
||||
#include <uORB/topics/vehicle_status.h>
|
||||
@@ -561,16 +561,16 @@ private:
|
||||
|
||||
if (_status_sub.update(&status)) {
|
||||
if (status.arming_state == vehicle_status_s::ARMING_STATE_ARMED) {
|
||||
actuator_controls_s actuator{};
|
||||
vehicle_thrust_setpoint_s vehicle_thrust_setpoint{};
|
||||
|
||||
if (status.is_vtol && status.vehicle_type == vehicle_status_s::VEHICLE_TYPE_FIXED_WING) {
|
||||
if (_actuator_1_sub.copy(&actuator)) {
|
||||
_throttle.add_value(actuator.control[actuator_controls_s::INDEX_THROTTLE], _update_rate_filtered);
|
||||
if (_vehicle_thrust_setpoint_1_sub.copy(&vehicle_thrust_setpoint)) {
|
||||
_throttle.add_value(vehicle_thrust_setpoint.xyz[0], _update_rate_filtered);
|
||||
}
|
||||
|
||||
} else {
|
||||
if (_actuator_0_sub.copy(&actuator)) {
|
||||
_throttle.add_value(actuator.control[actuator_controls_s::INDEX_THROTTLE], _update_rate_filtered);
|
||||
if (_vehicle_thrust_setpoint_0_sub.copy(&vehicle_thrust_setpoint)) {
|
||||
_throttle.add_value(-vehicle_thrust_setpoint.xyz[2], _update_rate_filtered);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -621,8 +621,8 @@ private:
|
||||
msg.wp_num = UINT16_MAX;
|
||||
}
|
||||
|
||||
uORB::Subscription _actuator_0_sub{ORB_ID(actuator_controls_0)};
|
||||
uORB::Subscription _actuator_1_sub{ORB_ID(actuator_controls_1)};
|
||||
uORB::Subscription _vehicle_thrust_setpoint_0_sub{ORB_ID(vehicle_thrust_setpoint), 0};
|
||||
uORB::Subscription _vehicle_thrust_setpoint_1_sub{ORB_ID(vehicle_thrust_setpoint), 1};
|
||||
uORB::Subscription _airspeed_sub{ORB_ID(airspeed)};
|
||||
uORB::Subscription _attitude_sp_sub{ORB_ID(vehicle_attitude_setpoint)};
|
||||
uORB::Subscription _estimator_selector_status_sub{ORB_ID(estimator_selector_status)};
|
||||
|
||||
@@ -35,10 +35,10 @@
|
||||
#define VFR_HUD_HPP
|
||||
|
||||
#include <uORB/topics/actuator_armed.h>
|
||||
#include <uORB/topics/actuator_controls.h>
|
||||
#include <uORB/topics/airspeed_validated.h>
|
||||
#include <uORB/topics/vehicle_air_data.h>
|
||||
#include <uORB/topics/vehicle_local_position.h>
|
||||
#include <uORB/topics/vehicle_thrust_setpoint.h>
|
||||
|
||||
class MavlinkStreamVFRHUD : public MavlinkStream
|
||||
{
|
||||
@@ -65,8 +65,8 @@ private:
|
||||
|
||||
uORB::Subscription _lpos_sub{ORB_ID(vehicle_local_position)};
|
||||
uORB::Subscription _armed_sub{ORB_ID(actuator_armed)};
|
||||
uORB::Subscription _act0_sub{ORB_ID(actuator_controls_0)};
|
||||
uORB::Subscription _act1_sub{ORB_ID(actuator_controls_1)};
|
||||
uORB::Subscription _vehicle_thrust_setpoint_0_sub{ORB_ID(vehicle_thrust_setpoint), 0};
|
||||
uORB::Subscription _vehicle_thrust_setpoint_1_sub{ORB_ID(vehicle_thrust_setpoint), 1};
|
||||
uORB::Subscription _airspeed_validated_sub{ORB_ID(airspeed_validated)};
|
||||
uORB::Subscription _air_data_sub{ORB_ID(vehicle_air_data)};
|
||||
|
||||
@@ -89,19 +89,19 @@ private:
|
||||
msg.heading = math::degrees(matrix::wrap_2pi(lpos.heading));
|
||||
|
||||
if (armed.armed) {
|
||||
actuator_controls_s act0{};
|
||||
actuator_controls_s act1{};
|
||||
_act0_sub.copy(&act0);
|
||||
_act1_sub.copy(&act1);
|
||||
vehicle_thrust_setpoint_s vehicle_thrust_setpoint_0{};
|
||||
vehicle_thrust_setpoint_s vehicle_thrust_setpoint_1{};
|
||||
_vehicle_thrust_setpoint_0_sub.copy(&vehicle_thrust_setpoint_0);
|
||||
_vehicle_thrust_setpoint_1_sub.copy(&vehicle_thrust_setpoint_1);
|
||||
|
||||
// VFR_HUD throttle should only be used for operator feedback.
|
||||
// VTOLs switch between actuator_controls_0 and actuator_controls_1. During transition there isn't a
|
||||
// VTOLs switch between vehicle_thrust_setpoint_0 and vehicle_thrust_setpoint_1. During transition there isn't a
|
||||
// a single throttle value, but this should still be a useful heuristic for operator awareness.
|
||||
//
|
||||
// Use ACTUATOR_CONTROL_TARGET if accurate states are needed.
|
||||
msg.throttle = 100 * math::max(
|
||||
act0.control[actuator_controls_s::INDEX_THROTTLE],
|
||||
act1.control[actuator_controls_s::INDEX_THROTTLE]);
|
||||
-vehicle_thrust_setpoint_0.xyz[2],
|
||||
vehicle_thrust_setpoint_1.xyz[0]);
|
||||
|
||||
} else {
|
||||
msg.throttle = 0.0f;
|
||||
|
||||
Reference in New Issue
Block a user