dRonin  adbada4
dRonin firmware
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
TxPID Module

Files

file  txpid.c
 Optional module to tune PID settings using R/C transmitter.
 

Data Structures

struct  txpid_struct
 

Macros

#define SAMPLE_PERIOD_MS   200
 
#define TELEMETRY_UPDATE_PERIOD_MS   0
 

Functions

static void updatePIDs (const UAVObjEvent *ev, void *ctx, void *obj, int len)
 
static bool update (float *var, float val)
 
static float scale (float val, float inMin, float inMax, float outMin, float outMax)
 
int32_t TxPIDInitialize (void)
 
static int32_t TxPIDStart (void)
 
 MODULE_INITCALL (TxPIDInitialize, TxPIDStart)
 

Variables

static struct txpid_structtxpid_data
 
uint8_t update
 

Detailed Description

Macro Definition Documentation

#define SAMPLE_PERIOD_MS   200

Output object: StabilizationSettings

This module will periodically update values of stabilization PID settings depending on configured input control channels. New values of stabilization settings are not saved to flash, but updated in RAM. It is expected that the module will be enabled only for tuning. When desired values are found, they can be read via GCS and saved permanently. Then this module should be disabled again.

UAVObjects are automatically generated by the UAVObjectGenerator from the object definition XML file.

Definition at line 65 of file txpid.c.

#define TELEMETRY_UPDATE_PERIOD_MS   0

Definition at line 66 of file txpid.c.

Function Documentation

MODULE_INITCALL ( TxPIDInitialize  ,
TxPIDStart   
)
static float scale ( float  val,
float  inMin,
float  inMax,
float  outMin,
float  outMax 
)
static

Scales input val from [inMin..inMax] range to [outMin..outMax]. If val is out of input range (inMin <= inMax), it will be bound. (outMin > outMax) is ok, in that case output will be decreasing.

Returns
scaled value

Definition at line 444 of file txpid.c.

int32_t TxPIDInitialize ( void  )

Initialise the module, called on startup

Returns
0 on success or -1 if initialisation failed

Definition at line 100 of file txpid.c.

static int32_t TxPIDStart ( void  )
static

Module start routine automatically called after initialization routine

Returns
0 when was successful

Definition at line 141 of file txpid.c.

static bool update ( float *  var,
float  val 
)
static

Updates var using val if needed.

Returns
1 if updated, 0 otherwise

Definition at line 471 of file txpid.c.

static void updatePIDs ( const UAVObjEvent ev,
void *  ctx,
void *  obj,
int  len 
)
static

Update PIDs callback function

Definition at line 176 of file txpid.c.

Variable Documentation

struct txpid_struct* txpid_data
static

Definition at line 88 of file txpid.c.

static bool update

Updates var using val if needed.

Returns
1 if updated, 0 otherwise

Definition at line 98 of file msp_messages.h.