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

UAVCAN mixing class. More...

#include <uavcan_main.hpp>

Inheritance diagram for UavcanMixingInterface:
Collaboration diagram for UavcanMixingInterface:

Public Member Functions

 UavcanMixingInterface (pthread_mutex_t &node_mutex, UavcanEscController &esc_controller)
 
bool updateOutputs (bool stop_motors, uint16_t outputs[MAX_ACTUATORS], unsigned num_outputs, unsigned num_control_groups_updated) override
 Callback to update the (physical) actuator outputs in the driver. More...
 
void mixerChanged () override
 called whenever the mixer gets updated/reset More...
 
MixingOutputmixingOutput ()
 
- Public Member Functions inherited from OutputModuleInterface
 OutputModuleInterface (const char *name, const px4::wq_config_t &config)
 

Protected Member Functions

void Run () override
 

Private Attributes

pthread_mutex_t & _node_mutex
 
UavcanEscController_esc_controller
 
MixingOutput _mixing_output {MAX_ACTUATORS, *this, MixingOutput::SchedulingPolicy::Auto, false, false}
 

Friends

class UavcanNode
 

Additional Inherited Members

- Static Public Attributes inherited from OutputModuleInterface
static constexpr int MAX_ACTUATORS = PWM_OUTPUT_MAX_CHANNELS
 

Detailed Description

UAVCAN mixing class.

It is separate from UavcanNode to have 2 WorkItems and therefore allowing independent scheduling (I.e. UavcanMixingInterface runs upon actuator_control updates, whereas UavcanNode runs at a fixed rate or upon bus updates). Both work items are expected to run on the same work queue.

Definition at line 80 of file uavcan_main.hpp.

Constructor & Destructor Documentation

◆ UavcanMixingInterface()

UavcanMixingInterface::UavcanMixingInterface ( pthread_mutex_t &  node_mutex,
UavcanEscController esc_controller 
)
inline

Definition at line 83 of file uavcan_main.hpp.

References OutputModuleInterface::MAX_ACTUATORS, mixerChanged(), and updateOutputs().

Here is the call graph for this function:

Member Function Documentation

◆ mixerChanged()

void UavcanMixingInterface::mixerChanged ( )
overridevirtual

called whenever the mixer gets updated/reset

Reimplemented from OutputModuleInterface.

Definition at line 900 of file uavcan_main.cpp.

References UavcanNode::_esc_controller, and UavcanEscController::set_rotor_count().

Referenced by UavcanMixingInterface().

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

◆ mixingOutput()

MixingOutput& UavcanMixingInterface::mixingOutput ( )
inline

Definition at line 93 of file uavcan_main.hpp.

References _mixing_output, and Run().

Referenced by UavcanNode::enable_idle_throttle_when_armed(), UavcanNode::init(), UavcanNode::ioctl(), UavcanNode::print_info(), and UavcanNode::Run().

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

◆ Run()

void UavcanMixingInterface::Run ( )
overrideprotected

Definition at line 892 of file uavcan_main.cpp.

References UavcanNode::_node_mutex.

Referenced by UavcanNode::attachITxQueueInjector(), and mixingOutput().

Here is the caller graph for this function:

◆ updateOutputs()

bool UavcanMixingInterface::updateOutputs ( bool  stop_motors,
uint16_t  outputs[MAX_ACTUATORS],
unsigned  num_outputs,
unsigned  num_control_groups_updated 
)
overridevirtual

Callback to update the (physical) actuator outputs in the driver.

Parameters
stop_motorsif true, all motors must be stopped (if false, individual motors might still be stopped via outputs[i] == disarmed_value)
outputsindividual actuator outputs in range [min, max] or failsafe/disarmed value
num_outputsnumber of outputs (<= max_num_outputs)
num_control_groups_updatednumber of actuator_control groups updated
Returns
if true, the update got handled, and actuator_outputs can be published

Implements OutputModuleInterface.

Definition at line 885 of file uavcan_main.cpp.

References UavcanNode::_esc_controller, and UavcanEscController::update_outputs().

Referenced by UavcanMixingInterface().

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

Friends And Related Function Documentation

◆ UavcanNode

friend class UavcanNode
friend

Definition at line 98 of file uavcan_main.hpp.

Member Data Documentation

◆ _esc_controller

UavcanEscController& UavcanMixingInterface::_esc_controller
private

Definition at line 100 of file uavcan_main.hpp.

◆ _mixing_output

MixingOutput UavcanMixingInterface::_mixing_output {MAX_ACTUATORS, *this, MixingOutput::SchedulingPolicy::Auto, false, false}
private

Definition at line 101 of file uavcan_main.hpp.

Referenced by mixingOutput().

◆ _node_mutex

pthread_mutex_t& UavcanMixingInterface::_node_mutex
private

Definition at line 99 of file uavcan_main.hpp.


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