Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
autopilot_firmware.c File Reference

Fixedwing specific autopilot interface and initialization. More...

#include "firmwares/fixedwing/autopilot_firmware.h"
#include "state.h"
#include "firmwares/fixedwing/nav.h"
#include <stdint.h>
#include "modules/energy/electrical.h"
#include "modules/datalink/telemetry.h"
#include "generated/settings.h"
#include "firmwares/fixedwing/stabilization/stabilization_attitude.h"
#include <CTRL_TYPE_H>
#include "modules/radio_control/radio_control.h"
#include "generated/flight_plan.h"
#include "generated/airframe.h"
+ Include dependency graph for autopilot_firmware.c:

Go to the source code of this file.

Macros

#define CATASTROPHIC_BAT_KILL_DELAY   5
 Maximum time allowed for catastrophic battery level before going into kill mode. More...
 
#define KILL_MODE_DISTANCE   (1.5*MAX_DIST_FROM_HOME)
 Maximum distance from HOME waypoint before going into kill mode. More...
 
#define MIN_SPEED_FOR_TAKEOFF   5.
 Default minimal speed for takeoff in m/s. More...
 

Functions

static void send_mode (struct transport_tx *trans, struct link_device *dev)
 
static void send_estimator (struct transport_tx *trans, struct link_device *dev)
 
static void send_energy (struct transport_tx *trans, struct link_device *dev)
 
static void send_desired (struct transport_tx *trans, struct link_device *dev)
 
static void send_airspeed (struct transport_tx *trans, struct link_device *dev)
 
static void send_fbw_status (struct transport_tx *trans, struct link_device *dev)
 
void autopilot_send_mode (void)
 Report autopilot mode on default downlink channel. More...
 
void autopilot_firmware_init (void)
 Init function. More...
 
void monitor_task (void)
 monitor stuff run at 1Hz More...
 

Variables

uint8_t lateral_mode
 
uint8_t rc_settings_mode = 0
 

Detailed Description

Fixedwing specific autopilot interface and initialization.

Definition in file autopilot_firmware.c.

Macro Definition Documentation

◆ CATASTROPHIC_BAT_KILL_DELAY

#define CATASTROPHIC_BAT_KILL_DELAY   5

Maximum time allowed for catastrophic battery level before going into kill mode.

Definition at line 185 of file autopilot_firmware.c.

◆ KILL_MODE_DISTANCE

#define KILL_MODE_DISTANCE   (1.5*MAX_DIST_FROM_HOME)

Maximum distance from HOME waypoint before going into kill mode.

Definition at line 190 of file autopilot_firmware.c.

◆ MIN_SPEED_FOR_TAKEOFF

#define MIN_SPEED_FOR_TAKEOFF   5.

Default minimal speed for takeoff in m/s.

Definition at line 195 of file autopilot_firmware.c.

Function Documentation

◆ autopilot_firmware_init()

void autopilot_firmware_init ( void  )

Init function.

Definition at line 157 of file autopilot_firmware.c.

References DefaultPeriodic, register_periodic_telemetry(), send_airspeed(), send_desired(), send_energy(), send_estimator(), send_fbw_status(), and send_mode().

Referenced by autopilot_init().

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

◆ autopilot_send_mode()

void autopilot_send_mode ( void  )

Report autopilot mode on default downlink channel.

Report autopilot mode on default downlink channel.

Definition at line 149 of file autopilot_firmware.c.

References DefaultChannel, DefaultDevice, and send_mode().

+ Here is the call graph for this function:

◆ monitor_task()

void monitor_task ( void  )

◆ send_airspeed()

static void send_airspeed ( struct transport_tx *  trans,
struct link_device *  dev 
)
static

Definition at line 112 of file autopilot_firmware.c.

References dev, stateGetAirspeed_f(), v_ctl_auto_airspeed_controlled, v_ctl_auto_airspeed_setpoint, and v_ctl_auto_groundspeed_setpoint.

Referenced by autopilot_firmware_init().

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

◆ send_desired()

static void send_desired ( struct transport_tx *  trans,
struct link_device *  dev 
)
static

◆ send_energy()

static void send_energy ( struct transport_tx *  trans,
struct link_device *  dev 
)
static

◆ send_estimator()

static void send_estimator ( struct transport_tx *  trans,
struct link_device *  dev 
)
static

Definition at line 79 of file autopilot_firmware.c.

References dev, stateGetPositionUtm_f(), and stateGetSpeedEnu_f().

Referenced by autopilot_firmware_init().

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

◆ send_fbw_status()

static void send_fbw_status ( struct transport_tx *  trans,
struct link_device *  dev 
)
static

Definition at line 128 of file autopilot_firmware.c.

References AP_MODE_MANUAL, autopilot_get_mode(), Electrical::current, dev, electrical, fbw_mode, RadioControl::frame_rate, radio_control, RadioControl::status, and Electrical::vsupply.

Referenced by autopilot_firmware_init().

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

◆ send_mode()

static void send_mode ( struct transport_tx *  trans,
struct link_device *  dev 
)
static

Old FBW status

  • bit 0: RC OK
  • bit 1: RC REALLY LOST
  • bit 2: FBW AUTO
  • bit 3: FBW FAILSAFE
  • bit 4: RC averaged channels sent

Definition at line 56 of file autopilot_firmware.c.

References AP_MODE_MANUAL, autopilot, autopilot_get_mode(), dev, horizontal_mode, lateral_mode, pprz_autopilot::mode, radio_control, RC_OK, RC_REALLY_LOST, rc_settings_mode, RadioControl::status, and v_ctl_mode.

Referenced by autopilot_firmware_init(), and autopilot_send_mode().

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

Variable Documentation

◆ lateral_mode

◆ rc_settings_mode

uint8_t rc_settings_mode = 0

Definition at line 53 of file autopilot_firmware.c.

Referenced by send_mode().