Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
rotwing_state_V2.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2023 Tomaso De Ponti <T.M.L.DePonti@tudelft.nl>
3  *
4  * This file is part of paparazzi
5  *
6  * paparazzi is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2, or (at your option)
9  * any later version.
10  *
11  * paparazzi is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with paparazzi; see the file COPYING. If not, see
18  * <http://www.gnu.org/licenses/>.
19  */
20 
26 #ifndef ROTWING_STATE_H
27 #define ROTWING_STATE_H
28 
29 #include "std.h"
30 
33 #define ROTWING_STATE_HOVER 0 // Wing is skewed in 0 degrees (quad)
34 #define ROTWING_STATE_SKEWING 1 // WIng is skewing
35 #define ROTWING_STATE_FW 2 // Wing is skewed at 90 degrees (fixed wing), hover motors have full authority
36 #define ROTWING_STATE_FW_HOV_MOT_IDLE 3 // Wing is skewed at 90 degrees (fixed wing), hover motors are forced to idle
37 #define ROTWING_STATE_FW_HOV_MOT_OFF 4 // Wing is skewed at 90 degrees (fixed wubg), hover motors are switched off
38 #define ROTWING_STATE_FREE 5 // This is a desired state for which the controller has to decide the desired state itself
39 
42 #define ROTWING_CONFIGURATION_HOVER 0 // UAV is in hover
43 #define ROTWING_CONFIGURATION_HYBRID 1 // UAV can fly forward and hover if airspeed low, hover motors on
44 #define ROTWING_CONFIGURATION_EFFICIENT 2 // UAV flies efficiently forward (FW)
45 #define ROTWING_CONFIGURATION_FREE 3 // UAV switched between efficient and hybrid dependent on deceleration
46 
47 struct RotwingState {
51 };
52 
53 #define ROTWING_STATE_WING_QUAD_SETTING 0 // Wing skew at 0 degrees
54 #define ROTWING_STATE_WING_SCHEDULING_SETTING 1 // Wing skew handled by airspeed scheduler
55 #define ROTWING_STATE_WING_FW_SETTING 2 // Wing skew at 90 degrees
56 
57 #define ROTWING_STATE_PITCH_QUAD_SETTING 0 // Pitch at prefered hover
58 #define ROTWING_STATE_PITCH_TRANSITION_SETTING 1 // Pitch scheduled
59 #define ROTWING_STATE_PITCH_FW_SETTING 2 // Pitch at prefered forward
60 
61 struct RotWingStateSettings {
65  bool force_forward;
68  bool stall_protection;
69  float max_v_climb;
70  float max_v_descend;
71  float nav_max_speed;
72 };
73 
74 struct RotWingStateSkewing {
75  float wing_angle_deg_sp; // Wing angle setpoint in deg
76  float wing_angle_deg; // Wing angle from sensor in deg
77  int32_t servo_pprz_cmd; // Wing rotation servo pprz cmd
78  bool airspeed_scheduling; // Airspeed scheduling on or off
79  bool force_rotation_angle; // Setting to force wing_angle_deg_sp
80 };
81 
82 extern struct RotwingState rotwing_state;
85 
87 
88 extern bool hover_motors_active;
89 extern bool bool_disable_hover_motors;
90 
91 extern void init_rotwing_state(void);
92 extern void periodic_rotwing_state(void);
94 extern void rotwing_request_configuration(uint8_t configuration);
95 extern void rotwing_state_skew_actuator_periodic(void);
96 extern void rotwing_state_force_skew_off(void);
97 
98 #endif // ROTWING_STATE_H
struct State state
Definition: state.c:36
uint8_t current_state
Definition: rotwing_state.h:48
void init_rotwing_state(void)
struct RotWingStateSettings rotwing_state_settings
uint8_t requested_config
Definition: rotwing_state.h:50
void rotwing_state_skew_actuator_periodic(void)
void request_rotwing_state(uint8_t state)
void rotwing_state_force_skew_off(void)
struct RotwingState rotwing_state
uint8_t desired_state
Definition: rotwing_state.h:49
float rotwing_state_max_hover_speed
struct RotWingStateSkewing rotwing_state_skewing
bool bool_disable_hover_motors
bool hover_motors_active
void rotwing_request_configuration(uint8_t configuration)
void periodic_rotwing_state(void)
int int32_t
Typedef defining 32 bit int type.
Definition: vl53l1_types.h:83
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.
Definition: vl53l1_types.h:98