Added "bottom distance" switch, multirotor_pos_control implemented: use bottom distance to surface to control altitde

This commit is contained in:
Anton Babushkin
2013-10-11 11:38:36 +02:00
parent 86c53bee43
commit dc09182b95
10 changed files with 106 additions and 41 deletions
@@ -60,6 +60,7 @@ struct manual_control_setpoint_s {
float return_switch; /**< land 2 position switch (mandatory): land, no effect */
float assisted_switch; /**< assisted 2 position switch (optional): seatbelt, simple */
float mission_switch; /**< mission 2 position switch (optional): mission, loiter */
float dist_bottom_switch; /**< distance bottom 2 position switch (optional): off, on */
/**
* Any of the channels below may not be available and be set to NaN
+15 -14
View File
@@ -63,20 +63,21 @@
enum RC_CHANNELS_FUNCTION
{
THROTTLE = 0,
ROLL = 1,
PITCH = 2,
YAW = 3,
MODE = 4,
RETURN = 5,
ASSISTED = 6,
MISSION = 7,
OFFBOARD_MODE = 8,
FLAPS = 9,
AUX_1 = 10,
AUX_2 = 11,
AUX_3 = 12,
AUX_4 = 13,
AUX_5 = 14,
ROLL,
PITCH,
YAW,
MODE,
RETURN,
ASSISTED,
MISSION,
DIST_BOTTOM,
OFFBOARD_MODE,
FLAPS,
AUX_1,
AUX_2,
AUX_3,
AUX_4,
AUX_5,
RC_CHANNELS_FUNCTION_MAX /**< indicates the number of functions. There can be more functions than RC channels. */
};
@@ -79,6 +79,7 @@ struct vehicle_control_mode_s
bool flag_control_position_enabled; /**< true if position is controlled */
bool flag_control_altitude_enabled; /**< true if altitude is controlled */
bool flag_control_climb_rate_enabled; /**< true if climb rate is controlled */
bool flag_use_dist_bottom; /**< true if bottom distance sensor should be used for altitude control */
bool flag_control_auto_enabled; // TEMP
uint8_t auto_state; // TEMP navigation state for AUTO modes
+7 -6
View File
@@ -106,16 +106,16 @@ typedef enum {
ASSISTED_SWITCH_EASY
} assisted_switch_pos_t;
typedef enum {
RETURN_SWITCH_NONE = 0,
RETURN_SWITCH_RETURN
} return_switch_pos_t;
typedef enum {
MISSION_SWITCH_NONE = 0,
MISSION_SWITCH_MISSION
} mission_switch_pos_t;
typedef enum {
SWITCH_OFF = 0,
SWITCH_ON
} on_off_switch_pos_t;
enum VEHICLE_MODE_FLAG {
VEHICLE_MODE_FLAG_SAFETY_ARMED = 128,
VEHICLE_MODE_FLAG_MANUAL_INPUT_ENABLED = 64,
@@ -187,9 +187,10 @@ struct vehicle_status_s
bool is_rotary_wing;
mode_switch_pos_t mode_switch;
return_switch_pos_t return_switch;
on_off_switch_pos_t return_switch;
assisted_switch_pos_t assisted_switch;
mission_switch_pos_t mission_switch;
on_off_switch_pos_t dist_bottom_switch;
bool condition_battery_voltage_valid;
bool condition_system_in_air_restore; /**< true if we can restore in mid air */