mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-31 02:16:53 +08:00
shortened rc_assisted_th to rc_assist_th in case we add a dedicated switch mapping later
This commit is contained in:
@@ -1145,7 +1145,7 @@ int commander_thread_main(int argc, char *argv[])
|
|||||||
/* arm/disarm by RC */
|
/* arm/disarm by RC */
|
||||||
res = TRANSITION_NOT_CHANGED;
|
res = TRANSITION_NOT_CHANGED;
|
||||||
|
|
||||||
/* check if left stick is in lower left position and we are in MANUAL or AUTO_READY mode or (ASSISTED mode and landed) -> disarm
|
/* check if left stick is in lower left position and we are in MANUAL or AUTO_READY mode or (ASSIST mode and landed) -> disarm
|
||||||
* do it only for rotary wings */
|
* do it only for rotary wings */
|
||||||
if (status.is_rotary_wing &&
|
if (status.is_rotary_wing &&
|
||||||
(status.arming_state == ARMING_STATE_ARMED || status.arming_state == ARMING_STATE_ARMED_ERROR) &&
|
(status.arming_state == ARMING_STATE_ARMED || status.arming_state == ARMING_STATE_ARMED_ERROR) &&
|
||||||
@@ -1299,7 +1299,7 @@ int commander_thread_main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO remove this hack
|
// TODO remove this hack
|
||||||
/* flight termination in manual mode if assisted switch is on posctrl position */
|
/* flight termination in manual mode if assist switch is on posctrl position */
|
||||||
if (!status.is_rotary_wing && parachute_enabled && armed.armed && status.main_state == MAIN_STATE_MANUAL && sp_man.posctrl_switch == SWITCH_POS_ON) {
|
if (!status.is_rotary_wing && parachute_enabled && armed.armed && status.main_state == MAIN_STATE_MANUAL && sp_man.posctrl_switch == SWITCH_POS_ON) {
|
||||||
if (TRANSITION_CHANGED == failsafe_state_transition(&status, FAILSAFE_STATE_TERMINATION)) {
|
if (TRANSITION_CHANGED == failsafe_state_transition(&status, FAILSAFE_STATE_TERMINATION)) {
|
||||||
tune_positive(armed.armed);
|
tune_positive(armed.armed);
|
||||||
@@ -1556,7 +1556,7 @@ set_main_state_rc(struct vehicle_status_s *status, struct manual_control_setpoin
|
|||||||
// TRANSITION_DENIED is not possible here
|
// TRANSITION_DENIED is not possible here
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SWITCH_POS_MIDDLE: // ASSISTED
|
case SWITCH_POS_MIDDLE: // ASSIST
|
||||||
if (sp_man->posctrl_switch == SWITCH_POS_ON) {
|
if (sp_man->posctrl_switch == SWITCH_POS_ON) {
|
||||||
res = main_state_transition(status, MAIN_STATE_POSCTRL);
|
res = main_state_transition(status, MAIN_STATE_POSCTRL);
|
||||||
|
|
||||||
|
|||||||
@@ -671,7 +671,7 @@ PARAM_DEFINE_INT32(RC_MAP_AUX3, 0);
|
|||||||
PARAM_DEFINE_INT32(RC_FAILS_THR, 0);
|
PARAM_DEFINE_INT32(RC_FAILS_THR, 0);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Threshold for selecting assisted mode
|
* Threshold for selecting assist mode
|
||||||
*
|
*
|
||||||
* min:-1
|
* min:-1
|
||||||
* max:+1
|
* max:+1
|
||||||
@@ -684,7 +684,7 @@ PARAM_DEFINE_INT32(RC_FAILS_THR, 0);
|
|||||||
* negative : true when channel<th
|
* negative : true when channel<th
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
PARAM_DEFINE_FLOAT(RC_ASSISTED_TH, 0.25f);
|
PARAM_DEFINE_FLOAT(RC_ASSIST_TH, 0.25f);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Threshold for selecting auto mode
|
* Threshold for selecting auto mode
|
||||||
|
|||||||
@@ -269,12 +269,12 @@ private:
|
|||||||
int rc_map_aux5;
|
int rc_map_aux5;
|
||||||
|
|
||||||
int32_t rc_fails_thr;
|
int32_t rc_fails_thr;
|
||||||
float rc_assisted_th;
|
float rc_assist_th;
|
||||||
float rc_auto_th;
|
float rc_auto_th;
|
||||||
float rc_posctrl_th;
|
float rc_posctrl_th;
|
||||||
float rc_return_th;
|
float rc_return_th;
|
||||||
float rc_loiter_th;
|
float rc_loiter_th;
|
||||||
bool rc_assisted_inv;
|
bool rc_assist_inv;
|
||||||
bool rc_auto_inv;
|
bool rc_auto_inv;
|
||||||
bool rc_posctrl_inv;
|
bool rc_posctrl_inv;
|
||||||
bool rc_return_inv;
|
bool rc_return_inv;
|
||||||
@@ -323,7 +323,7 @@ private:
|
|||||||
param_t rc_map_aux5;
|
param_t rc_map_aux5;
|
||||||
|
|
||||||
param_t rc_fails_thr;
|
param_t rc_fails_thr;
|
||||||
param_t rc_assisted_th;
|
param_t rc_assist_th;
|
||||||
param_t rc_auto_th;
|
param_t rc_auto_th;
|
||||||
param_t rc_posctrl_th;
|
param_t rc_posctrl_th;
|
||||||
param_t rc_return_th;
|
param_t rc_return_th;
|
||||||
@@ -539,7 +539,7 @@ Sensors::Sensors() :
|
|||||||
|
|
||||||
/* RC thresholds */
|
/* RC thresholds */
|
||||||
_parameter_handles.rc_fails_thr = param_find("RC_FAILS_THR");
|
_parameter_handles.rc_fails_thr = param_find("RC_FAILS_THR");
|
||||||
_parameter_handles.rc_assisted_th = param_find("RC_ASSISTED_TH");
|
_parameter_handles.rc_assist_th = param_find("RC_ASSIST_TH");
|
||||||
_parameter_handles.rc_auto_th = param_find("RC_AUTO_TH");
|
_parameter_handles.rc_auto_th = param_find("RC_AUTO_TH");
|
||||||
_parameter_handles.rc_posctrl_th = param_find("RC_POSCTRL_TH");
|
_parameter_handles.rc_posctrl_th = param_find("RC_POSCTRL_TH");
|
||||||
_parameter_handles.rc_return_th = param_find("RC_RETURN_TH");
|
_parameter_handles.rc_return_th = param_find("RC_RETURN_TH");
|
||||||
@@ -700,9 +700,9 @@ Sensors::parameters_update()
|
|||||||
param_get(_parameter_handles.rc_map_aux4, &(_parameters.rc_map_aux4));
|
param_get(_parameter_handles.rc_map_aux4, &(_parameters.rc_map_aux4));
|
||||||
param_get(_parameter_handles.rc_map_aux5, &(_parameters.rc_map_aux5));
|
param_get(_parameter_handles.rc_map_aux5, &(_parameters.rc_map_aux5));
|
||||||
param_get(_parameter_handles.rc_fails_thr, &(_parameters.rc_fails_thr));
|
param_get(_parameter_handles.rc_fails_thr, &(_parameters.rc_fails_thr));
|
||||||
param_get(_parameter_handles.rc_assisted_th, &(_parameters.rc_assisted_th));
|
param_get(_parameter_handles.rc_assist_th, &(_parameters.rc_assist_th));
|
||||||
_parameters.rc_assisted_inv = (_parameters.rc_assisted_th<0);
|
_parameters.rc_assist_inv = (_parameters.rc_assist_th<0);
|
||||||
_parameters.rc_assisted_th = fabs(_parameters.rc_assisted_th);
|
_parameters.rc_assist_th = fabs(_parameters.rc_assist_th);
|
||||||
param_get(_parameter_handles.rc_auto_th, &(_parameters.rc_auto_th));
|
param_get(_parameter_handles.rc_auto_th, &(_parameters.rc_auto_th));
|
||||||
_parameters.rc_auto_inv = (_parameters.rc_auto_th<0);
|
_parameters.rc_auto_inv = (_parameters.rc_auto_th<0);
|
||||||
_parameters.rc_auto_th = fabs(_parameters.rc_auto_th);
|
_parameters.rc_auto_th = fabs(_parameters.rc_auto_th);
|
||||||
@@ -1477,7 +1477,7 @@ Sensors::rc_poll()
|
|||||||
manual.aux5 = get_rc_value(AUX_5, -1.0, 1.0);
|
manual.aux5 = get_rc_value(AUX_5, -1.0, 1.0);
|
||||||
|
|
||||||
/* mode switches */
|
/* mode switches */
|
||||||
manual.mode_switch = get_rc_sw3pos_position(MODE, _parameters.rc_auto_th, _parameters.rc_auto_inv, _parameters.rc_assisted_th, _parameters.rc_assisted_inv);
|
manual.mode_switch = get_rc_sw3pos_position(MODE, _parameters.rc_auto_th, _parameters.rc_auto_inv, _parameters.rc_assist_th, _parameters.rc_assist_inv);
|
||||||
manual.posctrl_switch = get_rc_sw2pos_position(POSCTRL, _parameters.rc_posctrl_th, _parameters.rc_posctrl_inv);
|
manual.posctrl_switch = get_rc_sw2pos_position(POSCTRL, _parameters.rc_posctrl_th, _parameters.rc_posctrl_inv);
|
||||||
manual.return_switch = get_rc_sw2pos_position(RETURN, _parameters.rc_return_th, _parameters.rc_return_inv);
|
manual.return_switch = get_rc_sw2pos_position(RETURN, _parameters.rc_return_th, _parameters.rc_return_inv);
|
||||||
manual.loiter_switch = get_rc_sw2pos_position(LOITER, _parameters.rc_loiter_th, _parameters.rc_loiter_inv);
|
manual.loiter_switch = get_rc_sw2pos_position(LOITER, _parameters.rc_loiter_th, _parameters.rc_loiter_inv);
|
||||||
|
|||||||
Reference in New Issue
Block a user