mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-25 04:43:34 +08:00
uavcan: delete unused ESC idle and soft_stop
This commit is contained in:
@@ -7,4 +7,3 @@ bool lockdown # Set to true if actuators are forced to being disabled (due to e
|
|||||||
bool manual_lockdown # Set to true if manual throttle kill switch is engaged
|
bool manual_lockdown # Set to true if manual throttle kill switch is engaged
|
||||||
bool force_failsafe # Set to true if the actuators are forced to the failsafe position
|
bool force_failsafe # Set to true if the actuators are forced to the failsafe position
|
||||||
bool in_esc_calibration_mode # IO/FMU should ignore messages from the actuator controls topics
|
bool in_esc_calibration_mode # IO/FMU should ignore messages from the actuator controls topics
|
||||||
bool soft_stop # Set to true if we need to ESCs to remove the idle constraint
|
|
||||||
|
|||||||
@@ -58,7 +58,6 @@
|
|||||||
#include <uORB/topics/esc_status.h>
|
#include <uORB/topics/esc_status.h>
|
||||||
|
|
||||||
#include <drivers/drv_hrt.h>
|
#include <drivers/drv_hrt.h>
|
||||||
#include <drivers/drv_pwm_output.h>
|
|
||||||
|
|
||||||
#include "uavcan_module.hpp"
|
#include "uavcan_module.hpp"
|
||||||
#include "uavcan_main.hpp"
|
#include "uavcan_main.hpp"
|
||||||
@@ -76,7 +75,6 @@
|
|||||||
UavcanNode *UavcanNode::_instance;
|
UavcanNode *UavcanNode::_instance;
|
||||||
|
|
||||||
UavcanNode::UavcanNode(uavcan::ICanDriver &can_driver, uavcan::ISystemClock &system_clock) :
|
UavcanNode::UavcanNode(uavcan::ICanDriver &can_driver, uavcan::ISystemClock &system_clock) :
|
||||||
CDev(UAVCAN_DEVICE_PATH),
|
|
||||||
ScheduledWorkItem(MODULE_NAME, px4::wq_configurations::uavcan),
|
ScheduledWorkItem(MODULE_NAME, px4::wq_configurations::uavcan),
|
||||||
ModuleParams(nullptr),
|
ModuleParams(nullptr),
|
||||||
_node(can_driver, system_clock, _pool_allocator),
|
_node(can_driver, system_clock, _pool_allocator),
|
||||||
@@ -492,13 +490,6 @@ UavcanNode::busevent_signal_trampoline()
|
|||||||
int
|
int
|
||||||
UavcanNode::init(uavcan::NodeID node_id, UAVCAN_DRIVER::BusEvent &bus_events)
|
UavcanNode::init(uavcan::NodeID node_id, UAVCAN_DRIVER::BusEvent &bus_events)
|
||||||
{
|
{
|
||||||
// Do regular cdev init
|
|
||||||
int ret = CDev::init();
|
|
||||||
|
|
||||||
if (ret != OK) {
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
bus_events.registerSignalCallback(UavcanNode::busevent_signal_trampoline);
|
bus_events.registerSignalCallback(UavcanNode::busevent_signal_trampoline);
|
||||||
|
|
||||||
_node.setName("org.pixhawk.pixhawk");
|
_node.setName("org.pixhawk.pixhawk");
|
||||||
@@ -507,7 +498,7 @@ UavcanNode::init(uavcan::NodeID node_id, UAVCAN_DRIVER::BusEvent &bus_events)
|
|||||||
|
|
||||||
fill_node_info();
|
fill_node_info();
|
||||||
|
|
||||||
ret = _beep_controller.init();
|
int ret = _beep_controller.init();
|
||||||
|
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
return ret;
|
return ret;
|
||||||
@@ -688,10 +679,6 @@ UavcanNode::Run()
|
|||||||
|
|
||||||
_node.spinOnce(); // expected to be non-blocking
|
_node.spinOnce(); // expected to be non-blocking
|
||||||
|
|
||||||
// Check arming state
|
|
||||||
const actuator_armed_s &armed = _mixing_interface_esc.mixingOutput().armed();
|
|
||||||
enable_idle_throttle_when_armed(!armed.soft_stop);
|
|
||||||
|
|
||||||
// check for parameter updates
|
// check for parameter updates
|
||||||
if (_parameter_update_sub.updated()) {
|
if (_parameter_update_sub.updated()) {
|
||||||
// clear update
|
// clear update
|
||||||
@@ -918,12 +905,6 @@ UavcanNode::Run()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
UavcanNode::enable_idle_throttle_when_armed(bool value)
|
|
||||||
{
|
|
||||||
value &= _idle_throttle_when_armed_param > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool UavcanMixingInterfaceESC::updateOutputs(bool stop_motors, uint16_t outputs[MAX_ACTUATORS], unsigned num_outputs,
|
bool UavcanMixingInterfaceESC::updateOutputs(bool stop_motors, uint16_t outputs[MAX_ACTUATORS], unsigned num_outputs,
|
||||||
unsigned num_control_groups_updated)
|
unsigned num_control_groups_updated)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -146,7 +146,7 @@ private:
|
|||||||
/**
|
/**
|
||||||
* A UAVCAN node.
|
* A UAVCAN node.
|
||||||
*/
|
*/
|
||||||
class UavcanNode : public cdev::CDev, public px4::ScheduledWorkItem, public ModuleParams
|
class UavcanNode : public px4::ScheduledWorkItem, public ModuleParams
|
||||||
{
|
{
|
||||||
static constexpr unsigned MaxBitRatePerSec = 1000000;
|
static constexpr unsigned MaxBitRatePerSec = 1000000;
|
||||||
static constexpr unsigned bitPerFrame = 148;
|
static constexpr unsigned bitPerFrame = 148;
|
||||||
@@ -212,8 +212,6 @@ private:
|
|||||||
void set_setget_response(uavcan::protocol::param::GetSet::Response *resp) { _setget_response = resp; }
|
void set_setget_response(uavcan::protocol::param::GetSet::Response *resp) { _setget_response = resp; }
|
||||||
void free_setget_response(void) { _setget_response = nullptr; }
|
void free_setget_response(void) { _setget_response = nullptr; }
|
||||||
|
|
||||||
void enable_idle_throttle_when_armed(bool value);
|
|
||||||
|
|
||||||
px4::atomic_bool _task_should_exit{false}; ///< flag to indicate to tear down the CAN driver
|
px4::atomic_bool _task_should_exit{false}; ///< flag to indicate to tear down the CAN driver
|
||||||
|
|
||||||
unsigned _output_count{0}; ///< number of actuators currently available
|
unsigned _output_count{0}; ///< number of actuators currently available
|
||||||
@@ -243,9 +241,6 @@ private:
|
|||||||
|
|
||||||
List<IUavcanSensorBridge *> _sensor_bridges; ///< List of active sensor bridges
|
List<IUavcanSensorBridge *> _sensor_bridges; ///< List of active sensor bridges
|
||||||
|
|
||||||
bool _idle_throttle_when_armed{false};
|
|
||||||
int32_t _idle_throttle_when_armed_param{0};
|
|
||||||
|
|
||||||
perf_counter_t _cycle_perf{perf_alloc(PC_ELAPSED, MODULE_NAME": cycle time")};
|
perf_counter_t _cycle_perf{perf_alloc(PC_ELAPSED, MODULE_NAME": cycle time")};
|
||||||
perf_counter_t _interval_perf{perf_alloc(PC_INTERVAL, MODULE_NAME": cycle interval")};
|
perf_counter_t _interval_perf{perf_alloc(PC_INTERVAL, MODULE_NAME": cycle interval")};
|
||||||
|
|
||||||
|
|||||||
@@ -58,10 +58,5 @@
|
|||||||
#define UAVCAN_NODE_DB_PATH UAVCAN_SD_ROOT_PATH"/uavcan.db"
|
#define UAVCAN_NODE_DB_PATH UAVCAN_SD_ROOT_PATH"/uavcan.db"
|
||||||
#define UAVCAN_LOG_FILE UAVCAN_NODE_DB_PATH"/trace.log"
|
#define UAVCAN_LOG_FILE UAVCAN_NODE_DB_PATH"/trace.log"
|
||||||
|
|
||||||
// device files
|
|
||||||
// TODO: split IOCTL interface in ESC and node related functionality, then change UAVCAN_DEVICE_PATH to "/dev/uavcan/node"
|
|
||||||
#define UAVCAN_DEVICE_PATH "/dev/uavcan/esc"
|
|
||||||
#define UAVCAN_ESC_DEVICE_PATH "/dev/uavcan/esc"
|
|
||||||
|
|
||||||
// public prototypes
|
// public prototypes
|
||||||
extern "C" __EXPORT int uavcan_main(int argc, char *argv[]);
|
extern "C" __EXPORT int uavcan_main(int argc, char *argv[]);
|
||||||
|
|||||||
@@ -77,15 +77,6 @@ PARAM_DEFINE_INT32(UAVCAN_NODE_ID, 1);
|
|||||||
*/
|
*/
|
||||||
PARAM_DEFINE_INT32(UAVCAN_BITRATE, 1000000);
|
PARAM_DEFINE_INT32(UAVCAN_BITRATE, 1000000);
|
||||||
|
|
||||||
/**
|
|
||||||
* UAVCAN ESC will spin at idle throttle when armed, even if the mixer outputs zero setpoints.
|
|
||||||
*
|
|
||||||
* @boolean
|
|
||||||
* @reboot_required true
|
|
||||||
* @group UAVCAN
|
|
||||||
*/
|
|
||||||
PARAM_DEFINE_INT32(UAVCAN_ESC_IDLT, 1);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* UAVCAN rangefinder minimum range
|
* UAVCAN rangefinder minimum range
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -97,8 +97,7 @@ static constexpr bool operator ==(const actuator_armed_s &a, const actuator_arme
|
|||||||
a.lockdown == b.lockdown &&
|
a.lockdown == b.lockdown &&
|
||||||
a.manual_lockdown == b.manual_lockdown &&
|
a.manual_lockdown == b.manual_lockdown &&
|
||||||
a.force_failsafe == b.force_failsafe &&
|
a.force_failsafe == b.force_failsafe &&
|
||||||
a.in_esc_calibration_mode == b.in_esc_calibration_mode &&
|
a.in_esc_calibration_mode == b.in_esc_calibration_mode);
|
||||||
a.soft_stop == b.soft_stop);
|
|
||||||
}
|
}
|
||||||
static_assert(sizeof(actuator_armed_s) == 16, "actuator_armed equality operator review");
|
static_assert(sizeof(actuator_armed_s) == 16, "actuator_armed equality operator review");
|
||||||
|
|
||||||
@@ -2545,13 +2544,6 @@ void Commander::vtolStatusUpdate()
|
|||||||
_vehicle_status_flags.vtol_transition_failure = _vtol_vehicle_status.vtol_transition_failsafe;
|
_vehicle_status_flags.vtol_transition_failure = _vtol_vehicle_status.vtol_transition_failsafe;
|
||||||
_status_changed = true;
|
_status_changed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
const bool should_soft_stop = (_vehicle_status.vehicle_type != vehicle_status_s::VEHICLE_TYPE_ROTARY_WING);
|
|
||||||
|
|
||||||
if (_actuator_armed.soft_stop != should_soft_stop) {
|
|
||||||
_actuator_armed.soft_stop = should_soft_stop;
|
|
||||||
_status_changed = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user