PX4 Firmware
PX4 Autopilot Software http://px4.io
|
Abstract class defining a mixer mixing zero or more inputs to one or more outputs. More...
#include <Mixer.hpp>
Public Types | |
enum | Airmode : int32_t { Airmode::disabled = 0, Airmode::roll_pitch = 1, Airmode::roll_pitch_yaw = 2 } |
typedef int(* | ControlCallback) (uintptr_t handle, uint8_t control_group, uint8_t control_index, float &control) |
Fetch a control value. More... | |
Public Member Functions | |
Mixer (ControlCallback control_cb, uintptr_t cb_handle) | |
Constructor. More... | |
virtual | ~Mixer ()=default |
Mixer (const Mixer &)=delete | |
Mixer & | operator= (const Mixer &)=delete |
Mixer (Mixer &&)=delete | |
Mixer & | operator= (Mixer &&)=delete |
virtual unsigned | mix (float *outputs, unsigned space)=0 |
Perform the mixing function. More... | |
virtual uint16_t | get_saturation_status () |
Get the saturation status. More... | |
virtual void | groups_required (uint32_t &groups) |
Analyses the mix configuration and updates a bitmask of groups that are required. More... | |
virtual void | set_max_delta_out_once (float delta_out_max) |
Empty method, only implemented for MultirotorMixer and MixerGroup class. More... | |
virtual unsigned | set_trim (float trim) |
Set trim offset for this mixer. More... | |
virtual unsigned | get_trim (float *trim) |
Get trim offset for this mixer. More... | |
virtual void | set_thrust_factor (float val) |
virtual void | set_airmode (Airmode airmode) |
Set airmode. More... | |
virtual unsigned | get_multirotor_count () |
Public Member Functions inherited from ListNode< Mixer *> | |
void | setSibling (Mixer * sibling) |
const Mixer * | getSibling () const |
Protected Member Functions | |
float | get_control (uint8_t group, uint8_t index) |
Invoke the client callback to fetch a control value. More... | |
Static Protected Member Functions | |
static const char * | findtag (const char *buf, unsigned &buflen, char tag) |
Find a tag. More... | |
static char | findnexttag (const char *buf, unsigned buflen) |
Find next tag and return it (0 is returned if no tag is found) More... | |
static const char * | skipline (const char *buf, unsigned &buflen) |
Skip a line. More... | |
static bool | string_well_formed (const char *buf, unsigned &buflen) |
Check wether the string is well formed and suitable for parsing. More... | |
Protected Attributes | |
ControlCallback | _control_cb |
client-supplied callback used when fetching control values More... | |
uintptr_t | _cb_handle |
Protected Attributes inherited from ListNode< Mixer *> | |
Mixer * | _list_node_sibling |
Abstract class defining a mixer mixing zero or more inputs to one or more outputs.
typedef int(* Mixer::ControlCallback) (uintptr_t handle, uint8_t control_group, uint8_t control_index, float &control) |
Fetch a control value.
handle | Token passed when the callback is registered. |
control_group | The group to fetch the control from. |
control_index | The group-relative index to fetch the control from. |
control | The returned control |
|
strong |
|
inline |
Constructor.
control_cb | Callback invoked when reading controls. |
Definition at line 161 of file Mixer.hpp.
References mix(), operator=(), and ~Mixer().
|
virtualdefault |
|
delete |
|
delete |
|
staticprotected |
Find next tag and return it (0 is returned if no tag is found)
buf | The buffer to operate on. |
buflen | length of the buffer. |
Definition at line 75 of file Mixer.cpp.
Referenced by SimpleMixer::from_text().
|
staticprotected |
Find a tag.
buf | The buffer to operate on. |
buflen | length of the buffer. |
tag | character to search for. |
Definition at line 60 of file Mixer.cpp.
Referenced by HelicopterMixer::from_text(), SimpleMixer::parse_control_scaler(), and SimpleMixer::parse_output_scaler().
|
protected |
Invoke the client callback to fetch a control value.
group | Control group to fetch from. |
index | Control index to fetch. |
Definition at line 50 of file Mixer.cpp.
References _cb_handle, and _control_cb.
Referenced by HelicopterMixer::mix(), and MultirotorMixer::mix().
|
inlinevirtual |
Reimplemented in MultirotorMixer.
|
inlinevirtual |
Get the saturation status.
Reimplemented in MultirotorMixer.
|
inlinevirtual |
Get trim offset for this mixer.
Reimplemented in MultirotorMixer, SimpleMixer, HelicopterMixer, and NullMixer.
|
inlinevirtual |
Analyses the mix configuration and updates a bitmask of groups that are required.
groups | A bitmask of groups (0-31) that the mixer requires. |
Reimplemented in MultirotorMixer, SimpleMixer, and HelicopterMixer.
|
pure virtual |
Perform the mixing function.
outputs | Array into which mixed output(s) should be placed. |
space | The number of available entries in the output array; |
Implemented in MultirotorMixer, SimpleMixer, HelicopterMixer, and NullMixer.
Referenced by Mixer().
|
inlinevirtual |
Set airmode.
Airmode allows the mixer to increase the total thrust in order to unsaturate the motors.
[in] | airmode | Select airmode type (0 = disabled, 1 = roll/pitch, 2 = roll/pitch/yaw) |
Reimplemented in MultirotorMixer.
|
inlinevirtual |
Empty method, only implemented for MultirotorMixer and MixerGroup class.
[in] | delta_out_max | Maximum delta output. |
Reimplemented in MultirotorMixer.
|
inlinevirtual |
Reimplemented in MultirotorMixer.
|
inlinevirtual |
Set trim offset for this mixer.
Reimplemented in MultirotorMixer, SimpleMixer, HelicopterMixer, and NullMixer.
|
staticprotected |
Skip a line.
buf | The buffer to operate on. |
buflen | length of the buffer. |
Definition at line 90 of file Mixer.cpp.
Referenced by HelicopterMixer::from_text(), SimpleMixer::from_text(), MultirotorMixer::from_text(), SimpleMixer::parse_control_scaler(), and SimpleMixer::parse_output_scaler().
|
staticprotected |
Check wether the string is well formed and suitable for parsing.
Definition at line 105 of file Mixer.cpp.
References debug.
Referenced by NullMixer::from_text(), HelicopterMixer::from_text(), SimpleMixer::from_text(), and MultirotorMixer::from_text().
|
protected |
Definition at line 236 of file Mixer.hpp.
Referenced by SimpleMixer::check(), get_control(), and SimpleMixer::mix().
|
protected |
client-supplied callback used when fetching control values
Definition at line 235 of file Mixer.hpp.
Referenced by SimpleMixer::check(), get_control(), and SimpleMixer::mix().