mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-07-02 02:30:35 +08:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 9c32b49d17 |
@@ -139,14 +139,6 @@ void VertiqIo::Run()
|
||||
_mixing_output.update();
|
||||
_mixing_output.updateSubscriptions(true);
|
||||
|
||||
//Go ahead and check to see if our actuator test has gotten anything new
|
||||
if (_actuator_test_sub.updated()) {
|
||||
_actuator_test_sub.copy(&_actuator_test);
|
||||
|
||||
//Our test is active if anyone is giving us commands through the actuator test
|
||||
_actuator_test_active = _actuator_test.action == actuator_test_s::ACTION_DO_CONTROL;
|
||||
}
|
||||
|
||||
//stop our timer
|
||||
perf_end(_loop_perf);
|
||||
}
|
||||
@@ -200,8 +192,7 @@ bool VertiqIo::updateOutputs(uint16_t outputs[MAX_ACTUATORS], unsigned num_outpu
|
||||
{
|
||||
#ifdef CONFIG_USE_IFCI_CONFIGURATION
|
||||
|
||||
if (_mixing_output.armed().armed) {
|
||||
|
||||
if (_mixing_output.motorsActive()) {
|
||||
if (_param_vertiq_arm_behavior.get() == FORCE_ARMING && _send_forced_arm) {
|
||||
_broadcast_arming_handler.motor_armed_.set(*_serial_interface.GetIquartInterface(), 1);
|
||||
_send_forced_arm = false;
|
||||
@@ -214,9 +205,6 @@ bool VertiqIo::updateOutputs(uint16_t outputs[MAX_ACTUATORS], unsigned num_outpu
|
||||
//proper value when necessary
|
||||
_transmission_message.telem_byte = _impossible_module_id;
|
||||
|
||||
} else if (_actuator_test_active) {
|
||||
OutputControls(outputs);
|
||||
|
||||
} else {
|
||||
//Put the modules into coast
|
||||
switch (_param_vertiq_disarm_behavior.get()) {
|
||||
@@ -240,8 +228,6 @@ bool VertiqIo::updateOutputs(uint16_t outputs[MAX_ACTUATORS], unsigned num_outpu
|
||||
if (!_send_forced_arm) {
|
||||
_send_forced_arm = true;
|
||||
}
|
||||
|
||||
_actuator_test_active = false;
|
||||
}
|
||||
|
||||
//Publish our esc status to uORB
|
||||
|
||||
@@ -162,17 +162,12 @@ private:
|
||||
uint32_t _telemetry_ids_2 = 0;
|
||||
|
||||
bool _send_forced_arm = true;
|
||||
bool _actuator_test_active = false;
|
||||
|
||||
uORB::Publication<esc_status_s> _esc_status_pub{ORB_ID(esc_status)}; //We want to publish our ESC Status to anyone who will listen
|
||||
|
||||
// Subscriptions
|
||||
uORB::SubscriptionInterval _parameter_update_sub{ORB_ID(parameter_update), 1_s};
|
||||
|
||||
//We need to know what's going on with the actuator test to make sure we handle it properly
|
||||
uORB::Subscription _actuator_test_sub{ORB_ID(actuator_test)};
|
||||
actuator_test_s _actuator_test;
|
||||
|
||||
//We need to bring in the parameters that we define in module.yaml in order to view them in the
|
||||
//control station, as well as to use them in the firmware
|
||||
DEFINE_PARAMETERS(
|
||||
|
||||
@@ -1392,7 +1392,7 @@ void VoxlEsc::Run()
|
||||
_mixing_output.update(); //calls MixingOutput::limitAndUpdateOutputs which calls updateOutputs in this module
|
||||
|
||||
/* update output status if armed */
|
||||
_outputs_on = _mixing_output.armed().armed;
|
||||
_outputs_on = _mixing_output.motorsActive();
|
||||
|
||||
/* check for parameter updates */
|
||||
if (!_outputs_on && _parameter_update_sub.updated()) {
|
||||
@@ -1491,13 +1491,6 @@ void VoxlEsc::Run()
|
||||
}
|
||||
}
|
||||
|
||||
if (!_outputs_on) {
|
||||
if (_actuator_test_sub.updated()) {
|
||||
// values are set in ActuatorTest::update, we just need to enable outputs to let them through
|
||||
_outputs_on = true;
|
||||
}
|
||||
}
|
||||
|
||||
/* Don't process commands if outputs on */
|
||||
if (!_outputs_on) {
|
||||
if (_current_cmd.valid()) {
|
||||
|
||||
@@ -211,7 +211,6 @@ private:
|
||||
uORB::Subscription _vehicle_control_mode_sub{ORB_ID(vehicle_control_mode)};
|
||||
uORB::Subscription _manual_control_setpoint_sub{ORB_ID(manual_control_setpoint)};
|
||||
uORB::Subscription _parameter_update_sub{ORB_ID(parameter_update)};
|
||||
uORB::Subscription _actuator_test_sub{ORB_ID(actuator_test)};
|
||||
uORB::Subscription _led_update_sub{ORB_ID(led_control)};
|
||||
uORB::Subscription _esc_serial_passthru_sub{ORB_ID(esc_serial_passthru)};
|
||||
|
||||
|
||||
@@ -526,7 +526,7 @@ void DShot::Run()
|
||||
|
||||
handle_vehicle_commands();
|
||||
|
||||
if (!_mixing_output.armed().armed) {
|
||||
if (!_mixing_output.motorsActive()) {
|
||||
if (_reversible_outputs != _mixing_output.reversibleOutputs()) {
|
||||
_reversible_outputs = _mixing_output.reversibleOutputs();
|
||||
update_params();
|
||||
|
||||
@@ -542,7 +542,7 @@ void PX4IO::Run()
|
||||
// TODO: throttle
|
||||
}
|
||||
|
||||
if (!_mixing_output.armed().armed) {
|
||||
if (!_mixing_output.motorsActive()) {
|
||||
/* vehicle command */
|
||||
if (_t_vehicle_command.updated()) {
|
||||
vehicle_command_s cmd{};
|
||||
@@ -693,8 +693,7 @@ void PX4IO::update_params()
|
||||
|
||||
updateParams();
|
||||
|
||||
if (!_mixing_output.armed().armed) {
|
||||
|
||||
if (!_mixing_output.motorsActive()) {
|
||||
// Automatically set the PWM rate and disarmed value when a channel is first set to a servo
|
||||
if (!_first_update_cycle) {
|
||||
for (size_t i = 0; i < _max_actuators; i++) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* Copyright (c) 2022 PX4 Development Team. All rights reserved.
|
||||
* Copyright (c) 2022-2025 PX4 Development Team. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* Copyright (c) 2022 PX4 Development Team. All rights reserved.
|
||||
* Copyright (c) 2022-2025 PX4 Development Team. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
||||
@@ -544,7 +544,7 @@ void Voxl2IO::Run()
|
||||
_mixing_output.update(); //calls MixingOutput::limitAndUpdateOutputs which calls updateOutputs in this module
|
||||
|
||||
/* update PWM status if armed or if disarmed PWM values are set */
|
||||
_pwm_on = _mixing_output.armed().armed;
|
||||
_pwm_on = _mixing_output.motorsActive();
|
||||
|
||||
//receive packets from voxl_io board
|
||||
receive_uart_packets();
|
||||
|
||||
@@ -427,10 +427,6 @@ bool MixingOutput::update()
|
||||
if (_ignore_lockdown) {
|
||||
_armed.lockdown = false;
|
||||
}
|
||||
|
||||
/* Update the armed status and check that we're not locked down.
|
||||
* We also need to arm throttle for the ESC calibration. */
|
||||
_throttle_armed = (_armed.armed && !_armed.lockdown) || _armed.in_esc_calibration_mode;
|
||||
}
|
||||
|
||||
// only used for sitl with lockstep
|
||||
@@ -502,7 +498,7 @@ MixingOutput::limitAndUpdateOutputs(float outputs[MAX_ACTUATORS], bool has_updat
|
||||
|
||||
} else {
|
||||
// the output limit call takes care of out of band errors, NaN and constrains
|
||||
output_limit_calc(_throttle_armed || _actuator_test.inTestMode(), _max_num_outputs, outputs);
|
||||
output_limit_calc(motorsActive(), _max_num_outputs, outputs);
|
||||
}
|
||||
|
||||
// We must calibrate the PWM and Oneshot ESCs to a consistent range of 1000-2000us (gets mapped to 125-250us for Oneshot)
|
||||
|
||||
@@ -162,7 +162,12 @@ public:
|
||||
|
||||
void setMaxTopicUpdateRate(unsigned max_topic_update_interval_us);
|
||||
|
||||
const actuator_armed_s &armed() const { return _armed; }
|
||||
bool motorsActive() const
|
||||
{
|
||||
const bool lockdown = _armed.lockdown || _armed.termination || _armed.kill;
|
||||
const bool need_to_activate = _armed.armed || _armed.in_esc_calibration_mode || _actuator_test.inTestMode();
|
||||
return !lockdown && need_to_activate;
|
||||
}
|
||||
|
||||
void setAllFailsafeValues(uint16_t value);
|
||||
void setAllDisarmedValues(uint16_t value);
|
||||
@@ -266,7 +271,6 @@ private:
|
||||
|
||||
unsigned _max_topic_update_interval_us{0}; ///< max topic update interval (0=unlimited)
|
||||
|
||||
bool _throttle_armed{false};
|
||||
bool _ignore_lockdown{false}; ///< if true, ignore the _armed.lockdown flag (for HIL outputs)
|
||||
|
||||
const SchedulingPolicy _scheduling_policy;
|
||||
|
||||
Reference in New Issue
Block a user