mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-05-31 12:23:23 +08:00
[rotorcraft] split arming code definition from autopilot (#2550)
the arming states are currently defined in autopilot_static.h, which is not compatible with the use of generated autopilot
This commit is contained in:
committed by
GitHub
parent
c53756b7b0
commit
de22fb1c29
@@ -0,0 +1,47 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2020 Gautier Hattenberger <gautier.hattenberger@enac.fr>
|
||||||
|
*
|
||||||
|
* 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 firmwares/rotorcraft/autopilot_arming.h
|
||||||
|
*
|
||||||
|
* Arming procedure for rotorcraft
|
||||||
|
* Several options can be selected:
|
||||||
|
* - yaw stick
|
||||||
|
* - switch position
|
||||||
|
* - throttle stick
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef AUTOPILOT_ARMING_H
|
||||||
|
#define AUTOPILOT_ARMING_H
|
||||||
|
|
||||||
|
/* Include arming procedure, yaw stick by default */
|
||||||
|
#if USE_KILL_SWITCH_FOR_MOTOR_ARMING
|
||||||
|
#include "autopilot_arming_switch.h"
|
||||||
|
PRINT_CONFIG_MSG("Using kill switch for motor arming")
|
||||||
|
#elif USE_THROTTLE_FOR_MOTOR_ARMING
|
||||||
|
#include "autopilot_arming_throttle.h"
|
||||||
|
PRINT_CONFIG_MSG("Using throttle for motor arming")
|
||||||
|
#else
|
||||||
|
#include "autopilot_arming_yaw.h"
|
||||||
|
PRINT_CONFIG_MSG("Using 2 sec yaw for motor arming")
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* AUTOPILOT_ARMING_H */
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2020 Gautier Hattenberger <gautier.hattenberger@enac.fr>
|
||||||
|
*
|
||||||
|
* 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 firmwares/rotorcraft/autopilot_arming_common.h
|
||||||
|
*
|
||||||
|
* Arming procedure for rotorcraft, common definitions
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef AUTOPILOT_ARMING_COMMON_H
|
||||||
|
#define AUTOPILOT_ARMING_COMMON_H
|
||||||
|
|
||||||
|
#include "autopilot_rc_helpers.h"
|
||||||
|
|
||||||
|
/* Arming status*/
|
||||||
|
#define AP_ARMING_STATUS_NO_RC 0
|
||||||
|
#define AP_ARMING_STATUS_WAITING 1
|
||||||
|
#define AP_ARMING_STATUS_ARMING 2
|
||||||
|
#define AP_ARMING_STATUS_ARMED 3
|
||||||
|
#define AP_ARMING_STATUS_DISARMING 4
|
||||||
|
#define AP_ARMING_STATUS_KILLED 5
|
||||||
|
#define AP_ARMING_STATUS_YAW_CENTERED 6
|
||||||
|
#define AP_ARMING_STATUS_THROTTLE_DOWN 7
|
||||||
|
#define AP_ARMING_STATUS_NOT_MODE_MANUAL 8
|
||||||
|
#define AP_ARMING_STATUS_UNARMED_IN_AUTO 9
|
||||||
|
#define AP_ARMING_STATUS_THROTTLE_NOT_DOWN 10
|
||||||
|
#define AP_ARMING_STATUS_STICKS_NOT_CENTERED 11
|
||||||
|
#define AP_ARMING_STATUS_PITCH_NOT_CENTERED 12
|
||||||
|
#define AP_ARMING_STATUS_ROLL_NOT_CENTERED 13
|
||||||
|
#define AP_ARMING_STATUS_YAW_NOT_CENTERED 14
|
||||||
|
#define AP_ARMING_STATUS_AHRS_NOT_ALLIGNED 15
|
||||||
|
#define AP_ARMING_STATUS_OUT_OF_GEOFENCE 16
|
||||||
|
#define AP_ARMING_STATUS_LOW_BATTERY 17
|
||||||
|
|
||||||
|
#endif /* AUTOPILOT_ARMING_COMMON_H */
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
#ifndef AUTOPILOT_ARMING_SWITCH_H
|
#ifndef AUTOPILOT_ARMING_SWITCH_H
|
||||||
#define AUTOPILOT_ARMING_SWITCH_H
|
#define AUTOPILOT_ARMING_SWITCH_H
|
||||||
|
|
||||||
#include "autopilot_rc_helpers.h"
|
#include "autopilot_arming_common.h"
|
||||||
|
|
||||||
#ifndef RADIO_KILL_SWITCH
|
#ifndef RADIO_KILL_SWITCH
|
||||||
#error "You need to have a RADIO_KILL_SWITCH configured to arm the motors with the switch!"
|
#error "You need to have a RADIO_KILL_SWITCH configured to arm the motors with the switch!"
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
#ifndef AUTOPILOT_ARMING_THROTTLE_H
|
#ifndef AUTOPILOT_ARMING_THROTTLE_H
|
||||||
#define AUTOPILOT_ARMING_THROTTLE_H
|
#define AUTOPILOT_ARMING_THROTTLE_H
|
||||||
|
|
||||||
#include "autopilot_rc_helpers.h"
|
#include "autopilot_arming_common.h"
|
||||||
#include "autopilot_firmware.h"
|
#include "autopilot_firmware.h"
|
||||||
|
|
||||||
#define AUTOPILOT_ARMING_DELAY 10
|
#define AUTOPILOT_ARMING_DELAY 10
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
#ifndef AUTOPILOT_ARMING_YAW_H
|
#ifndef AUTOPILOT_ARMING_YAW_H
|
||||||
#define AUTOPILOT_ARMING_YAW_H
|
#define AUTOPILOT_ARMING_YAW_H
|
||||||
|
|
||||||
#include "autopilot_rc_helpers.h"
|
#include "autopilot_arming_common.h"
|
||||||
#include "autopilot_firmware.h"
|
#include "autopilot_firmware.h"
|
||||||
#include "autopilot.h"
|
#include "autopilot.h"
|
||||||
|
|
||||||
|
|||||||
@@ -28,6 +28,7 @@
|
|||||||
|
|
||||||
#include "firmwares/rotorcraft/autopilot_generated.h"
|
#include "firmwares/rotorcraft/autopilot_generated.h"
|
||||||
#include "autopilot.h"
|
#include "autopilot.h"
|
||||||
|
#include "autopilot_arming.h"
|
||||||
|
|
||||||
#include "subsystems/radio_control.h"
|
#include "subsystems/radio_control.h"
|
||||||
#include "subsystems/commands.h"
|
#include "subsystems/commands.h"
|
||||||
@@ -37,17 +38,6 @@
|
|||||||
|
|
||||||
#include "generated/settings.h"
|
#include "generated/settings.h"
|
||||||
|
|
||||||
#if USE_KILL_SWITCH_FOR_MOTOR_ARMING
|
|
||||||
#include "autopilot_arming_switch.h"
|
|
||||||
PRINT_CONFIG_MSG("Using kill switch for motor arming")
|
|
||||||
#elif USE_THROTTLE_FOR_MOTOR_ARMING
|
|
||||||
#include "autopilot_arming_throttle.h"
|
|
||||||
PRINT_CONFIG_MSG("Using throttle for motor arming")
|
|
||||||
#else
|
|
||||||
#include "autopilot_arming_yaw.h"
|
|
||||||
PRINT_CONFIG_MSG("Using 2 sec yaw for motor arming")
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
void autopilot_generated_init(void)
|
void autopilot_generated_init(void)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -28,6 +28,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "autopilot.h"
|
#include "autopilot.h"
|
||||||
|
#include "autopilot_arming.h"
|
||||||
|
|
||||||
#include "subsystems/radio_control.h"
|
#include "subsystems/radio_control.h"
|
||||||
#include "subsystems/commands.h"
|
#include "subsystems/commands.h"
|
||||||
@@ -45,7 +46,6 @@
|
|||||||
#include "firmwares/rotorcraft/stabilization/stabilization_rate.h"
|
#include "firmwares/rotorcraft/stabilization/stabilization_rate.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "firmwares/rotorcraft/autopilot_rc_helpers.h"
|
|
||||||
#include "firmwares/rotorcraft/autopilot_guided.h"
|
#include "firmwares/rotorcraft/autopilot_guided.h"
|
||||||
|
|
||||||
#include "generated/settings.h"
|
#include "generated/settings.h"
|
||||||
@@ -60,17 +60,6 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if USE_KILL_SWITCH_FOR_MOTOR_ARMING
|
|
||||||
#include "autopilot_arming_switch.h"
|
|
||||||
PRINT_CONFIG_MSG("Using kill switch for motor arming")
|
|
||||||
#elif USE_THROTTLE_FOR_MOTOR_ARMING
|
|
||||||
#include "autopilot_arming_throttle.h"
|
|
||||||
PRINT_CONFIG_MSG("Using throttle for motor arming")
|
|
||||||
#else
|
|
||||||
#include "autopilot_arming_yaw.h"
|
|
||||||
PRINT_CONFIG_MSG("Using 2 sec yaw for motor arming")
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Geofence exceptions */
|
/* Geofence exceptions */
|
||||||
#include "modules/nav/nav_geofence.h"
|
#include "modules/nav/nav_geofence.h"
|
||||||
|
|
||||||
|
|||||||
@@ -54,26 +54,6 @@
|
|||||||
#define AP_MODE_GUIDED 19
|
#define AP_MODE_GUIDED 19
|
||||||
|
|
||||||
|
|
||||||
/* Arming status*/
|
|
||||||
#define AP_ARMING_STATUS_NO_RC 0
|
|
||||||
#define AP_ARMING_STATUS_WAITING 1
|
|
||||||
#define AP_ARMING_STATUS_ARMING 2
|
|
||||||
#define AP_ARMING_STATUS_ARMED 3
|
|
||||||
#define AP_ARMING_STATUS_DISARMING 4
|
|
||||||
#define AP_ARMING_STATUS_KILLED 5
|
|
||||||
#define AP_ARMING_STATUS_YAW_CENTERED 6
|
|
||||||
#define AP_ARMING_STATUS_THROTTLE_DOWN 7
|
|
||||||
#define AP_ARMING_STATUS_NOT_MODE_MANUAL 8
|
|
||||||
#define AP_ARMING_STATUS_UNARMED_IN_AUTO 9
|
|
||||||
#define AP_ARMING_STATUS_THROTTLE_NOT_DOWN 10
|
|
||||||
#define AP_ARMING_STATUS_STICKS_NOT_CENTERED 11
|
|
||||||
#define AP_ARMING_STATUS_PITCH_NOT_CENTERED 12
|
|
||||||
#define AP_ARMING_STATUS_ROLL_NOT_CENTERED 13
|
|
||||||
#define AP_ARMING_STATUS_YAW_NOT_CENTERED 14
|
|
||||||
#define AP_ARMING_STATUS_AHRS_NOT_ALLIGNED 15
|
|
||||||
#define AP_ARMING_STATUS_OUT_OF_GEOFENCE 16
|
|
||||||
#define AP_ARMING_STATUS_LOW_BATTERY 17
|
|
||||||
|
|
||||||
/** Default RC mode.
|
/** Default RC mode.
|
||||||
*/
|
*/
|
||||||
#ifndef MODE_MANUAL
|
#ifndef MODE_MANUAL
|
||||||
|
|||||||
Reference in New Issue
Block a user