|
|
|
@ -263,6 +263,7 @@ private:
@@ -263,6 +263,7 @@ private:
|
|
|
|
|
int rc_map_return_sw; |
|
|
|
|
int rc_map_posctl_sw; |
|
|
|
|
int rc_map_loiter_sw; |
|
|
|
|
int rc_map_acro_sw; |
|
|
|
|
|
|
|
|
|
int rc_map_flaps; |
|
|
|
|
|
|
|
|
@ -278,11 +279,13 @@ private:
@@ -278,11 +279,13 @@ private:
|
|
|
|
|
float rc_posctl_th; |
|
|
|
|
float rc_return_th; |
|
|
|
|
float rc_loiter_th; |
|
|
|
|
float rc_acro_th; |
|
|
|
|
bool rc_assist_inv; |
|
|
|
|
bool rc_auto_inv; |
|
|
|
|
bool rc_posctl_inv; |
|
|
|
|
bool rc_return_inv; |
|
|
|
|
bool rc_loiter_inv; |
|
|
|
|
bool rc_acro_inv; |
|
|
|
|
|
|
|
|
|
float battery_voltage_scaling; |
|
|
|
|
float battery_current_scaling; |
|
|
|
@ -315,6 +318,7 @@ private:
@@ -315,6 +318,7 @@ private:
|
|
|
|
|
param_t rc_map_return_sw; |
|
|
|
|
param_t rc_map_posctl_sw; |
|
|
|
|
param_t rc_map_loiter_sw; |
|
|
|
|
param_t rc_map_acro_sw; |
|
|
|
|
|
|
|
|
|
param_t rc_map_flaps; |
|
|
|
|
|
|
|
|
@ -330,6 +334,7 @@ private:
@@ -330,6 +334,7 @@ private:
|
|
|
|
|
param_t rc_posctl_th; |
|
|
|
|
param_t rc_return_th; |
|
|
|
|
param_t rc_loiter_th; |
|
|
|
|
param_t rc_acro_th; |
|
|
|
|
|
|
|
|
|
param_t battery_voltage_scaling; |
|
|
|
|
param_t battery_current_scaling; |
|
|
|
@ -530,6 +535,7 @@ Sensors::Sensors() :
@@ -530,6 +535,7 @@ Sensors::Sensors() :
|
|
|
|
|
/* optional mode switches, not mapped per default */ |
|
|
|
|
_parameter_handles.rc_map_posctl_sw = param_find("RC_MAP_POSCTL_SW"); |
|
|
|
|
_parameter_handles.rc_map_loiter_sw = param_find("RC_MAP_LOITER_SW"); |
|
|
|
|
_parameter_handles.rc_map_acro_sw = param_find("RC_MAP_ACRO_SW"); |
|
|
|
|
|
|
|
|
|
_parameter_handles.rc_map_aux1 = param_find("RC_MAP_AUX1"); |
|
|
|
|
_parameter_handles.rc_map_aux2 = param_find("RC_MAP_AUX2"); |
|
|
|
@ -544,6 +550,7 @@ Sensors::Sensors() :
@@ -544,6 +550,7 @@ Sensors::Sensors() :
|
|
|
|
|
_parameter_handles.rc_posctl_th = param_find("RC_POSCTL_TH"); |
|
|
|
|
_parameter_handles.rc_return_th = param_find("RC_RETURN_TH"); |
|
|
|
|
_parameter_handles.rc_loiter_th = param_find("RC_LOITER_TH"); |
|
|
|
|
_parameter_handles.rc_acro_th = param_find("RC_ACRO_TH"); |
|
|
|
|
|
|
|
|
|
/* gyro offsets */ |
|
|
|
|
_parameter_handles.gyro_offset[0] = param_find("SENS_GYRO_XOFF"); |
|
|
|
@ -687,6 +694,10 @@ Sensors::parameters_update()
@@ -687,6 +694,10 @@ Sensors::parameters_update()
|
|
|
|
|
warnx("%s", paramerr); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (param_get(_parameter_handles.rc_map_acro_sw, &(_parameters.rc_map_acro_sw)) != OK) { |
|
|
|
|
warnx("%s", paramerr); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (param_get(_parameter_handles.rc_map_flaps, &(_parameters.rc_map_flaps)) != OK) { |
|
|
|
|
warnx("%s", paramerr); |
|
|
|
|
} |
|
|
|
@ -712,6 +723,9 @@ Sensors::parameters_update()
@@ -712,6 +723,9 @@ Sensors::parameters_update()
|
|
|
|
|
param_get(_parameter_handles.rc_loiter_th, &(_parameters.rc_loiter_th)); |
|
|
|
|
_parameters.rc_loiter_inv = (_parameters.rc_loiter_th < 0); |
|
|
|
|
_parameters.rc_loiter_th = fabs(_parameters.rc_loiter_th); |
|
|
|
|
param_get(_parameter_handles.rc_acro_th, &(_parameters.rc_acro_th)); |
|
|
|
|
_parameters.rc_acro_inv = (_parameters.rc_acro_th < 0); |
|
|
|
|
_parameters.rc_acro_th = fabs(_parameters.rc_acro_th); |
|
|
|
|
|
|
|
|
|
/* update RC function mappings */ |
|
|
|
|
_rc.function[THROTTLE] = _parameters.rc_map_throttle - 1; |
|
|
|
@ -723,6 +737,7 @@ Sensors::parameters_update()
@@ -723,6 +737,7 @@ Sensors::parameters_update()
|
|
|
|
|
_rc.function[RETURN] = _parameters.rc_map_return_sw - 1; |
|
|
|
|
_rc.function[POSCTL] = _parameters.rc_map_posctl_sw - 1; |
|
|
|
|
_rc.function[LOITER] = _parameters.rc_map_loiter_sw - 1; |
|
|
|
|
_rc.function[ACRO] = _parameters.rc_map_acro_sw - 1; |
|
|
|
|
|
|
|
|
|
_rc.function[FLAPS] = _parameters.rc_map_flaps - 1; |
|
|
|
|
|
|
|
|
@ -1508,6 +1523,7 @@ Sensors::rc_poll()
@@ -1508,6 +1523,7 @@ Sensors::rc_poll()
|
|
|
|
|
manual.posctl_switch = get_rc_sw2pos_position(POSCTL, _parameters.rc_posctl_th, _parameters.rc_posctl_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.acro_switch = get_rc_sw2pos_position(ACRO, _parameters.rc_acro_th, _parameters.rc_acro_inv); |
|
|
|
|
|
|
|
|
|
/* publish manual_control_setpoint topic */ |
|
|
|
|
if (_manual_control_pub > 0) { |
|
|
|
|