Paparazzi UAS v7.1_unstable
Paparazzi is a free software Unmanned Aircraft System.
Loading...
Searching...
No Matches
guidance_v.c File Reference

Vertical guidance for rotorcrafts. More...

Include dependency graph for guidance_v.c:

Go to the source code of this file.

Macros

#define GUIDANCE_V_NOMINAL_HOVER_THROTTLE   0.4
#define GUIDANCE_V_CLIMB_RC_DEADBAND   MAX_PPRZ/10
#define GUIDANCE_V_MAX_RC_CLIMB_SPEED   GUIDANCE_V_REF_MIN_ZD
#define GUIDANCE_V_MAX_RC_DESCENT_SPEED   GUIDANCE_V_REF_MAX_ZD
#define GUIDANCE_V_GUIDED_MODE_ZHOLD   0
#define GUIDANCE_V_GUIDED_MODE_CLIMB   1
#define GUIDANCE_V_GUIDED_MODE_THROTTLE   2
#define GUIDANCE_V_GUIDED_MODE_ALL   3
#define GUIDANCE_V_RC_ID   ABI_BROADCAST

Functions

static void rc_cb (uint8_t sender_id UNUSED, struct RadioControl *rc)
static void send_tune_vert (struct transport_tx *trans, struct link_device *dev)
void guidance_v_init (void)
void guidance_v_mode_changed (uint8_t new_mode)
void guidance_v_notify_in_flight (bool in_flight)
static int32_t get_vertical_thrust_coeff (void)
 get the cosine of the angle between thrust vector and gravity vector
void guidance_v_thrust_adapt (bool in_flight)
struct ThrustSetpoint guidance_v_run (bool in_flight)
 Guidance vertical run functions.
void guidance_v_z_enter (void)
void guidance_v_set_ref (int32_t pos, int32_t speed, int32_t accel)
 Set guidance ref parameters.
void guidance_v_update_ref (void)
struct ThrustSetpoint guidance_v_from_nav (bool in_flight)
 Set guidance setpoint from NAV and run hover loop.
void guidance_v_guided_enter (void)
 Enter GUIDED mode control.
struct ThrustSetpoint guidance_v_guided_run (bool in_flight)
 Run GUIDED mode control.
void guidance_v_set_z (float z)
 Set z position setpoint.
void guidance_v_set_vz (float vz)
 Set z velocity setpoint.
void guidance_v_set_th (float th)
 Set throttle setpoint.
void guidance_v_set_all (float z, float vz, float az)
 Set z position, velocity and acceleration setpoint.

Variables

struct VerticalGuidance guidance_v
static bool desired_zd_updated
static int guidance_v_guided_mode
static abi_event rc_ev

Detailed Description

Vertical guidance for rotorcrafts.

Definition in file guidance_v.c.

Macro Definition Documentation

◆ GUIDANCE_V_CLIMB_RC_DEADBAND

#define GUIDANCE_V_CLIMB_RC_DEADBAND   MAX_PPRZ/10

Definition at line 49 of file guidance_v.c.

Referenced by rc_cb().

◆ GUIDANCE_V_GUIDED_MODE_ALL

#define GUIDANCE_V_GUIDED_MODE_ALL   3

Definition at line 67 of file guidance_v.c.

Referenced by guidance_v_guided_run().

◆ GUIDANCE_V_GUIDED_MODE_CLIMB

#define GUIDANCE_V_GUIDED_MODE_CLIMB   1

Definition at line 65 of file guidance_v.c.

Referenced by guidance_v_guided_run(), and guidance_v_set_vz().

◆ GUIDANCE_V_GUIDED_MODE_THROTTLE

#define GUIDANCE_V_GUIDED_MODE_THROTTLE   2

Definition at line 66 of file guidance_v.c.

Referenced by guidance_v_guided_run(), and guidance_v_set_th().

◆ GUIDANCE_V_GUIDED_MODE_ZHOLD

#define GUIDANCE_V_GUIDED_MODE_ZHOLD   0

◆ GUIDANCE_V_MAX_RC_CLIMB_SPEED

#define GUIDANCE_V_MAX_RC_CLIMB_SPEED   GUIDANCE_V_REF_MIN_ZD

Definition at line 53 of file guidance_v.c.

Referenced by rc_cb().

◆ GUIDANCE_V_MAX_RC_DESCENT_SPEED

#define GUIDANCE_V_MAX_RC_DESCENT_SPEED   GUIDANCE_V_REF_MAX_ZD

Definition at line 57 of file guidance_v.c.

Referenced by rc_cb().

◆ GUIDANCE_V_NOMINAL_HOVER_THROTTLE

#define GUIDANCE_V_NOMINAL_HOVER_THROTTLE   0.4

Definition at line 43 of file guidance_v.c.

Referenced by guidance_v_init().

◆ GUIDANCE_V_RC_ID

