NinjaFlight
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
rc_command.h File Reference
Include dependency graph for rc_command.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  rc_command
 RC commands state. Inputs are raw commands in range [1000-2000]. Outputs are RC commands in range [-500;500] after applying expo and other parameters. More...
 

Macros

#define PITCH_LOOKUP_LENGTH   7
 compile time configuration of the pitch/roll lookup table More...
 
#define YAW_LOOKUP_LENGTH   7
 compile time configuration of the yaw lookup table More...
 
#define THROTTLE_LOOKUP_LENGTH   12
 compile time configuration of the throttle lookup table More...
 

Functions

void rc_command_init (struct rc_command *self, struct rx *rx)
 Initializes the curves with default linear ranges. More...
 
void rc_command_set_rate_config (struct rc_command *self, const struct rate_profile *rates)
 Updates internal variables to use new rates and also recalculates the lookup tables if the supplied profile is different than the one that is currently being used. More...
 
void rc_command_update (struct rc_command *self)
 Updates current rc rates from the current rc values. Inputs are in range [1000;2000] and should correspond to raw pwm values from rc receiver. More...
 
int16_t rc_command_axis (struct rc_command *self, uint8_t stick)
 Get current stick value in range [-500;500], stick is only ROLL, PITCH, YAw. More...
 

Macro Definition Documentation

#define PITCH_LOOKUP_LENGTH   7

compile time configuration of the pitch/roll lookup table

Flight Library

The main responsibility of this class is to process raw rc commands and translate them into values that are to be passed as commands to the flight controller. This process involves applying expo and ensuring valid limits on the output values.

#define THROTTLE_LOOKUP_LENGTH   12

compile time configuration of the throttle lookup table

#define YAW_LOOKUP_LENGTH   7

compile time configuration of the yaw lookup table

Function Documentation

int16_t rc_command_axis ( struct rc_command self,
uint8_t  stick 
)

Get current stick value in range [-500;500], stick is only ROLL, PITCH, YAw.

void rc_command_init ( struct rc_command self,
struct rx rx 
)

Initializes the curves with default linear ranges.

void rc_command_set_rate_config ( struct rc_command self,
const struct rate_profile rates 
)

Updates internal variables to use new rates and also recalculates the lookup tables if the supplied profile is different than the one that is currently being used.

void rc_command_update ( struct rc_command self)

Updates current rc rates from the current rc values. Inputs are in range [1000;2000] and should correspond to raw pwm values from rc receiver.

Here is the call graph for this function: