2011-09-08 22:29:39 -03:00
|
|
|
// -*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*-
|
|
|
|
|
2011-09-18 00:33:01 -03:00
|
|
|
#ifndef _DEFINES_H
|
|
|
|
#define _DEFINES_H
|
|
|
|
|
2011-09-08 22:29:39 -03:00
|
|
|
// Internal defines, don't edit and expect things to work
|
|
|
|
// -------------------------------------------------------
|
|
|
|
|
|
|
|
#define TRUE 1
|
|
|
|
#define FALSE 0
|
2012-12-19 02:02:13 -04:00
|
|
|
#define ToRad(x) radians(x) // *pi/180
|
|
|
|
#define ToDeg(x) degrees(x) // *180/pi
|
2011-09-08 22:29:39 -03:00
|
|
|
|
|
|
|
#define DEBUG 0
|
|
|
|
#define LOITER_RANGE 60 // for calculating power outside of loiter radius
|
2012-08-16 21:50:16 -03:00
|
|
|
#define SERVO_MAX 4500 // This value represents 45 degrees and is just an
|
|
|
|
// arbitrary representation of servo max travel.
|
2011-09-08 22:29:39 -03:00
|
|
|
|
2011-09-09 11:18:38 -03:00
|
|
|
// failsafe
|
2011-09-08 22:29:39 -03:00
|
|
|
// ----------------------
|
2013-07-19 01:11:16 -03:00
|
|
|
enum failsafe_state {
|
|
|
|
FAILSAFE_NONE=0,
|
|
|
|
FAILSAFE_SHORT=1,
|
|
|
|
FAILSAFE_LONG=2,
|
|
|
|
FAILSAFE_GCS=3
|
|
|
|
};
|
2011-09-08 22:29:39 -03:00
|
|
|
|
|
|
|
|
2013-12-19 20:39:00 -04:00
|
|
|
// GCS failsafe types for FS_GCS_ENABL parameter
|
|
|
|
enum gcs_failsafe {
|
|
|
|
GCS_FAILSAFE_OFF = 0, // no GCS failsafe
|
|
|
|
GCS_FAILSAFE_HEARTBEAT = 1, // failsafe if we stop receiving heartbeat
|
|
|
|
GCS_FAILSAFE_HB_RSSI = 2 // failsafe if we stop receiving
|
|
|
|
// heartbeat or if RADIO.remrssi
|
|
|
|
// drops to 0
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2011-09-08 22:29:39 -03:00
|
|
|
// active altitude sensor
|
|
|
|
// ----------------------
|
|
|
|
#define SONAR 0
|
|
|
|
#define BARO 1
|
|
|
|
|
2011-11-13 00:08:04 -04:00
|
|
|
#define PITOT_SOURCE_ADC 1
|
|
|
|
#define PITOT_SOURCE_ANALOG_PIN 2
|
|
|
|
|
2011-09-08 22:29:39 -03:00
|
|
|
#define T6 1000000
|
|
|
|
#define T7 10000000
|
|
|
|
|
2013-04-12 04:44:40 -03:00
|
|
|
// HIL enumerations. Note that HIL_MODE_ATTITUDE and HIL_MODE_SENSORS
|
|
|
|
// are now the same thing, and are sensors based. The old define is
|
|
|
|
// kept to allow old APM_Config.h headers to keep working
|
2012-08-16 21:50:16 -03:00
|
|
|
#define HIL_MODE_DISABLED 0
|
2014-01-02 01:29:05 -04:00
|
|
|
#define HIL_MODE_SENSORS 1
|
2011-09-08 22:29:39 -03:00
|
|
|
|
2012-11-30 05:34:56 -04:00
|
|
|
enum FlightMode {
|
2012-12-04 02:32:37 -04:00
|
|
|
MANUAL = 0,
|
|
|
|
CIRCLE = 1,
|
|
|
|
STABILIZE = 2,
|
|
|
|
TRAINING = 3,
|
2013-07-10 10:25:38 -03:00
|
|
|
ACRO = 4,
|
2012-11-30 05:34:56 -04:00
|
|
|
FLY_BY_WIRE_A = 5,
|
|
|
|
FLY_BY_WIRE_B = 6,
|
2013-07-13 07:05:53 -03:00
|
|
|
CRUISE = 7,
|
2014-04-12 01:12:14 -03:00
|
|
|
AUTOTUNE = 8,
|
2012-12-04 02:32:37 -04:00
|
|
|
AUTO = 10,
|
|
|
|
RTL = 11,
|
|
|
|
LOITER = 12,
|
|
|
|
GUIDED = 15,
|
|
|
|
INITIALISING = 16
|
2012-11-30 05:34:56 -04:00
|
|
|
};
|
2011-09-08 22:29:39 -03:00
|
|
|
|
2013-04-01 18:52:56 -03:00
|
|
|
// type of stick mixing enabled
|
|
|
|
enum StickMixing {
|
|
|
|
STICK_MIXING_DISABLED = 0,
|
|
|
|
STICK_MIXING_FBW = 1,
|
|
|
|
STICK_MIXING_DIRECT = 2
|
|
|
|
};
|
2011-09-08 22:29:39 -03:00
|
|
|
|
2013-04-28 07:49:53 -03:00
|
|
|
enum ChannelMixing {
|
|
|
|
MIXING_DISABLED = 0,
|
|
|
|
MIXING_UPUP = 1,
|
|
|
|
MIXING_UPDN = 2,
|
|
|
|
MIXING_DNUP = 3,
|
|
|
|
MIXING_DNDN = 4
|
2013-04-05 01:22:00 -03:00
|
|
|
};
|
|
|
|
|
2014-02-13 18:49:42 -04:00
|
|
|
/*
|
|
|
|
* The cause for the most recent fence enable
|
|
|
|
*/
|
|
|
|
typedef enum GeofenceEnableReason {
|
|
|
|
NOT_ENABLED = 0, //The fence is not enabled
|
|
|
|
PWM_TOGGLED, //Fence enabled/disabled by PWM signal
|
|
|
|
AUTO_TOGGLED, //Fence auto enabled/disabled at takeoff.
|
|
|
|
GCS_TOGGLED //Fence enabled/disabled by the GCS via Mavlink
|
|
|
|
} GeofenceEnableReason;
|
2011-09-08 22:29:39 -03:00
|
|
|
|
|
|
|
//repeating events
|
|
|
|
#define NO_REPEAT 0
|
|
|
|
#define CH_5_TOGGLE 1
|
|
|
|
#define CH_6_TOGGLE 2
|
|
|
|
#define CH_7_TOGGLE 3
|
|
|
|
#define CH_8_TOGGLE 4
|
|
|
|
#define RELAY_TOGGLE 5
|
|
|
|
#define STOP_REPEAT 10
|
|
|
|
|
|
|
|
|
2013-01-12 07:16:50 -04:00
|
|
|
// Logging message types. NOTE: If you change the value of one
|
|
|
|
// of these then existing logs will break! Only add at the end, and
|
|
|
|
// mark unused ones as 'deprecated', but leave them in
|
|
|
|
enum log_messages {
|
2013-04-19 10:37:21 -03:00
|
|
|
LOG_CTUN_MSG,
|
|
|
|
LOG_NTUN_MSG,
|
2013-01-12 07:16:50 -04:00
|
|
|
LOG_PERFORMANCE_MSG,
|
2014-03-12 05:18:15 -03:00
|
|
|
LOG_CMD_MSG_DEPRECATED, // deprecated
|
2013-01-12 07:16:50 -04:00
|
|
|
LOG_CURRENT_MSG,
|
|
|
|
LOG_STARTUP_MSG,
|
|
|
|
TYPE_AIRSTART_MSG,
|
|
|
|
TYPE_GROUNDSTART_MSG,
|
2013-04-01 23:08:23 -03:00
|
|
|
LOG_CAMERA_MSG,
|
2013-04-19 04:53:52 -03:00
|
|
|
LOG_ATTITUDE_MSG,
|
|
|
|
LOG_MODE_MSG,
|
2013-04-19 10:54:40 -03:00
|
|
|
LOG_COMPASS_MSG,
|
2013-06-26 05:36:53 -03:00
|
|
|
LOG_TECS_MSG,
|
2013-11-25 17:44:17 -04:00
|
|
|
LOG_RC_MSG,
|
2013-10-30 19:23:21 -03:00
|
|
|
LOG_SONAR_MSG,
|
2013-12-09 22:35:16 -04:00
|
|
|
LOG_COMPASS2_MSG,
|
2013-11-27 22:19:34 -04:00
|
|
|
LOG_ARM_DISARM_MSG,
|
2014-03-23 22:04:31 -03:00
|
|
|
LOG_AIRSPEED_MSG
|
2013-01-12 07:16:50 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#define MASK_LOG_ATTITUDE_FAST (1<<0)
|
|
|
|
#define MASK_LOG_ATTITUDE_MED (1<<1)
|
2012-08-16 21:50:16 -03:00
|
|
|
#define MASK_LOG_GPS (1<<2)
|
|
|
|
#define MASK_LOG_PM (1<<3)
|
|
|
|
#define MASK_LOG_CTUN (1<<4)
|
|
|
|
#define MASK_LOG_NTUN (1<<5)
|
|
|
|
#define MASK_LOG_MODE (1<<6)
|
2013-01-26 04:29:29 -04:00
|
|
|
#define MASK_LOG_IMU (1<<7)
|
2012-08-16 21:50:16 -03:00
|
|
|
#define MASK_LOG_CMD (1<<8)
|
2013-01-26 04:19:42 -04:00
|
|
|
#define MASK_LOG_CURRENT (1<<9)
|
2013-04-19 10:54:40 -03:00
|
|
|
#define MASK_LOG_COMPASS (1<<10)
|
2013-06-26 05:36:53 -03:00
|
|
|
#define MASK_LOG_TECS (1<<11)
|
2013-07-09 23:23:36 -03:00
|
|
|
#define MASK_LOG_CAMERA (1<<12)
|
2013-11-25 17:44:17 -04:00
|
|
|
#define MASK_LOG_RC (1<<13)
|
2013-10-30 19:23:21 -03:00
|
|
|
#define MASK_LOG_SONAR (1<<14)
|
2013-11-27 22:19:34 -04:00
|
|
|
#define MASK_LOG_ARM_DISARM (1<<15)
|
2014-02-13 22:14:45 -04:00
|
|
|
#define MASK_LOG_WHEN_DISARMED (1UL<<16)
|
2011-09-08 22:29:39 -03:00
|
|
|
|
|
|
|
// Waypoint Modes
|
|
|
|
// ----------------
|
|
|
|
#define ABS_WP 0
|
|
|
|
#define REL_WP 1
|
|
|
|
|
|
|
|
// Command Queues
|
|
|
|
// ---------------
|
|
|
|
#define COMMAND_MUST 0
|
|
|
|
#define COMMAND_MAY 1
|
|
|
|
#define COMMAND_NOW 2
|
|
|
|
|
|
|
|
// Events
|
|
|
|
// ------
|
|
|
|
#define EVENT_WILL_REACH_WAYPOINT 1
|
2011-10-25 22:27:23 -03:00
|
|
|
#define EVENT_SET_NEW_COMMAND_INDEX 2
|
2011-09-08 22:29:39 -03:00
|
|
|
#define EVENT_LOADED_WAYPOINT 3
|
|
|
|
#define EVENT_LOOP 4
|
|
|
|
|
|
|
|
// Climb rate calculations
|
2012-08-16 21:50:16 -03:00
|
|
|
#define ALTITUDE_HISTORY_LENGTH 8 //Number of (time,altitude) points to
|
|
|
|
// regress a climb rate from
|
2011-09-08 22:29:39 -03:00
|
|
|
|
2012-08-16 21:50:16 -03:00
|
|
|
#define AN4 4
|
|
|
|
#define AN5 5
|
2011-09-08 22:29:39 -03:00
|
|
|
|
2012-08-16 21:50:16 -03:00
|
|
|
#define SPEEDFILT 400 // centimeters/second; the speed below
|
|
|
|
// which a groundstart will be
|
|
|
|
// triggered
|
2011-09-08 22:29:39 -03:00
|
|
|
|
2011-12-15 03:08:58 -04:00
|
|
|
// fence points are stored at the end of the EEPROM
|
|
|
|
#define MAX_FENCEPOINTS 20
|
2011-12-15 22:48:15 -04:00
|
|
|
#define FENCE_WP_SIZE sizeof(Vector2l)
|
2014-03-12 03:19:45 -03:00
|
|
|
#define FENCE_START_BYTE (HAL_STORAGE_SIZE_AVAILABLE-(MAX_FENCEPOINTS*FENCE_WP_SIZE))
|
2011-12-15 03:08:58 -04:00
|
|
|
|
2013-09-22 01:45:24 -03:00
|
|
|
// rally points shoehorned between fence points and waypoints
|
|
|
|
#define MAX_RALLYPOINTS 10
|
2014-04-19 02:44:47 -03:00
|
|
|
#define RALLY_START_BYTE (FENCE_START_BYTE-(MAX_RALLYPOINTS*AC_RALLY_WP_SIZE))
|
2013-09-22 01:45:24 -03:00
|
|
|
|
2014-03-12 03:19:45 -03:00
|
|
|
// parameters get the first 1280 bytes of EEPROM, mission commands are stored between these params and the rally points
|
|
|
|
#define MISSION_START_BYTE 0x500
|
|
|
|
#define MISSION_END_BYTE (RALLY_START_BYTE-1)
|
2011-12-15 03:08:58 -04:00
|
|
|
|
2012-08-16 21:50:16 -03:00
|
|
|
// convert a boolean (0 or 1) to a sign for multiplying (0 maps to 1, 1 maps
|
|
|
|
// to -1)
|
|
|
|
#define BOOL_TO_SIGN(bvalue) ((bvalue) ? -1 : 1)
|
2011-09-18 00:33:01 -03:00
|
|
|
|
2011-09-18 03:39:09 -03:00
|
|
|
// mark a function as not to be inlined
|
|
|
|
#define NOINLINE __attribute__((noinline))
|
|
|
|
|
2013-01-21 01:08:55 -04:00
|
|
|
// InertialSensor driver types
|
|
|
|
#define CONFIG_INS_OILPAN 1
|
2012-11-05 00:32:13 -04:00
|
|
|
#define CONFIG_INS_MPU6000 2
|
2013-09-28 06:34:21 -03:00
|
|
|
#define CONFIG_INS_HIL 3
|
2013-01-21 01:08:55 -04:00
|
|
|
#define CONFIG_INS_PX4 4
|
2013-09-23 00:43:03 -03:00
|
|
|
#define CONFIG_INS_FLYMAPLE 5
|
2013-10-07 21:24:21 -03:00
|
|
|
#define CONFIG_INS_L3G4200D 6
|
2014-03-31 14:58:20 -03:00
|
|
|
#define CONFIG_INS_VRBRAIN 7
|
2011-11-13 00:08:04 -04:00
|
|
|
|
2013-01-21 01:08:55 -04:00
|
|
|
// barometer driver types
|
2011-11-27 02:07:49 -04:00
|
|
|
#define AP_BARO_BMP085 1
|
|
|
|
#define AP_BARO_MS5611 2
|
2013-01-04 06:07:56 -04:00
|
|
|
#define AP_BARO_PX4 3
|
2013-01-21 01:08:55 -04:00
|
|
|
#define AP_BARO_HIL 4
|
2014-03-31 14:58:20 -03:00
|
|
|
#define AP_BARO_VRBRAIN 5
|
2013-01-21 01:08:55 -04:00
|
|
|
|
|
|
|
// compass driver types
|
|
|
|
#define AP_COMPASS_HMC5843 1
|
|
|
|
#define AP_COMPASS_PX4 2
|
|
|
|
#define AP_COMPASS_HIL 3
|
2014-03-31 14:58:20 -03:00
|
|
|
#define AP_COMPASS_VRBRAIN 4
|
2011-11-27 02:07:49 -04:00
|
|
|
|
2012-08-28 00:15:04 -03:00
|
|
|
// altitude control algorithms
|
|
|
|
enum {
|
2013-06-26 05:36:53 -03:00
|
|
|
ALT_CONTROL_DEFAULT = 0,
|
|
|
|
ALT_CONTROL_NON_AIRSPEED = 1,
|
2013-07-14 22:12:24 -03:00
|
|
|
ALT_CONTROL_TECS = 2,
|
|
|
|
ALT_CONTROL_AIRSPEED = 3
|
2012-08-28 00:15:04 -03:00
|
|
|
};
|
|
|
|
|
2013-05-05 02:31:41 -03:00
|
|
|
// attitude controller choice
|
|
|
|
enum {
|
|
|
|
ATT_CONTROL_PID = 0,
|
|
|
|
ATT_CONTROL_APMCONTROL = 1
|
|
|
|
};
|
2012-08-28 00:15:04 -03:00
|
|
|
|
2011-09-18 00:33:01 -03:00
|
|
|
#endif // _DEFINES_H
|