#define GUIDANCE_V_RC_ID   ABI_BROADCAST

Definition at line 72 of file guidance_v.c.

Referenced by guidance_v_init().

Function Documentation

◆ get_vertical_thrust_coeff()

int32_t get_vertical_thrust_coeff ( void )
static

get the cosine of the angle between thrust vector and gravity vector

Definition at line 173 of file guidance_v.c.

References BFP_OF_REAL, INT32_TRIG_FRAC, Int32RMat::m, and stateGetNedToBodyRMat_i().

Referenced by guidance_v_thrust_adapt().

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

◆ guidance_v_from_nav()

◆ guidance_v_guided_enter()

void guidance_v_guided_enter ( void )

Enter GUIDED mode control.

Definition at line 334 of file guidance_v.c.

References guidance_v_run_enter(), guidance_v_set_z(), GuidanceVSetRef, stateGetPositionNed_f(), stateGetPositionNed_i(), and stateGetSpeedNed_i().

Referenced by guidance_v_mode_changed().

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

◆ guidance_v_guided_run()

◆ guidance_v_init()

◆ guidance_v_mode_changed()

◆ guidance_v_notify_in_flight()

void guidance_v_notify_in_flight ( bool in_flight)

Definition at line 165 of file guidance_v.c.

References gv_adapt_init().

Here is the call graph for this function:

◆ guidance_v_run()

◆ guidance_v_set_all()

void guidance_v_set_all ( float z,
float vz,
float az )

Set z position, velocity and acceleration setpoint.

Parameters
zSetpoint (down is positive) in meters.
vzSetpoint (down is positive) in meters/second.
azSetpoint (down is positive) in meters/second².

Definition at line 411 of file guidance_v.c.

References ACCEL_BFP_OF_REAL, guidance_v, guidance_v_guided_mode, GUIDANCE_V_GUIDED_MODE_ZHOLD, POS_BFP_OF_REAL, and SPEED_BFP_OF_REAL.

◆ guidance_v_set_ref()

void guidance_v_set_ref ( int32_t pos,
int32_t speed,
int32_t accel )

Set guidance ref parameters.

Definition at line 283 of file guidance_v.c.

References guidance_v, and gv_set_ref().

Referenced by guidance_v_guided_run().

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

◆ guidance_v_set_th()

void guidance_v_set_th ( float th)

Set throttle setpoint.

Parameters
thThrottle setpoint between 0. and 1.

Definition at line 400 of file guidance_v.c.

References guidance_v, guidance_v_guided_mode, GUIDANCE_V_GUIDED_MODE_THROTTLE, GuidanceVSetRef, MAX_PPRZ, stateGetPositionNed_i(), and stateGetSpeedNed_i().

Here is the call graph for this function:

◆ guidance_v_set_vz()

void guidance_v_set_vz ( float vz)

Set z velocity setpoint.

Parameters
vzSetpoint (down is positive) in meters/second.

Definition at line 390 of file guidance_v.c.

References guidance_v, guidance_v_guided_mode, GUIDANCE_V_GUIDED_MODE_CLIMB, and SPEED_BFP_OF_REAL.

Referenced by autopilot_static_set_mode().

Here is the caller graph for this function:

◆ guidance_v_set_z()

void guidance_v_set_z ( float z)

Set z position setpoint.

Parameters
zSetpoint (down is positive) in meters.

Definition at line 379 of file guidance_v.c.

References guidance_v, guidance_v_guided_mode, GUIDANCE_V_GUIDED_MODE_ZHOLD, and POS_BFP_OF_REAL.

Referenced by guidance_v_guided_enter(), and wedgebug_periodic().

Here is the caller graph for this function:

◆ guidance_v_thrust_adapt()

void guidance_v_thrust_adapt ( bool in_flight)

Definition at line 201 of file guidance_v.c.

References desired_zd_updated, get_vertical_thrust_coeff(), guidance_v, gv_adapt_init(), gv_adapt_run(), INT32_TRIG_FRAC, stabilization, and stateGetAccelNed_i().

Referenced by guidance_v_run().

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

◆ guidance_v_update_ref()

void guidance_v_update_ref ( void )

◆ guidance_v_z_enter()

void guidance_v_z_enter ( void )

Definition at line 269 of file guidance_v.c.

References guidance_v, guidance_v_run_enter(), GuidanceVSetRef, stateGetPositionNed_i(), and NedCoor_i::z.

Here is the call graph for this function:

◆ rc_cb()

◆ send_tune_vert()

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

Definition at line 82 of file guidance_v.c.

References dev, guidance_v, and stateGetPositionNed_i().

Referenced by guidance_v_init().

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

Variable Documentation

◆ desired_zd_updated

bool desired_zd_updated
static

◆ guidance_v

◆ guidance_v_guided_mode

◆ rc_ev

abi_event rc_ev
static

Definition at line 75 of file guidance_v.c.