Paparazzi UAS v7.1_unstable
Paparazzi is a free software Unmanned Aircraft System.
Loading...
Searching...
No Matches
rotwing_state.c File Reference
Include dependency graph for rotwing_state.c:

Go to the source code of this file.

Macros

#define ASSERT_EQUIVALENCE(primary, backup)
#define ROTWING_QUAD_MIN_RPM   400
#define ROTWING_PUSH_MIN_RPM   300
#define ROTWING_RPM_TIMEOUT   1.0
#define ROTWING_QUAD_IDLE_MIN_THRUST   100
#define ROTWING_QUAD_IDLE_TIMEOUT   0.4
#define ROTWING_FW_SKEW_ANGLE   85.0
#define ROTWING_QUAD_SKEW_ANGLE   25.0
#define ROTWING_TRANSITION_MAX_BANK   RadOfDeg(20)
#define ROTWING_TRANSITION_MAX_CLIMB_SPEED   0.5
#define ROTWING_TRANSITION_MAX_DESCEND_SPEED   -0.5
#define ROTWING_SKEW_BACK_MARGIN   5.0
#define ROTWING_SKEW_REF_MODEL_MAX_DIFF   5.f
#define ROTWING_MIN_AIRSPEED_SLOPE_START_ANGLE   30.0
#define ROTWING_FW_STALL_TIMEOUT   0.5
#define ROTWING_STATE_MIN_FW_DIST   200.0
#define ROTWING_SKEW_SWEEP_MIN   0.f
#define ROTWING_SKEW_SWEEP_MAX   60.f
#define ROTWING_SKEW_SWEEP_FREQ   0.1f
#define SERVO_BMOTOR_PUSH_IDX   SERVO_MOTOR_PUSH_IDX
#define SERVO_BROTATION_MECH_IDX   SERVO_ROTATION_MECH_IDX
#define ROTWING_STATE_ACT_FEEDBACK_ID   ABI_BROADCAST
 ABI binding feedback data.
#define GUIDANCE_INDI_FWD_CLIMB_SPEED   4.0
 Climb speed when navigation is making turns instead of direct lines.
#define GUIDANCE_INDI_FWD_DESCEND_SPEED   -4.0
 Descend speed when navigation is making turns instead of direct lines.
#define GUIDANCE_INDI_QUAD_CLIMB_SPEED   2.0
 Climb speed when navigation is doing direct lines.
#define GUIDANCE_INDI_QUAD_DESCEND_SPEED   -2.0
 Descend speed when navigation is doing direct lines.

Functions

 ASSERT_EQUIVALENCE (MOTOR_FRONT, BMOTOR_FRONT)
 ASSERT_EQUIVALENCE (MOTOR_RIGHT, BMOTOR_RIGHT)
 ASSERT_EQUIVALENCE (MOTOR_BACK, BMOTOR_BACK)
 ASSERT_EQUIVALENCE (MOTOR_LEFT, BMOTOR_LEFT)
static void rotwing_state_feedback_cb (uint8_t sender_id, struct act_feedback_t *feedback_msg, uint8_t num_act)
static void rotwing_state_skew_sweep (bool run, float time)
 Sweep the skew angle setpoint between skew_sweep.min_deg and skew_sweep.max_deg at skew_sweep.freq, starting from min_deg.
static void send_rotating_wing_state (struct transport_tx *trans, struct link_device *dev)
void rotwing_state_init (void)
bool rotwing_state_hover_motors_idling (void)
 Check if hover motors are idling (COMMAND_THRUST < ROTWING_QUAD_IDLE_MIN_THRUST) for ROTWING_QUAD_IDLE_TIMEOUT time.
void rotwing_state_periodic (void)
static void rotwing_state_feedback_cb (uint8_t sender_id, struct act_feedback_t UNUSED *feedback_msg, uint8_t UNUSED num_act_message)
bool rotwing_state_hover_motors_running (void)
bool rotwing_state_pusher_motor_running (void)
bool rotwing_state_skew_angle_valid (void)
void rotwing_state_set (enum rotwing_states_t state)
bool rotwing_state_choose_circle_direction (uint8_t wp_id)
bool rotwing_state_choose_state_by_dist (uint8_t wp_id)

