mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-24 07:53:35 +08:00
MulticopterRateControl: Remove old battery scaling
This commit is contained in:
@@ -237,24 +237,6 @@ MulticopterRateControl::Run()
|
|||||||
vehicle_torque_setpoint.xyz[1] = PX4_ISFINITE(torque_setpoint(1)) ? torque_setpoint(1) : 0.f;
|
vehicle_torque_setpoint.xyz[1] = PX4_ISFINITE(torque_setpoint(1)) ? torque_setpoint(1) : 0.f;
|
||||||
vehicle_torque_setpoint.xyz[2] = PX4_ISFINITE(torque_setpoint(2)) ? torque_setpoint(2) : 0.f;
|
vehicle_torque_setpoint.xyz[2] = PX4_ISFINITE(torque_setpoint(2)) ? torque_setpoint(2) : 0.f;
|
||||||
|
|
||||||
// scale setpoints by battery status if enabled
|
|
||||||
if (_param_mc_bat_scale_en.get()) {
|
|
||||||
if (_battery_status_sub.updated()) {
|
|
||||||
battery_status_s battery_status;
|
|
||||||
|
|
||||||
if (_battery_status_sub.copy(&battery_status) && battery_status.connected && battery_status.scale > 0.f) {
|
|
||||||
_battery_status_scale = battery_status.scale;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_battery_status_scale > 0.f) {
|
|
||||||
for (int i = 0; i < 3; i++) {
|
|
||||||
vehicle_thrust_setpoint.xyz[i] = math::constrain(vehicle_thrust_setpoint.xyz[i] * _battery_status_scale, -1.f, 1.f);
|
|
||||||
vehicle_torque_setpoint.xyz[i] = math::constrain(vehicle_torque_setpoint.xyz[i] * _battery_status_scale, -1.f, 1.f);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
vehicle_thrust_setpoint.timestamp_sample = angular_velocity.timestamp_sample;
|
vehicle_thrust_setpoint.timestamp_sample = angular_velocity.timestamp_sample;
|
||||||
vehicle_thrust_setpoint.timestamp = hrt_absolute_time();
|
vehicle_thrust_setpoint.timestamp = hrt_absolute_time();
|
||||||
_vehicle_thrust_setpoint_pub.publish(vehicle_thrust_setpoint);
|
_vehicle_thrust_setpoint_pub.publish(vehicle_thrust_setpoint);
|
||||||
|
|||||||
@@ -48,7 +48,6 @@
|
|||||||
#include <uORB/Subscription.hpp>
|
#include <uORB/Subscription.hpp>
|
||||||
#include <uORB/SubscriptionCallback.hpp>
|
#include <uORB/SubscriptionCallback.hpp>
|
||||||
#include <uORB/topics/actuator_controls_status.h>
|
#include <uORB/topics/actuator_controls_status.h>
|
||||||
#include <uORB/topics/battery_status.h>
|
|
||||||
#include <uORB/topics/control_allocator_status.h>
|
#include <uORB/topics/control_allocator_status.h>
|
||||||
#include <uORB/topics/manual_control_setpoint.h>
|
#include <uORB/topics/manual_control_setpoint.h>
|
||||||
#include <uORB/topics/parameter_update.h>
|
#include <uORB/topics/parameter_update.h>
|
||||||
@@ -92,7 +91,6 @@ private:
|
|||||||
|
|
||||||
RateControl _rate_control; ///< class for rate control calculations
|
RateControl _rate_control; ///< class for rate control calculations
|
||||||
|
|
||||||
uORB::Subscription _battery_status_sub{ORB_ID(battery_status)};
|
|
||||||
uORB::Subscription _control_allocator_status_sub{ORB_ID(control_allocator_status)};
|
uORB::Subscription _control_allocator_status_sub{ORB_ID(control_allocator_status)};
|
||||||
uORB::Subscription _manual_control_setpoint_sub{ORB_ID(manual_control_setpoint)};
|
uORB::Subscription _manual_control_setpoint_sub{ORB_ID(manual_control_setpoint)};
|
||||||
uORB::Subscription _vehicle_control_mode_sub{ORB_ID(vehicle_control_mode)};
|
uORB::Subscription _vehicle_control_mode_sub{ORB_ID(vehicle_control_mode)};
|
||||||
@@ -123,8 +121,6 @@ private:
|
|||||||
// keep setpoint values between updates
|
// keep setpoint values between updates
|
||||||
matrix::Vector3f _acro_rate_max; /**< max attitude rates in acro mode */
|
matrix::Vector3f _acro_rate_max; /**< max attitude rates in acro mode */
|
||||||
matrix::Vector3f _rates_setpoint{};
|
matrix::Vector3f _rates_setpoint{};
|
||||||
|
|
||||||
float _battery_status_scale{0.0f};
|
|
||||||
matrix::Vector3f _thrust_setpoint{};
|
matrix::Vector3f _thrust_setpoint{};
|
||||||
|
|
||||||
float _energy_integration_time{0.0f};
|
float _energy_integration_time{0.0f};
|
||||||
@@ -161,8 +157,6 @@ private:
|
|||||||
(ParamFloat<px4::params::MC_ACRO_EXPO>) _param_mc_acro_expo, /**< expo stick curve shape (roll & pitch) */
|
(ParamFloat<px4::params::MC_ACRO_EXPO>) _param_mc_acro_expo, /**< expo stick curve shape (roll & pitch) */
|
||||||
(ParamFloat<px4::params::MC_ACRO_EXPO_Y>) _param_mc_acro_expo_y, /**< expo stick curve shape (yaw) */
|
(ParamFloat<px4::params::MC_ACRO_EXPO_Y>) _param_mc_acro_expo_y, /**< expo stick curve shape (yaw) */
|
||||||
(ParamFloat<px4::params::MC_ACRO_SUPEXPO>) _param_mc_acro_supexpo, /**< superexpo stick curve shape (roll & pitch) */
|
(ParamFloat<px4::params::MC_ACRO_SUPEXPO>) _param_mc_acro_supexpo, /**< superexpo stick curve shape (roll & pitch) */
|
||||||
(ParamFloat<px4::params::MC_ACRO_SUPEXPOY>) _param_mc_acro_supexpoy, /**< superexpo stick curve shape (yaw) */
|
(ParamFloat<px4::params::MC_ACRO_SUPEXPOY>) _param_mc_acro_supexpoy /**< superexpo stick curve shape (yaw) */
|
||||||
|
|
||||||
(ParamBool<px4::params::MC_BAT_SCALE_EN>) _param_mc_bat_scale_en
|
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -278,20 +278,6 @@ PARAM_DEFINE_FLOAT(MC_YAWRATE_FF, 0.0f);
|
|||||||
*/
|
*/
|
||||||
PARAM_DEFINE_FLOAT(MC_YAWRATE_K, 1.0f);
|
PARAM_DEFINE_FLOAT(MC_YAWRATE_K, 1.0f);
|
||||||
|
|
||||||
/**
|
|
||||||
* Battery power level scaler
|
|
||||||
*
|
|
||||||
* This compensates for voltage drop of the battery over time by attempting to
|
|
||||||
* normalize performance across the operating range of the battery. The copter
|
|
||||||
* should constantly behave as if it was fully charged with reduced max acceleration
|
|
||||||
* at lower battery percentages. i.e. if hover is at 0.5 throttle at 100% battery,
|
|
||||||
* it will still be 0.5 at 60% battery.
|
|
||||||
*
|
|
||||||
* @boolean
|
|
||||||
* @group Multicopter Rate Control
|
|
||||||
*/
|
|
||||||
PARAM_DEFINE_INT32(MC_BAT_SCALE_EN, 0);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Low pass filter cutoff frequency for yaw torque setpoint
|
* Low pass filter cutoff frequency for yaw torque setpoint
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user