PX4 Firmware
PX4 Autopilot Software http://px4.io
|
Group of mixers, built up from single mixers and processed in order when mixing. More...
#include <MixerGroup.hpp>
Public Member Functions | |
MixerGroup ()=default | |
~MixerGroup () | |
MixerGroup (const MixerGroup &)=delete | |
MixerGroup & | operator= (const MixerGroup &)=delete |
MixerGroup (MixerGroup &&)=delete | |
MixerGroup & | operator= (MixerGroup &&)=delete |
unsigned | mix (float *outputs, unsigned space) |
uint16_t | get_saturation_status () |
void | groups_required (uint32_t &groups) |
void | add_mixer (Mixer *mixer) |
Add a mixer to the group. More... | |
void | reset () |
Remove all the mixers from the group. More... | |
unsigned | count () const |
Count the mixers in the group. More... | |
int | load_from_buf (Mixer::ControlCallback control_cb, uintptr_t cb_handle, const char *buf, unsigned &buflen) |
Adds mixers to the group based on a text description in a buffer. More... | |
void | set_max_delta_out_once (float delta_out_max) |
Update slew rate parameter. More... | |
unsigned | set_trims (int16_t *v, unsigned n) |
unsigned | get_trims (int16_t *values) |
void | set_thrust_factor (float val) |
Sets the thrust factor used to calculate mapping from desired thrust to motor control signal output. More... | |
void | set_airmode (Mixer::Airmode airmode) |
unsigned | get_multirotor_count () |
Private Attributes | |
List< Mixer * > | _mixers |
linked list of mixers More... | |
Group of mixers, built up from single mixers and processed in order when mixing.
Definition at line 42 of file MixerGroup.hpp.
|
default |
|
inline |
Definition at line 47 of file MixerGroup.hpp.
References get_saturation_status(), groups_required(), mix(), MixerGroup(), operator=(), and reset().
|
delete |
|
delete |
|
inline |
Add a mixer to the group.
mixer | The mixer to be added. |
Definition at line 69 of file MixerGroup.hpp.
References _mixers.
Referenced by load_from_buf().
|
inline |
Count the mixers in the group.
Definition at line 79 of file MixerGroup.hpp.
References _mixers, get_multirotor_count(), get_trims(), load_from_buf(), set_airmode(), set_max_delta_out_once(), set_thrust_factor(), and set_trims().
Referenced by linux_pwm_out::initialize_mixer(), and MixerTest::load_mixer().
unsigned MixerGroup::get_multirotor_count | ( | ) |
Definition at line 139 of file MixerGroup.cpp.
References _mixers, MultirotorMixer::get_multirotor_count(), and uart_esc::mixer.
Referenced by count(), and DShotOutput::updateTelemetryNumMotors().
uint16_t MixerGroup::get_saturation_status | ( | ) |
Definition at line 153 of file MixerGroup.cpp.
References _mixers, MultirotorMixer::get_saturation_status(), and uart_esc::mixer.
Referenced by TAP_ESC::cycle(), mixer_mix_threadsafe(), MixingOutput::publishMixerStatus(), and ~MixerGroup().
unsigned MixerGroup::get_trims | ( | int16_t * | values | ) |
Definition at line 102 of file MixerGroup.cpp.
References _mixers, MultirotorMixer::get_trim(), and uart_esc::mixer.
Referenced by count(), and PX4FMU::pwm_ioctl().
void MixerGroup::groups_required | ( | uint32_t & | groups | ) |
Definition at line 165 of file MixerGroup.cpp.
References _mixers, MultirotorMixer::groups_required(), and uart_esc::mixer.
Referenced by TAP_ESC::ioctl(), MixingOutput::loadMixer(), linux_pwm_out::task_main(), and ~MixerGroup().
int MixerGroup::load_from_buf | ( | Mixer::ControlCallback | control_cb, |
uintptr_t | cb_handle, | ||
const char * | buf, | ||
unsigned & | buflen | ||
) |
Adds mixers to the group based on a text description in a buffer.
Mixer definitions begin with a single capital letter and a colon. The actual format of the mixer definition varies with the individual mixers; they are summarised here, but see ROMFS/mixers/README for more details.
Null Mixer ..........
The null mixer definition has the form:
Z:
Simple Mixer ............
A simple mixer definition begins with:
M: <control count>=""> O: <-ve scale> <+ve scale> <offset> <lower limit>=""> <upper limit>="">
The second line O: can be omitted. In that case 'O: 10000 10000 0 -10000 10000' is used. The definition continues with <control count>=""> entries describing the control inputs and their scaling, in the form:
S: <group> <index> <-ve scale> <+ve scale> <offset> <lower limit>=""> <upper limit>="">
Multirotor Mixer ................
The multirotor mixer definition is a single line of the form:
R: <geometry> <roll scale>=""> <pitch scale>=""> <yaw scale>=""> <deadband>
Helicopter Mixer ................
The helicopter mixer includes throttle and pitch curves
H: <swash plate="" servo="" count>=""> T: <0> <2500> <5000> <7500> <10000> P: <-10000> <-5000> <0> <5000> <10000>
The definition continues with <swash plate="" servo="" count>=""> entries describing the position of the servo, in the following form:
S: <angle (deg)> <normalized arm="" length>=""> <scale> <offset> <lower limit>=""> <upper limit>="">
buf | The mixer configuration buffer. |
buflen | The length of the buffer, updated to reflect bytes as they are consumed. |
Definition at line 173 of file MixerGroup.cpp.
References add_mixer(), debug, NullMixer::from_text(), HelicopterMixer::from_text(), SimpleMixer::from_text(), and MultirotorMixer::from_text().
Referenced by count(), linux_pwm_out::initialize_mixer(), df_bebop_bus_wrapper::initialize_mixers(), TAP_ESC::ioctl(), MixerTest::load_mixer(), MixingOutput::loadMixer(), mixer_handle_text_create_mixer(), and MK::pwm_ioctl().
unsigned MixerGroup::mix | ( | float * | outputs, |
unsigned | space | ||
) |
Definition at line 53 of file MixerGroup.cpp.
References _mixers, MultirotorMixer::mix(), and uart_esc::mixer.
Referenced by TAP_ESC::cycle(), mixer_mix_threadsafe(), MixerTest::mixerTest(), linux_pwm_out::task_main(), MK::task_main(), df_bebop_bus_wrapper::task_main(), MixingOutput::update(), and ~MixerGroup().
|
delete |
|
delete |
|
inline |
Remove all the mixers from the group.
Definition at line 74 of file MixerGroup.hpp.
References _mixers.
Referenced by MixerTest::load_mixer(), mixer_handle_text(), and ~MixerGroup().
void MixerGroup::set_airmode | ( | Mixer::Airmode | airmode | ) |
Definition at line 131 of file MixerGroup.cpp.
References _mixers, uart_esc::mixer, and MultirotorMixer::set_airmode().
Referenced by count(), TAP_ESC::cycle(), mixer_tick(), linux_pwm_out::task_main(), and MixingOutput::updateParams().
void MixerGroup::set_max_delta_out_once | ( | float | delta_out_max | ) |
Update slew rate parameter.
This tells instances of the class MultirotorMixer the maximum allowed change of the output values per cycle. The value is only valid for one cycle, in order to have continuous slew rate limiting this function needs to be called before every call to mix().
[in] | delta_out_max | Maximum delta output. |
Definition at line 240 of file MixerGroup.cpp.
References _mixers, uart_esc::mixer, and MultirotorMixer::set_max_delta_out_once().
Referenced by count(), mixer_set_failsafe(), mixer_tick(), MixingOutput::updateOutputSlewrate(), and MixingOutput::updateParams().
void MixerGroup::set_thrust_factor | ( | float | val | ) |
Sets the thrust factor used to calculate mapping from desired thrust to motor control signal output.
[in] | val | The value |
Definition at line 123 of file MixerGroup.cpp.
References _mixers, uart_esc::mixer, and MultirotorMixer::set_thrust_factor().
Referenced by count(), mixer_set_failsafe(), mixer_tick(), and MixingOutput::updateParams().
unsigned MixerGroup::set_trims | ( | int16_t * | v, |
unsigned | n | ||
) |
Definition at line 75 of file MixerGroup.cpp.
References _mixers, math::constrain(), debug, f(), uart_esc::mixer, and MultirotorMixer::set_trim().
Referenced by count(), mixer_tick(), PX4FMU::pwm_ioctl(), and PX4FMU::update_pwm_trims().
linked list of mixers
Definition at line 169 of file MixerGroup.hpp.
Referenced by add_mixer(), count(), get_multirotor_count(), get_saturation_status(), get_trims(), groups_required(), mix(), reset(), set_airmode(), set_max_delta_out_once(), set_thrust_factor(), and set_trims().