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

Generic helicopter mixer for helicopters with swash plate. More...

#include <HelicopterMixer.hpp>

Inheritance diagram for HelicopterMixer:
Collaboration diagram for HelicopterMixer:

Public Member Functions

 HelicopterMixer (ControlCallback control_cb, uintptr_t cb_handle, mixer_heli_s mixer_info)
 Constructor. More...
 
virtual ~HelicopterMixer ()=default
 
 HelicopterMixer (const HelicopterMixer &)=delete
 
HelicopterMixeroperator= (const HelicopterMixer &)=delete
 
 HelicopterMixer (HelicopterMixer &&)=delete
 
HelicopterMixeroperator= (HelicopterMixer &&)=delete
 
unsigned mix (float *outputs, unsigned space) override
 Perform the mixing function. More...
 
void groups_required (uint32_t &groups) override
 Analyses the mix configuration and updates a bitmask of groups that are required. More...
 
unsigned set_trim (float trim) override
 Set trim offset for this mixer. More...
 
unsigned get_trim (float *trim) override
 Get trim offset for this mixer. More...
 
- Public Member Functions inherited from Mixer
 Mixer (ControlCallback control_cb, uintptr_t cb_handle)
 Constructor. More...
 
virtual ~Mixer ()=default
 
 Mixer (const Mixer &)=delete
 
Mixeroperator= (const Mixer &)=delete
 
 Mixer (Mixer &&)=delete
 
Mixeroperator= (Mixer &&)=delete
 
virtual uint16_t get_saturation_status ()
 Get the saturation status. More...
 
virtual void set_max_delta_out_once (float delta_out_max)
 Empty method, only implemented for MultirotorMixer and MixerGroup class. 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 MixergetSibling () const
 

Static Public Member Functions

static HelicopterMixerfrom_text (Mixer::ControlCallback control_cb, uintptr_t cb_handle, const char *buf, unsigned &buflen)
 Factory method. More...
 

Private Attributes

mixer_heli_s _mixer_info
 

Additional Inherited Members

- Public Types inherited from Mixer
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...
 
- Protected Member Functions inherited from Mixer
float get_control (uint8_t group, uint8_t index)
 Invoke the client callback to fetch a control value. More...
 
- Static Protected Member Functions inherited from Mixer
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 inherited from Mixer
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
 

Detailed Description

Generic helicopter mixer for helicopters with swash plate.

Collects four inputs (roll, pitch, yaw, thrust) and mixes them to servo commands for swash plate tilting and throttle- and pitch curves.

Definition at line 64 of file HelicopterMixer.hpp.

Constructor & Destructor Documentation

◆ HelicopterMixer() [1/3]

HelicopterMixer::HelicopterMixer ( ControlCallback  control_cb,
uintptr_t  cb_handle,
mixer_heli_s  mixer_info 
)

Constructor.

Parameters
control_cbCallback invoked to read inputs.
cb_handlePassed to control_cb.
mixer_infoPointer to heli mixer configuration

Definition at line 53 of file HelicopterMixer.cpp.

Referenced by from_text().

Here is the caller graph for this function:

◆ ~HelicopterMixer()

virtual HelicopterMixer::~HelicopterMixer ( )
virtualdefault

◆ HelicopterMixer() [2/3]

HelicopterMixer::HelicopterMixer ( const HelicopterMixer )
delete

◆ HelicopterMixer() [3/3]

HelicopterMixer::HelicopterMixer ( HelicopterMixer &&  )
delete

Member Function Documentation

◆ from_text()

HelicopterMixer * HelicopterMixer::from_text ( Mixer::ControlCallback  control_cb,
uintptr_t  cb_handle,
const char *  buf,
unsigned &  buflen 
)
static

Factory method.

Given a pointer to a buffer containing a text description of the mixer, returns a pointer to a new instance of the mixer.

Parameters
control_cbThe callback to invoke when fetching a control value.
cb_handleHandle passed to the control callback.
bufBuffer containing a text description of the mixer.
buflenLength of the buffer in bytes, adjusted to reflect the bytes consumed.
Returns
A new HelicopterMixer instance, or nullptr if the text format is bad.

Definition at line 60 of file HelicopterMixer.cpp.

References mixer_heli_servo_s::angle, mixer_heli_servo_s::arm_length, mixer_heli_s::control_count, debug, Mixer::findtag(), HELI_CURVES_NR_POINTS, HelicopterMixer(), M_PI_F, mixer_heli_servo_s::max_output, mixer_heli_servo_s::min_output, mixer_heli_servo_s::offset, mixer_heli_s::pitch_curve, mixer_heli_servo_s::scale, mixer_heli_s::servos, Mixer::skipline(), Mixer::string_well_formed(), and mixer_heli_s::throttle_curve.

Referenced by MixerGroup::load_from_buf().

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

◆ get_trim()

unsigned HelicopterMixer::get_trim ( float *  trim)
inlineoverridevirtual

Get trim offset for this mixer.

Returns
the number of outputs this mixer feeds to

Reimplemented from Mixer.

Definition at line 107 of file HelicopterMixer.hpp.

◆ groups_required()

void HelicopterMixer::groups_required ( uint32_t &  groups)
inlineoverridevirtual

Analyses the mix configuration and updates a bitmask of groups that are required.

Parameters
groupsA bitmask of groups (0-31) that the mixer requires.

Reimplemented from Mixer.

Definition at line 104 of file HelicopterMixer.hpp.

◆ mix()

unsigned HelicopterMixer::mix ( float *  outputs,
unsigned  space 
)
overridevirtual

Perform the mixing function.

Parameters
outputsArray into which mixed output(s) should be placed.
spaceThe number of available entries in the output array;
Returns
The number of entries in the output array that were populated.

Implements Mixer.

Definition at line 196 of file HelicopterMixer.cpp.

References _mixer_info, mixer_heli_servo_s::angle, mixer_heli_servo_s::arm_length, math::constrain(), mixer_heli_s::control_count, f(), Mixer::get_control(), HELI_CURVES_NR_POINTS, mixer_heli_servo_s::max_output, mixer_heli_servo_s::min_output, mixer_heli_servo_s::offset, mixer_heli_s::pitch_curve, mixer_heli_servo_s::scale, mixer_heli_s::servos, and mixer_heli_s::throttle_curve.

Here is the call graph for this function:

◆ operator=() [1/2]

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

◆ operator=() [2/2]

HelicopterMixer& HelicopterMixer::operator= ( HelicopterMixer &&  )
delete

◆ set_trim()

unsigned HelicopterMixer::set_trim ( float  trim)
inlineoverridevirtual

Set trim offset for this mixer.

Returns
the number of outputs this mixer feeds to

Reimplemented from Mixer.

Definition at line 106 of file HelicopterMixer.hpp.

Member Data Documentation

◆ _mixer_info

mixer_heli_s HelicopterMixer::_mixer_info
private

Definition at line 110 of file HelicopterMixer.hpp.

Referenced by mix().


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