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

mission navigation for fixedwing aircraft More...

#include <stdio.h>
#include "modules/mission/mission_common.h"
#include "autopilot.h"
#include "firmwares/fixedwing/nav.h"
#include "modules/nav/common_nav.h"
#include "generated/flight_plan.h"
+ Include dependency graph for mission_fw_nav.c:

Go to the source code of this file.

Macros

#define MISSION_WAIT_TIMEOUT   120
 Implement waiting pattern Only called when MISSION_WAIT_TIMEOUT is not 0. More...
 

Functions

bool mission_point_of_lla (struct EnuCoor_f *point, struct LlaCoor_i *lla)
 Utility function: converts lla (int) to local point (float) More...
 
static bool mission_nav_wp (struct _mission_wp *wp)
 Navigation function to a single waypoint. More...
 
static bool mission_nav_circle (struct _mission_circle *circle)
 Navigation function on a circle. More...
 
static bool mission_nav_segment (struct _mission_segment *segment)
 Navigation function along a segment. More...
 
static bool mission_nav_path (struct _mission_path *path)
 Navigation function along a path. More...
 
static bool mission_nav_custom (struct _mission_custom *custom, bool init)
 Call custom navigation function. More...
 
static bool mission_wait_pattern (void)
 
int mission_run ()
 Run mission. More...
 

Variables

static const float dt_navigation = 1.0f / ((float)NAVIGATION_FREQUENCY)
 
struct EnuCoor_f last_wp_f = { 0.f, 0.f, 0.f }
 
static bool mission_wait_started = false
 
static float mission_wait_time = 0.f
 
static struct _mission_circle mission_wait_circle
 

Detailed Description

mission navigation for fixedwing aircraft

Implement specific navigation routines for the mission control of a fixedwing aircraft

Definition in file mission_fw_nav.c.

Macro Definition Documentation

◆ MISSION_WAIT_TIMEOUT

#define MISSION_WAIT_TIMEOUT   120

Implement waiting pattern Only called when MISSION_WAIT_TIMEOUT is not 0.

Definition at line 167 of file mission_fw_nav.c.

Function Documentation

◆ mission_nav_circle()

static bool mission_nav_circle ( struct _mission_circle circle)
inlinestatic

Navigation function on a circle.

Definition at line 93 of file mission_fw_nav.c.

References _mission_circle::center, nav_circle_XY(), NavVerticalAltitudeMode, NavVerticalAutoThrottleMode, _mission_circle::radius, EnuCoor_f::x, EnuCoor_f::y, and EnuCoor_f::z.

Referenced by mission_run(), and mission_wait_pattern().

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

◆ mission_nav_custom()

static bool mission_nav_custom ( struct _mission_custom custom,
bool  init 
)
inlinestatic

Call custom navigation function.

Definition at line 154 of file mission_fw_nav.c.

References _mission_registered::cb, init, MissionInit, MissionRun, _mission_custom::nb, _mission_custom::params, and _mission_custom::reg.

Referenced by mission_run().

+ Here is the caller graph for this function:

◆ mission_nav_path()

static bool mission_nav_path ( struct _mission_path path)
inlinestatic

Navigation function along a path.

Definition at line 121 of file mission_fw_nav.c.

References CARROT, last_wp_f, mission_nav_wp(), nav_approaching_xy(), nav_route_xy(), NavVerticalAltitudeMode, NavVerticalAutoThrottleMode, _mission_path::nb, _mission_path::path, _mission_path::path_idx, stateGetPositionEnu_f(), _mission_wp::wp, EnuCoor_f::x, EnuCoor_f::y, and EnuCoor_f::z.

Referenced by mission_run().

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

◆ mission_nav_segment()

static bool mission_nav_segment ( struct _mission_segment segment)
inlinestatic

Navigation function along a segment.

Definition at line 103 of file mission_fw_nav.c.

References CARROT, _mission_segment::from, last_wp_f, nav_approaching_xy(), nav_route_xy(), NavVerticalAltitudeMode, NavVerticalAutoThrottleMode, stateGetPositionEnu_f(), _mission_segment::to, EnuCoor_f::x, EnuCoor_f::y, and EnuCoor_f::z.

Referenced by mission_run().

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

◆ mission_nav_wp()

static bool mission_nav_wp ( struct _mission_wp wp)
inlinestatic

Navigation function to a single waypoint.

Definition at line 74 of file mission_fw_nav.c.

References CARROT, fly_to_xy(), last_wp_f, nav_approaching_xy(), NavVerticalAltitudeMode, NavVerticalAutoThrottleMode, stateGetPositionEnu_f(), _mission_wp::wp, EnuCoor_f::x, EnuCoor_f::y, and EnuCoor_f::z.

Referenced by mission_nav_path(), and mission_run().

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

◆ mission_point_of_lla()

bool mission_point_of_lla ( struct EnuCoor_f point,
struct LlaCoor_i lla 
)

Utility function: converts lla (int) to local point (float)

Get the ENU component of LLA mission point This function is firmware specific.

TODO: don't convert to float, either use double or do completely in fixed point

Definition at line 38 of file mission_fw_nav.c.

◆ mission_run()

int mission_run ( void  )

Run mission.

This function should be implemented into a dedicated file since navigation functions are different for different firmwares

Currently, this function should be called from the flight plan

Returns
return TRUE when the mission is running, FALSE when it is finished

Definition at line 192 of file mission_fw_nav.c.

◆ mission_wait_pattern()

static bool mission_wait_pattern ( void  )
static

Definition at line 174 of file mission_fw_nav.c.

References _mission_circle::center, DEFAULT_CIRCLE_RADIUS, dt_navigation, GetAltRef, mission_nav_circle(), mission_wait_circle, mission_wait_started, mission_wait_time, MISSION_WAIT_TIMEOUT, _mission_circle::radius, stateGetPositionEnu_f(), and EnuCoor_f::z.

Referenced by mission_run().

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

Variable Documentation

◆ dt_navigation

const float dt_navigation = 1.0f / ((float)NAVIGATION_FREQUENCY)
static

Definition at line 67 of file mission_fw_nav.c.

Referenced by mission_run(), and mission_wait_pattern().

◆ last_wp_f

struct EnuCoor_f last_wp_f = { 0.f, 0.f, 0.f }

Definition at line 67 of file mission_fw_nav.c.

Referenced by mission_nav_path(), mission_nav_segment(), and mission_nav_wp().

◆ mission_wait_circle

struct _mission_circle mission_wait_circle
static

Definition at line 172 of file mission_fw_nav.c.

Referenced by mission_wait_pattern().

◆ mission_wait_started

bool mission_wait_started = false
static

Definition at line 170 of file mission_fw_nav.c.

Referenced by mission_run(), and mission_wait_pattern().

◆ mission_wait_time

float mission_wait_time = 0.f
static

Definition at line 172 of file mission_fw_nav.c.

Referenced by mission_wait_pattern().