dRonin
adbada4
dRonin firmware
|
Actuator module. Drives the actuators (servos, motors etc). More...
#include <math.h>
#include "openpilot.h"
#include "actuatorsettings.h"
#include "systemsettings.h"
#include "actuatordesired.h"
#include "actuatorcommand.h"
#include "flightstatus.h"
#include "mixersettings.h"
#include "cameradesired.h"
#include "manualcontrolcommand.h"
#include "pios_thread.h"
#include "pios_queue.h"
#include "misc_math.h"
Go to the source code of this file.
Data Structures | |
struct | dshot_command |
Macros | |
#define | MAX_QUEUE_SIZE 2 |
#define | STACK_SIZE_BYTES 1336 |
#define | TASK_PRIORITY PIOS_THREAD_PRIO_HIGHEST |
#define | FAILSAFE_TIMEOUT_MS 100 |
#define | MAX_MIX_ACTUATORS ACTUATORCOMMAND_CHANNEL_NUMELEM |
#define | MIXER_SCALE 128 |
#define | ACTUATOR_EPSILON 0.00001f |
#define | DSHOT_COMMAND_DONTSPIN 0 |
#define | DSHOT_COMMAND_NO3DMODE 9 |
#define | DSHOT_COMMAND_3DMODE 10 |
#define | DSHOT_COUNT_EXCESSIVE 24 |
#define | compute_one_token_paste(b) compute_one_mixer(b-1, &mixerSettings.Mixer ## b ## Vector, mixerSettings.Mixer ## b ## Type, scale_adjustment) |
#define | DSHOT_DEADBAND_NORMAL 0 |
#define | DSHOT_DEADBAND_3D 1 |
#define | DSHOT_DEADBAND_3DREV 2 |
Functions | |
DONT_BUILD_IF (ACTUATORSETTINGS_TIMERUPDATEFREQ_NUMELEM > PIOS_SERVO_MAX_BANKS, TooManyServoBanks) | |
DONT_BUILD_IF (MAX_MIX_ACTUATORS > ACTUATORCOMMAND_CHANNEL_NUMELEM, TooManyMixers) | |
DONT_BUILD_IF ((MIXERSETTINGS_MIXER1VECTOR_NUMELEM-MIXERSETTINGS_MIXER1VECTOR_ACCESSORY0)< MANUALCONTROLCOMMAND_ACCESSORY_NUMELEM, AccessoryMismatch) | |
static void | actuator_task (void *parameters) |
Main Actuator module task. More... | |
static float | scale_channel (float value, int idx, bool active_cmd) |
static void | set_failsafe () |
static float | collective_curve (const float input, const float *curve, uint8_t num_points) |
static bool | actuator_get_dshot_command (bool armed) |
int | actuator_send_dshot_command (uint8_t cmd_id, uint8_t num_to_send, uint16_t channel_mask) |
static int | actuator_send_dshot_command_now (uint8_t cmd_id, uint8_t num_to_send, uint16_t channel_mask) |
int32_t | ActuatorStart () |
Module initialization. More... | |
int32_t | ActuatorInitialize () |
Module initialization. More... | |
MODULE_HIPRI_INITCALL (ActuatorInitialize, ActuatorStart) | |
static float | get_curve2_source (ActuatorDesiredData *desired, SystemSettingsAirframeTypeOptions airframe_type, MixerSettingsCurve2SourceOptions source, float throttle_val) |
static void | compute_one_mixer (int mixnum, int16_t(*vals)[MIXERSETTINGS_MIXER1VECTOR_NUMELEM], MixerSettingsMixer1TypeOptions type, float scale_adjustment) |
static void | compute_mixer () |
static void | fill_desired_vector (ActuatorDesiredData *desired, float val1, float val2, float(*cmd_vector)[MIXERSETTINGS_MIXER1VECTOR_NUMELEM]) |
static void | post_process_scale_and_commit (float *motor_vect, float *desired_vect, float dT, bool armed, bool spin_while_armed, bool stabilize_now, bool flip_over_mode, float *maxpoweradd_bucket) |
static void | normalize_input_data (uint32_t this_systime, float(*desired_vect)[MIXERSETTINGS_MIXER1VECTOR_NUMELEM], bool *armed, bool *spin_while_armed, bool *stabilize_now, bool *flip_over_mode) |
static void | actuator_settings_update () |
static float | scale_channel_dshot (float value, int idx, bool active_command) |
static float | channel_failsafe_value (int idx) |
Variables | |
static struct pios_queue * | queue |
static struct pios_thread * | taskHandle |
static float | hangtime_leakybucket_timeconstant = 0.3f |
static volatile bool | flight_status_updated = true |
static volatile bool | manual_control_cmd_updated = true |
static volatile bool | settings_updated = true |
static MixerSettingsMixer1TypeOptions | types_mixer [MAX_MIX_ACTUATORS] |
static float | motor_mixer [MAX_MIX_ACTUATORS *MIXERSETTINGS_MIXER1VECTOR_NUMELEM] |
static ActuatorSettingsData | actuatorSettings |
static SystemSettingsAirframeTypeOptions | airframe_type |
static float | curve2 [MIXERSETTINGS_THROTTLECURVE2_NUMELEM] |
static MixerSettingsCurve2SourceOptions | curve2_src |
enum actuator_interlock | actuator_interlock = ACTUATOR_INTERLOCK_OK |
struct dshot_command | __attribute__ |
static volatile struct dshot_command | pending_cmd |
static struct dshot_command | cur_cmd |
static uint16_t | desired_3d_mask |
Actuator module. Drives the actuators (servos, motors etc).
This module ultimately controls the outputs. The values from ActuatorDesired are combined based on the values in MixerSettings and then scaled by the values in ActuatorSettings to create the output PWM times.
Definition in file actuator.c.
#define DSHOT_DEADBAND_3D 1 |
#define DSHOT_DEADBAND_3DREV 2 |
#define DSHOT_DEADBAND_NORMAL 0 |