From d36c0e131dd7a1df78cad313c07d6ae8bdeaf950 Mon Sep 17 00:00:00 2001 From: Roman Date: Wed, 6 Mar 2019 17:20:16 +0100 Subject: [PATCH] added aux6 RC channel Signed-off-by: Roman --- msg/manual_control_setpoint.msg | 1 + msg/rc_channels.msg | 5 +++-- src/modules/sensors/parameters.cpp | 2 ++ src/modules/sensors/parameters.h | 2 ++ src/modules/sensors/rc_params.c | 27 +++++++++++++++++++++++++++ src/modules/sensors/rc_update.cpp | 2 ++ src/modules/vmount/input_rc.cpp | 3 +++ src/modules/vmount/vmount_params.c | 3 +++ 8 files changed, 43 insertions(+), 2 deletions(-) diff --git a/msg/manual_control_setpoint.msg b/msg/manual_control_setpoint.msg index 59215ffec4..10c66a9227 100644 --- a/msg/manual_control_setpoint.msg +++ b/msg/manual_control_setpoint.msg @@ -48,6 +48,7 @@ float32 aux2 # default function: camera pitch / tilt float32 aux3 # default function: camera trigger float32 aux4 # default function: camera roll float32 aux5 # default function: payload drop +float32 aux6 uint8 mode_switch # main mode 3 position switch (mandatory): _MANUAL_, ASSIST, AUTO uint8 return_switch # return to launch 2 position switch (mandatory): _NORMAL_, RTL diff --git a/msg/rc_channels.msg b/msg/rc_channels.msg index eef6064ed7..8986ffb5a5 100644 --- a/msg/rc_channels.msg +++ b/msg/rc_channels.msg @@ -25,12 +25,13 @@ uint8 RC_CHANNELS_FUNCTION_TRANSITION=21 uint8 RC_CHANNELS_FUNCTION_GEAR=22 uint8 RC_CHANNELS_FUNCTION_ARMSWITCH=23 uint8 RC_CHANNELS_FUNCTION_STAB=24 -uint8 RC_CHANNELS_FUNCTION_MAN=25 +uint8 RC_CHANNELS_FUNCTION_AUX_6=25 +uint8 RC_CHANNELS_FUNCTION_MAN=26 uint64 timestamp_last_valid # Timestamp of last valid RC signal float32[18] channels # Scaled to -1..1 (throttle: 0..1) uint8 channel_count # Number of valid channels -int8[26] function # Functions mapping +int8[27] function # Functions mapping uint8 rssi # Receive signal strength index bool signal_lost # Control signal lost, should be checked together with topic timeout uint32 frame_drop_count # Number of dropped frames diff --git a/src/modules/sensors/parameters.cpp b/src/modules/sensors/parameters.cpp index 83cc29b039..67a81f8b3a 100644 --- a/src/modules/sensors/parameters.cpp +++ b/src/modules/sensors/parameters.cpp @@ -101,6 +101,7 @@ void initialize_parameter_handles(ParameterHandles ¶meter_handles) parameter_handles.rc_map_aux3 = param_find("RC_MAP_AUX3"); parameter_handles.rc_map_aux4 = param_find("RC_MAP_AUX4"); parameter_handles.rc_map_aux5 = param_find("RC_MAP_AUX5"); + parameter_handles.rc_map_aux6 = param_find("RC_MAP_AUX6"); /* RC to parameter mapping for changing parameters with RC */ for (int i = 0; i < rc_parameter_map_s::RC_PARAM_MAP_NCHAN; i++) { @@ -314,6 +315,7 @@ int update_parameters(const ParameterHandles ¶meter_handles, Parameters &par param_get(parameter_handles.rc_map_aux3, &(parameters.rc_map_aux3)); 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_aux6, &(parameters.rc_map_aux6)); for (int i = 0; i < rc_parameter_map_s::RC_PARAM_MAP_NCHAN; i++) { param_get(parameter_handles.rc_map_param[i], &(parameters.rc_map_param[i])); diff --git a/src/modules/sensors/parameters.h b/src/modules/sensors/parameters.h index 8bb5712c5b..19004fce09 100644 --- a/src/modules/sensors/parameters.h +++ b/src/modules/sensors/parameters.h @@ -98,6 +98,7 @@ struct Parameters { int32_t rc_map_aux3; int32_t rc_map_aux4; int32_t rc_map_aux5; + int32_t rc_map_aux6; int32_t rc_map_param[rc_parameter_map_s::RC_PARAM_MAP_NCHAN]; @@ -190,6 +191,7 @@ struct ParameterHandles { param_t rc_map_aux3; param_t rc_map_aux4; param_t rc_map_aux5; + param_t rc_map_aux6; param_t rc_map_param[rc_parameter_map_s::RC_PARAM_MAP_NCHAN]; param_t rc_param[rc_parameter_map_s::RC_PARAM_MAP_NCHAN]; /**< param handles for the parameters which are bound diff --git a/src/modules/sensors/rc_params.c b/src/modules/sensors/rc_params.c index dd6fea51ac..eb5834b786 100644 --- a/src/modules/sensors/rc_params.c +++ b/src/modules/sensors/rc_params.c @@ -1872,6 +1872,33 @@ PARAM_DEFINE_INT32(RC_MAP_AUX4, 0); */ PARAM_DEFINE_INT32(RC_MAP_AUX5, 0); +/** + * AUX6 Passthrough RC channel + * + * @min 0 + * @max 18 + * @group Radio Calibration + * @value 0 Unassigned + * @value 1 Channel 1 + * @value 2 Channel 2 + * @value 3 Channel 3 + * @value 4 Channel 4 + * @value 5 Channel 5 + * @value 6 Channel 6 + * @value 7 Channel 7 + * @value 8 Channel 8 + * @value 9 Channel 9 + * @value 10 Channel 10 + * @value 11 Channel 11 + * @value 12 Channel 12 + * @value 13 Channel 13 + * @value 14 Channel 14 + * @value 15 Channel 15 + * @value 16 Channel 16 + * @value 17 Channel 17 + * @value 18 Channel 18 + */ +PARAM_DEFINE_INT32(RC_MAP_AUX6, 0); /** * PARAM1 tuning channel * diff --git a/src/modules/sensors/rc_update.cpp b/src/modules/sensors/rc_update.cpp index f915b9760a..05479c38c2 100644 --- a/src/modules/sensors/rc_update.cpp +++ b/src/modules/sensors/rc_update.cpp @@ -114,6 +114,7 @@ void RCUpdate::update_rc_functions() _rc.function[rc_channels_s::RC_CHANNELS_FUNCTION_AUX_3] = _parameters.rc_map_aux3 - 1; _rc.function[rc_channels_s::RC_CHANNELS_FUNCTION_AUX_4] = _parameters.rc_map_aux4 - 1; _rc.function[rc_channels_s::RC_CHANNELS_FUNCTION_AUX_5] = _parameters.rc_map_aux5 - 1; + _rc.function[rc_channels_s::RC_CHANNELS_FUNCTION_AUX_6] = _parameters.rc_map_aux6 - 1; for (int i = 0; i < rc_parameter_map_s::RC_PARAM_MAP_NCHAN; i++) { _rc.function[rc_channels_s::RC_CHANNELS_FUNCTION_PARAM_1 + i] = _parameters.rc_map_param[i] - 1; @@ -379,6 +380,7 @@ RCUpdate::rc_poll(const ParameterHandles ¶meter_handles) manual.aux3 = get_rc_value(rc_channels_s::RC_CHANNELS_FUNCTION_AUX_3, -1.0, 1.0); manual.aux4 = get_rc_value(rc_channels_s::RC_CHANNELS_FUNCTION_AUX_4, -1.0, 1.0); manual.aux5 = get_rc_value(rc_channels_s::RC_CHANNELS_FUNCTION_AUX_5, -1.0, 1.0); + manual.aux6 = get_rc_value(rc_channels_s::RC_CHANNELS_FUNCTION_AUX_6, -1.0, 1.0); /* filter controls */ manual.y = math::constrain(_filter_roll.apply(manual.y), -1.f, 1.f); diff --git a/src/modules/vmount/input_rc.cpp b/src/modules/vmount/input_rc.cpp index 2d2494a54d..2cf61f8767 100644 --- a/src/modules/vmount/input_rc.cpp +++ b/src/modules/vmount/input_rc.cpp @@ -166,6 +166,9 @@ float InputRC::_get_aux_value(const manual_control_setpoint_s &manual_control_se case 5: return manual_control_setpoint.aux5; + case 6: + return manual_control_setpoint.aux6; + default: return 0.0f; } diff --git a/src/modules/vmount/vmount_params.c b/src/modules/vmount/vmount_params.c index 4562e69558..619cd40423 100644 --- a/src/modules/vmount/vmount_params.c +++ b/src/modules/vmount/vmount_params.c @@ -121,6 +121,7 @@ PARAM_DEFINE_FLOAT(MNT_OB_LOCK_MODE, 0.0f); * @value 3 AUX3 * @value 4 AUX4 * @value 5 AUX5 +* @value 6 AUX6 * @min 0 * @max 5 * @group Mount @@ -136,6 +137,7 @@ PARAM_DEFINE_INT32(MNT_MAN_ROLL, 0); * @value 3 AUX3 * @value 4 AUX4 * @value 5 AUX5 +* @value 6 AUX6 * @min 0 * @max 5 * @group Mount @@ -151,6 +153,7 @@ PARAM_DEFINE_INT32(MNT_MAN_PITCH, 0); * @value 3 AUX3 * @value 4 AUX4 * @value 5 AUX5 +* @value 6 AUX6 * @min 0 * @max 5 * @group Mount