This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* Copyright (C) 2023 Dennis van Wijngaarden <D.C.vanWijngaarden@tudelft.nl>
*
* This file is part of paparazzi
*
* paparazzi is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* paparazzi is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with paparazzi; see the file COPYING. If not, see
* <http://www.gnu.org/licenses/>.
*/
/** @file "modules/rotwing/rotwing_state.c"
* @author Dennis van Wijngaarden <D.C.vanWijngaarden@tudelft.nl>
* This module keeps track of the current state of a rotating wing drone and desired state set by the RC or flightplan. Paramters are being scheduled in each change of a current state and desired state. Functions are defined in this module to call the actual state and desired state and set a desired state.
#error "No wing rotation_controller selected. Include SERVO or CAN in your airframe"
#endif// USE_WING_ROTATION_CONTROLLER_CAN
#endif// USE_WING_ROTATION_CONTROLLER_SERVO
#include"modules/actuators/actuators.h"
#include"modules/core/abi.h"
// Quad state identification
#ifndefROTWING_MIN_SKEW_ANGLE_DEG_QUAD
#defineROTWING_MIN_SKEW_ANGLE_DEG_QUAD 10.0
#endif
#ifndefROTWING_MIN_SKEW_ANGLE_COUNTER
#defineROTWING_MIN_SKEW_ANGLE_COUNTER 10 // Minimum number of loops the skew angle is below ROTWING_MIN_SKEW_ANGLE_COUNTER
#endif
// Skewing state identification
#ifndefROTWING_SKEWING_COUNTER
#defineROTWING_SKEWING_COUNTER 10 // Minimum number of loops the skew angle is in between QUAD and FW
#endif
// maximum quad airspeed to force quad state
#ifndefROTWING_MAX_QUAD_AIRSPEED
#defineROTWING_MAX_QUAD_AIRSPEED 20.0
#endif
// Half skew state identification
#ifndefROTWING_HALF_SKEW_ANGLE_DEG
#defineROTWING_HALF_SKEW_ANGLE_DEG 55.0
#endif
#ifndefROTWING_HALF_SKEW_ANGLE_RANG
#defineROTWING_HALF_SKEW_ANGLE_HALF_RANGE 10.0
#endif
#ifndefROTWING_HALF_SKEW_COUNTER
#defineROTWING_HALF_SKEW_COUNTER 10 // Minimum number of loops the skew angle is at HALF_SKEW_ANGLE_DEG +/- ROTWING_HALF_SKEW_ANGLE_HALF_RANGE to trigger ROTWING_HALF_SKEW_ANGLE state
#endif
// FW state identification
#ifndefROTWING_MIN_FW_SKEW_ANGLE_DEG
#defineROTWING_MIN_FW_SKEW_ANGLE_DEG 80.0 // Minimum wing angle to fly in fixed wing state
#endif
#ifndefROTWING_MIN_FW_COUNTER
#defineROTWING_MIN_FW_COUNTER 10 // Minimum number of loops the skew angle is above the MIN_FW_SKEW_ANGLE
floatfixed_wing_percentage= !hover_motors_active; // TODO: when hover props go below 40%, ...
Bound(fixed_wing_percentage, 0, 1);
#defineAIRSPEED_IMPORTANCE_IN_FORWARD_WEIGHT 16
Wv_gih[0] =horizontal_accel_weight* (1.0f+fixed_wing_percentage*AIRSPEED_IMPORTANCE_IN_FORWARD_WEIGHT); // stall n low hover motor_off (weight 16x more important than vertical weight)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* Copyright (C) 2023 Dennis van Wijngaarden <D.C.vanWijngaarden@tudelft.nl>
*
* This file is part of paparazzi
*
* paparazzi is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* paparazzi is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with paparazzi; see the file COPYING. If not, see
* <http://www.gnu.org/licenses/>.
*/
/** @file "modules/rotwing/rotwing_state.h"
* @author Dennis van Wijngaarden <D.C.vanWijngaarden@tudelft.nl>
* This module keeps track of the current state of a rotating wing drone and desired state set by the RC or flightplan. Paramters are being scheduled in each change of a current state and desired state. Functions are defined in this module to call the actual state and desired state and set a desired state.
*/
#ifndefROTWING_STATE_H
#defineROTWING_STATE_H
#include"std.h"
/** Rotwing States
*/
#defineROTWING_STATE_HOVER 0 // Wing is skewed in 0 degrees (quad)
#defineROTWING_STATE_SKEWING 1 // WIng is skewing
#defineROTWING_STATE_FW 2 // Wing is skewed at 90 degrees (fixed wing), hover motors have full authority
#defineROTWING_STATE_FW_HOV_MOT_IDLE 3 // Wing is skewed at 90 degrees (fixed wing), hover motors are forced to idle
#defineROTWING_STATE_FW_HOV_MOT_OFF 4 // Wing is skewed at 90 degrees (fixed wubg), hover motors are switched off
#defineROTWING_STATE_FREE 5 // This is a desired state for which the controller has to decide the desired state itself
structRotwingState {
uint8_tcurrent_state;
uint8_tdesired_state;
};
#defineROTWING_STATE_WING_QUAD_SETTING 0 // Wing skew at 0 degrees
#defineROTWING_STATE_WING_SCHEDULING_SETTING 1 // Wing skew handled by airspeed scheduler
#defineROTWING_STATE_WING_FW_SETTING 2 // Wing skew at 90 degrees
#defineROTWING_STATE_PITCH_QUAD_SETTING 0 // Pitch at prefered hover