36 #include <board_config.h> 41 #include <px4_platform_common/atomic.h> 42 #include <px4_platform_common/module_params.h> 43 #include <px4_platform_common/px4_work_queue/ScheduledWorkItem.hpp> 65 :
px4::ScheduledWorkItem(name, config), ModuleParams(nullptr) {}
76 virtual bool updateOutputs(
bool stop_motors, uint16_t outputs[MAX_ACTUATORS],
77 unsigned num_outputs,
unsigned num_control_groups_updated) = 0;
109 bool support_esc_calibration,
bool ramp_up =
true);
115 void printStatus()
const;
129 bool updateSubscriptions(
bool allow_wq_switch);
136 void setMaxTopicUpdateRate(
unsigned max_topic_update_interval_us);
142 void resetMixerThreadSafe();
151 int loadMixerThreadSafe(
const char *buf,
unsigned len);
153 int loadMixer(
const char *buf,
unsigned len);
159 void setAllFailsafeValues(uint16_t value);
160 void setAllDisarmedValues(uint16_t value);
161 void setAllMinValues(uint16_t value);
162 void setAllMaxValues(uint16_t value);
168 uint16_t &
minValue(
int index) {
return _min_value[index]; }
169 uint16_t &
maxValue(
int index) {
return _max_value[index]; }
176 int reorderedMotorIndex(
int index)
const;
181 void updateParams()
override;
184 void handleCommands();
191 unsigned motorTest();
193 void updateOutputSlewrate();
194 void setAndPublishActuatorOutputs(
unsigned num_outputs,
actuator_outputs_s &actuator_outputs);
198 static int controlCallback(uintptr_t handle, uint8_t control_group, uint8_t control_index,
float &input);
222 inline void reorderOutputs(uint16_t values[MAX_ACTUATORS]);
224 void lock() {
do {}
while (px4_sem_wait(&_lock) != 0); }
234 uint16_t _reverse_output_mask{0};
247 unsigned _max_topic_update_interval_us{0};
249 bool _throttle_armed{
false};
250 bool _ignore_lockdown{
false};
259 bool _wq_switched{
false};
260 uint8_t _driver_instance{0};
265 bool in_test_mode{
false};
275 (ParamInt<px4::params::MC_AIRMODE>) _param_mc_airmode,
276 (ParamFloat<px4::params::MOT_SLEW_MAX>) _param_mot_slew_max,
277 (ParamFloat<px4::params::THR_MDL_FAC>) _param_thr_mdl_fac,
278 (ParamInt<px4::params::MOT_ORDERING>) _param_mot_ordering
const actuator_armed_s & armed() const
perf_counter_t _control_latency_perf
actuator_controls_s _controls[1]
uint16_t & reverseOutputMask()
const SchedulingPolicy _scheduling_policy
Command _command
incoming commands (from another thread)
static constexpr int MAX_ACTUATORS
void setIgnoreLockdown(bool ignore_lockdown)
bool in_esc_calibration_mode
#define ORB_ID(_name)
Generates a pointer to the uORB metadata structure for a given topic.
uint16_t & maxValue(int index)
OutputModuleInterface & _interface
OutputModuleInterface(const char *name, const px4::wq_config_t &config)
virtual void mixerChanged()
called whenever the mixer gets updated/reset
#define PWM_OUTPUT_MAX_CHANNELS
uint32_t _groups_required
Base class for an output module.
__BEGIN_DECLS typedef uint64_t hrt_abstime
Absolute time, in microsecond units.
bool armNoThrottle() const
uint16_t & disarmedValue(int index)
Disarmed values: disarmedValue < minValue needs to hold.
px4_sem_t _lock
lock to protect access to work queue changes (includes ScheduleNow calls from another thread) ...
void setDriverInstance(uint8_t instance)
uint16_t & minValue(int index)
virtual bool updateOutputs(bool stop_motors, uint16_t outputs[MAX_ACTUATORS], unsigned num_outputs, unsigned num_control_groups_updated)=0
Callback to update the (physical) actuator outputs in the driver.
Group of mixers, built up from single mixers and processed in order when mixing.
MixerGroup * mixers() const
uint32_t _groups_subscribed
unsigned mixer_buf_length
const uint8_t _max_num_outputs
Library for output limiting (PWM for example)
This handles the mixing, arming/disarming and all subscriptions required for that.
output_limit_t _output_limit
const bool _support_esc_calibration
orb_advert_t _outputs_pub
Performance measuring tools.
uint16_t & failsafeValue(int index)