PX4 Firmware
PX4 Autopilot Software http://px4.io
MixerGroup Class Reference

Group of mixers, built up from single mixers and processed in order when mixing. More...

#include <MixerGroup.hpp>

Collaboration diagram for MixerGroup:

Public Member Functions

 MixerGroup ()=default
 
 ~MixerGroup ()
 
 MixerGroup (const MixerGroup &)=delete
 
MixerGroupoperator= (const MixerGroup &)=delete
 
 MixerGroup (MixerGroup &&)=delete
 
MixerGroupoperator= (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...
 

Detailed Description

Group of mixers, built up from single mixers and processed in order when mixing.

Definition at line 42 of file MixerGroup.hpp.

Constructor & Destructor Documentation

◆ MixerGroup() [1/3]

MixerGroup::MixerGroup ( )
default

Referenced by ~MixerGroup().

Here is the caller graph for this function:

◆ ~MixerGroup()

MixerGroup::~MixerGroup ( )
inline

Definition at line 47 of file MixerGroup.hpp.

References get_saturation_status(), groups_required(), mix(), MixerGroup(), operator=(), and reset().

Here is the call graph for this function:

◆ MixerGroup() [2/3]

MixerGroup::MixerGroup ( const MixerGroup )
delete

◆ MixerGroup() [3/3]

MixerGroup::MixerGroup ( MixerGroup &&  )
delete

Member Function Documentation

◆ add_mixer()

void MixerGroup::add_mixer ( Mixer mixer)
inline

Add a mixer to the group.

Parameters
mixerThe mixer to be added.

Definition at line 69 of file MixerGroup.hpp.

References _mixers.

Referenced by load_from_buf().

Here is the caller graph for this function:

◆ count()

unsigned MixerGroup::count ( void  ) const
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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_multirotor_count()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_saturation_status()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_trims()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ groups_required()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ load_from_buf()

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>="">

Parameters
bufThe mixer configuration buffer.
buflenThe length of the buffer, updated to reflect bytes as they are consumed.
Returns
Zero on successful load, nonzero otherwise.

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mix()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator=() [1/2]

MixerGroup& MixerGroup::operator= ( const MixerGroup )
delete

Referenced by ~MixerGroup().

Here is the caller graph for this function:

◆ operator=() [2/2]

MixerGroup& MixerGroup::operator= ( MixerGroup &&  )
delete

◆ reset()

void MixerGroup::reset ( void  )
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().

Here is the caller graph for this function:

◆ set_airmode()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_max_delta_out_once()

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().

Parameters
[in]delta_out_maxMaximum 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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_thrust_factor()

void MixerGroup::set_thrust_factor ( float  val)

Sets the thrust factor used to calculate mapping from desired thrust to motor control signal output.

Parameters
[in]valThe 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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_trims()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ _mixers


The documentation for this class was generated from the following files: