Paparazzi UAS v7.1_unstable
Paparazzi is a free software Unmanned Aircraft System.
Loading...
Searching...
No Matches
target_pos.c File Reference
#include "target_pos.h"
#include <math.h>
#include "modules/datalink/telemetry.h"
#include "modules/core/abi.h"
#include "state.h"
Include dependency graph for target_pos.c:

Go to the source code of this file.

Macros

#define TARGET_POS_TIMEOUT   5000
#define TARGET_RTK_TIMEOUT   1000
#define TARGET_OFFSET_HEADING   180.0
#define TARGET_OFFSET_DISTANCE   12.0
#define TARGET_OFFSET_HEIGHT   -1.2
#define TARGET_INTEGRATE_XY   true
#define TARGET_INTEGRATE_Z   false

Functions

static void gps_cb (uint8_t sender_id, uint32_t stamp, struct GpsState *gps_s)
static void send_target_pos_info (struct transport_tx *trans, struct link_device *dev)
void target_pos_init (void)
void target_parse_target_pos (uint8_t *buf)
 Receive a TARGET_POS message from the ground.
bool target_get_pos (struct NedCoor_f *pos, float *heading)
 Get the current target position (NED) and heading.
bool target_get_vel (struct NedCoor_f *vel)
 Get the current target velocity (NED).
bool target_pos_set_current_offset (float unk)
 Set the current measured distance and heading as offset.

Variables

struct target_t target
static abi_event gps_ev

Detailed Description

Author
Freek van Tienen freek.nosp@m..v.t.nosp@m.ienen.nosp@m.@gma.nosp@m.il.co.nosp@m.m Control a rotorcraft to follow at a defined distance from the target

Definition in file target_pos.c.

Macro Definition Documentation

◆ TARGET_INTEGRATE_XY

#define TARGET_INTEGRATE_XY   true

Definition at line 57 of file target_pos.c.

◆ TARGET_INTEGRATE_Z

#define TARGET_INTEGRATE_Z   false

Definition at line 61 of file target_pos.c.

◆ TARGET_OFFSET_DISTANCE

#define TARGET_OFFSET_DISTANCE   12.0

Definition at line 49 of file target_pos.c.

◆ TARGET_OFFSET_HEADING

#define TARGET_OFFSET_HEADING   180.0

Definition at line 45 of file target_pos.c.

◆ TARGET_OFFSET_HEIGHT

#define TARGET_OFFSET_HEIGHT   -1.2

Definition at line 53 of file target_pos.c.

◆ TARGET_POS_TIMEOUT

#define TARGET_POS_TIMEOUT   5000

Definition at line 36 of file target_pos.c.

◆ TARGET_RTK_TIMEOUT

#define TARGET_RTK_TIMEOUT   1000

Definition at line 41 of file target_pos.c.

Function Documentation

◆ gps_cb()

void gps_cb ( uint8_t sender_id,
uint32_t stamp ,
struct GpsState * gps_s )
static

Definition at line 110 of file target_pos.c.

References LlaCoor_i::alt, LlaCoor_i::lat, GpsState::lla_pos, LlaCoor_i::lon, and target.

◆ send_target_pos_info()

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

Definition at line 84 of file target_pos.c.

References dev, and target.

Referenced by target_pos_init().

Here is the caller graph for this function:

◆ target_get_pos()

bool target_get_pos ( struct NedCoor_f * pos,
float * heading )

Get the current target position (NED) and heading.

Definition at line 143 of file target_pos.c.

References get_sys_time_msec(), heading, ned_of_lla_point_i(), state, stateGetNedOrigin_i(), target, target_get_vel(), NedCoor_f::x, NedCoor_i::x, NedCoor_f::y, NedCoor_i::y, NedCoor_f::z, and NedCoor_i::z.

Referenced by follow_diagonal_approach().

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

◆ target_get_vel()

bool target_get_vel ( struct NedCoor_f * vel)

Get the current target velocity (NED).

Definition at line 192 of file target_pos.c.

References get_sys_time_msec(), state, target, NedCoor_f::x, NedCoor_f::y, and NedCoor_f::z.

Referenced by follow_diagonal_approach(), and target_get_pos().

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

◆ target_parse_target_pos()

void target_parse_target_pos ( uint8_t * buf)

Receive a TARGET_POS message from the ground.

Definition at line 122 of file target_pos.c.

References get_sys_time_msec(), gps_tow_from_sys_ticks(), sys_time::nb_tick, and target.

Here is the call graph for this function:

◆ target_pos_init()

void target_pos_init ( void )

Definition at line 100 of file target_pos.c.

References ABI_BROADCAST, DefaultPeriodic, gps_cb(), gps_ev, register_periodic_telemetry(), and send_target_pos_info().

Here is the call graph for this function:

◆ target_pos_set_current_offset()

bool target_pos_set_current_offset ( float unk)

Set the current measured distance and heading as offset.

Definition at line 210 of file target_pos.c.

References get_sys_time_msec(), ned_of_lla_point_i(), state, stateGetNedOrigin_i(), stateGetPositionNed_f(), target, NedCoor_f::x, NedCoor_i::x, NedCoor_f::y, NedCoor_i::y, NedCoor_f::z, and NedCoor_i::z.

Here is the call graph for this function:

Variable Documentation

◆ gps_ev

abi_event gps_ev
static

Definition at line 79 of file target_pos.c.

◆ target