Variables

abi_event rotwing_state_feedback_ev
struct rotwing_state_t rotwing_state

Macro Definition Documentation

◆ ASSERT_EQUIVALENCE

#define ASSERT_EQUIVALENCE ( primary,
backup )
Value:
_Static_assert(SERVO_##primary##_MIN == SERVO_##backup##_MIN, \
#primary " and " #backup " must have same MIN value"); \
_Static_assert(SERVO_##primary##_NEUTRAL == SERVO_##backup##_NEUTRAL, \
#primary " and " #backup " must have same NEUTRAL value"); \
_Static_assert(SERVO_##primary##_MAX == SERVO_##backup##_MAX, \
#primary " and " #backup " must have same MAX value")

Definition at line 33 of file rotwing_state.c.

◆ GUIDANCE_INDI_FWD_CLIMB_SPEED

#define GUIDANCE_INDI_FWD_CLIMB_SPEED   4.0

Climb speed when navigation is making turns instead of direct lines.

Definition at line 156 of file rotwing_state.c.

◆ GUIDANCE_INDI_FWD_DESCEND_SPEED

#define GUIDANCE_INDI_FWD_DESCEND_SPEED   -4.0

Descend speed when navigation is making turns instead of direct lines.

Definition at line 163 of file rotwing_state.c.

◆ GUIDANCE_INDI_QUAD_CLIMB_SPEED

#define GUIDANCE_INDI_QUAD_CLIMB_SPEED   2.0

Climb speed when navigation is doing direct lines.

Definition at line 170 of file rotwing_state.c.

◆ GUIDANCE_INDI_QUAD_DESCEND_SPEED

#define GUIDANCE_INDI_QUAD_DESCEND_SPEED   -2.0

Descend speed when navigation is doing direct lines.

Definition at line 177 of file rotwing_state.c.

◆ ROTWING_FW_SKEW_ANGLE

#define ROTWING_FW_SKEW_ANGLE   85.0

Definition at line 77 of file rotwing_state.c.

Referenced by rotwing_state_periodic().

◆ ROTWING_FW_STALL_TIMEOUT

#define ROTWING_FW_STALL_TIMEOUT   0.5

Definition at line 117 of file rotwing_state.c.

Referenced by rotwing_state_periodic().

◆ ROTWING_MIN_AIRSPEED_SLOPE_START_ANGLE

#define ROTWING_MIN_AIRSPEED_SLOPE_START_ANGLE   30.0

Definition at line 112 of file rotwing_state.c.

Referenced by rotwing_state_periodic().

◆ ROTWING_PUSH_MIN_RPM

#define ROTWING_PUSH_MIN_RPM   300

Definition at line 57 of file rotwing_state.c.

Referenced by rotwing_state_periodic(), and rotwing_state_pusher_motor_running().

◆ ROTWING_QUAD_IDLE_MIN_THRUST

#define ROTWING_QUAD_IDLE_MIN_THRUST   100

Definition at line 67 of file rotwing_state.c.

Referenced by rotwing_state_hover_motors_idling().

◆ ROTWING_QUAD_IDLE_TIMEOUT

#define ROTWING_QUAD_IDLE_TIMEOUT   0.4

Definition at line 72 of file rotwing_state.c.

Referenced by rotwing_state_hover_motors_idling().

◆ ROTWING_QUAD_MIN_RPM

#define ROTWING_QUAD_MIN_RPM   400

Definition at line 52 of file rotwing_state.c.

Referenced by rotwing_state_hover_motors_running(), and rotwing_state_periodic().

◆ ROTWING_QUAD_SKEW_ANGLE

#define ROTWING_QUAD_SKEW_ANGLE   25.0

Definition at line 82 of file rotwing_state.c.

Referenced by rotwing_state_periodic().

◆ ROTWING_RPM_TIMEOUT

#define ROTWING_RPM_TIMEOUT   1.0

◆ ROTWING_SKEW_BACK_MARGIN

#define ROTWING_SKEW_BACK_MARGIN   5.0

Definition at line 102 of file rotwing_state.c.

Referenced by rotwing_state_periodic().

◆ ROTWING_SKEW_REF_MODEL_MAX_DIFF

#define ROTWING_SKEW_REF_MODEL_MAX_DIFF   5.f

Definition at line 107 of file rotwing_state.c.

Referenced by rotwing_state_skew_angle_valid().

◆ ROTWING_SKEW_SWEEP_FREQ

#define ROTWING_SKEW_SWEEP_FREQ   0.1f

Definition at line 134 of file rotwing_state.c.

Referenced by rotwing_state_init().

◆ ROTWING_SKEW_SWEEP_MAX

#define ROTWING_SKEW_SWEEP_MAX   60.f

Definition at line 130 of file rotwing_state.c.

Referenced by rotwing_state_init().

◆ ROTWING_SKEW_SWEEP_MIN

#define ROTWING_SKEW_SWEEP_MIN   0.f

Definition at line 126 of file rotwing_state.c.

Referenced by rotwing_state_init().

◆ ROTWING_STATE_ACT_FEEDBACK_ID

#define ROTWING_STATE_ACT_FEEDBACK_ID   ABI_BROADCAST

ABI binding feedback data.

Definition at line 149 of file rotwing_state.c.

Referenced by rotwing_state_init().

◆ ROTWING_STATE_MIN_FW_DIST

#define ROTWING_STATE_MIN_FW_DIST   200.0

Definition at line 121 of file rotwing_state.c.

Referenced by rotwing_state_choose_state_by_dist().

◆ ROTWING_TRANSITION_MAX_BANK

#define ROTWING_TRANSITION_MAX_BANK   RadOfDeg(20)

Definition at line 87 of file rotwing_state.c.

Referenced by rotwing_state_periodic().

◆ ROTWING_TRANSITION_MAX_CLIMB_SPEED

#define ROTWING_TRANSITION_MAX_CLIMB_SPEED   0.5

Definition at line 92 of file rotwing_state.c.

Referenced by rotwing_state_periodic().

◆ ROTWING_TRANSITION_MAX_DESCEND_SPEED

#define ROTWING_TRANSITION_MAX_DESCEND_SPEED   -0.5

Definition at line 97 of file rotwing_state.c.

Referenced by rotwing_state_periodic().

◆ SERVO_BMOTOR_PUSH_IDX

#define SERVO_BMOTOR_PUSH_IDX   SERVO_MOTOR_PUSH_IDX

Definition at line 139 of file rotwing_state.c.

Referenced by rotwing_state_feedback_cb().

◆ SERVO_BROTATION_MECH_IDX

#define SERVO_BROTATION_MECH_IDX   SERVO_ROTATION_MECH_IDX

Definition at line 144 of file rotwing_state.c.

Referenced by rotwing_state_feedback_cb().

Function Documentation

◆ ASSERT_EQUIVALENCE() [1/4]

ASSERT_EQUIVALENCE ( MOTOR_BACK ,
BMOTOR_BACK  )

References MOTOR_BACK.

◆ ASSERT_EQUIVALENCE() [2/4]

ASSERT_EQUIVALENCE ( MOTOR_FRONT ,
BMOTOR_FRONT  )

References MOTOR_FRONT.

◆ ASSERT_EQUIVALENCE() [3/4]

ASSERT_EQUIVALENCE ( MOTOR_LEFT ,
BMOTOR_LEFT  )

References MOTOR_LEFT.

◆ ASSERT_EQUIVALENCE() [4/4]

ASSERT_EQUIVALENCE ( MOTOR_RIGHT ,
BMOTOR_RIGHT  )

References MOTOR_RIGHT.

◆ rotwing_state_choose_circle_direction()

bool rotwing_state_choose_circle_direction ( uint8_t wp_id)

◆ rotwing_state_choose_state_by_dist()

bool rotwing_state_choose_state_by_dist ( uint8_t wp_id)

◆ rotwing_state_feedback_cb() [1/2]

void rotwing_state_feedback_cb ( uint8_t sender_id,
struct act_feedback_t * feedback_msg,
uint8_t num_act )
static

Referenced by rotwing_state_init().

Here is the caller graph for this function:

◆ rotwing_state_feedback_cb() [2/2]

void rotwing_state_feedback_cb ( uint8_t sender_id,
struct act_feedback_t UNUSED * feedback_msg,
uint8_t UNUSED num_act_message )
static

◆ rotwing_state_hover_motors_idling()

bool rotwing_state_hover_motors_idling ( void )

Check if hover motors are idling (COMMAND_THRUST < ROTWING_QUAD_IDLE_MIN_THRUST) for ROTWING_QUAD_IDLE_TIMEOUT time.

Returns
true if hover motors are idling, false otherwise

Definition at line 269 of file rotwing_state.c.

References get_sys_time_float(), ROTWING_QUAD_IDLE_MIN_THRUST, ROTWING_QUAD_IDLE_TIMEOUT, and stabilization.

Referenced by guidance_indi_hybrid_set_wls_settings(), rotwing_state_periodic(), and send_rotating_wing_state().

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

◆ rotwing_state_hover_motors_running()

bool rotwing_state_hover_motors_running ( void )

Definition at line 551 of file rotwing_state.c.

References get_sys_time_float(), ROTWING_QUAD_MIN_RPM, ROTWING_RPM_TIMEOUT, and rotwing_state.

Referenced by compute_accel_from_speed_sp(), G1G2_oneloop(), guidance_indi_hybrid_set_wls_settings(), rotwing_state_periodic(), and send_rotating_wing_state().

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

◆ rotwing_state_init()

◆ rotwing_state_periodic()

void rotwing_state_periodic ( void )

◆ rotwing_state_pusher_motor_running()

bool rotwing_state_pusher_motor_running ( void )

Definition at line 568 of file rotwing_state.c.

References get_sys_time_float(), ROTWING_PUSH_MIN_RPM, ROTWING_RPM_TIMEOUT, and rotwing_state.

Referenced by compute_accel_from_speed_sp(), guidance_indi_hybrid_set_wls_settings(), rotwing_state_periodic(), and send_rotating_wing_state().

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

◆ rotwing_state_set()

void rotwing_state_set ( enum rotwing_states_t state)

Definition at line 585 of file rotwing_state.c.

References rotwing_state, and state.

Referenced by rotwing_state_choose_state_by_dist().

Here is the caller graph for this function:

◆ rotwing_state_skew_angle_valid()

bool rotwing_state_skew_angle_valid ( void )

Definition at line 577 of file rotwing_state.c.

References get_sys_time_float(), ROTWING_RPM_TIMEOUT, ROTWING_SKEW_REF_MODEL_MAX_DIFF, and rotwing_state.

Referenced by rotwing_state_periodic(), and send_rotating_wing_state().

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

◆ rotwing_state_skew_sweep()

void rotwing_state_skew_sweep ( bool run,
float time )
static

Sweep the skew angle setpoint between skew_sweep.min_deg and skew_sweep.max_deg at skew_sweep.freq, starting from min_deg.

Only runs while the skew is forced and the sweep is active, otherwise the setpoint is left as it is.

Definition at line 288 of file rotwing_state.c.

References rotwing_state, and start_time.

Referenced by rotwing_state_periodic().

Here is the caller graph for this function:

◆ send_rotating_wing_state()

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

Definition at line 186 of file rotwing_state.c.

References dev, gi_unbounded_airspeed_sp, rotwing_state, rotwing_state_hover_motors_idling(), rotwing_state_hover_motors_running(), rotwing_state_pusher_motor_running(), rotwing_state_skew_angle_valid(), state, and status.

Referenced by rotwing_state_init().

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

Variable Documentation

◆ rotwing_state

◆ rotwing_state_feedback_ev

abi_event rotwing_state_feedback_ev

Definition at line 180 of file rotwing_state.c.

Referenced by rotwing_state_init().