forked from Archive/PX4-Autopilot
params: use PWM_MAIN_* instead of PWM_FMU_*
This commit is contained in:
parent
ba4a1ec6c4
commit
ab1d76ae7d
|
@ -46,10 +46,10 @@ param set-default CA_MC_R3_PY 0.1875
|
|||
param set-default CA_MC_R3_CT 6.5
|
||||
param set-default CA_MC_R3_KM -0.05
|
||||
|
||||
param set-default PWM_FMU_FUNC1 101
|
||||
param set-default PWM_FMU_FUNC2 102
|
||||
param set-default PWM_FMU_FUNC3 103
|
||||
param set-default PWM_FMU_FUNC4 104
|
||||
param set-default PWM_MAIN_FUNC1 101
|
||||
param set-default PWM_MAIN_FUNC2 102
|
||||
param set-default PWM_MAIN_FUNC3 103
|
||||
param set-default PWM_MAIN_FUNC4 104
|
||||
|
||||
set MIXER skip
|
||||
set MIXER_AUX none
|
||||
|
|
|
@ -76,12 +76,12 @@ param set-default CA_MC_R5_PY -0.5
|
|||
param set-default CA_MC_R5_CT 9.5
|
||||
param set-default CA_MC_R5_KM -0.05
|
||||
|
||||
param set-default PWM_FMU_FUNC1 101
|
||||
param set-default PWM_FMU_FUNC2 102
|
||||
param set-default PWM_FMU_FUNC3 103
|
||||
param set-default PWM_FMU_FUNC4 104
|
||||
param set-default PWM_FMU_FUNC5 105
|
||||
param set-default PWM_FMU_FUNC6 106
|
||||
param set-default PWM_MAIN_FUNC1 101
|
||||
param set-default PWM_MAIN_FUNC2 102
|
||||
param set-default PWM_MAIN_FUNC3 103
|
||||
param set-default PWM_MAIN_FUNC4 104
|
||||
param set-default PWM_MAIN_FUNC5 105
|
||||
param set-default PWM_MAIN_FUNC6 106
|
||||
|
||||
set MAV_TYPE 13
|
||||
|
||||
|
|
|
@ -52,8 +52,8 @@ param set-default CA_MC_R3_PY 0.177
|
|||
param set-default CA_MC_R3_CT 6.5
|
||||
param set-default CA_MC_R3_KM -0.05
|
||||
|
||||
param set-default PWM_FMU_FUNC1 101
|
||||
param set-default PWM_FMU_FUNC2 102
|
||||
param set-default PWM_FMU_FUNC3 103
|
||||
param set-default PWM_FMU_FUNC4 104
|
||||
param set-default PWM_MAIN_FUNC1 101
|
||||
param set-default PWM_MAIN_FUNC2 102
|
||||
param set-default PWM_MAIN_FUNC3 103
|
||||
param set-default PWM_MAIN_FUNC4 104
|
||||
|
||||
|
|
|
@ -66,12 +66,12 @@ param set-default CA_MC_R5_PY -0.1375
|
|||
param set-default CA_MC_R5_CT 6.5
|
||||
param set-default CA_MC_R5_KM -0.05
|
||||
|
||||
param set-default PWM_FMU_FUNC1 101
|
||||
param set-default PWM_FMU_FUNC2 102
|
||||
param set-default PWM_FMU_FUNC3 103
|
||||
param set-default PWM_FMU_FUNC4 104
|
||||
param set-default PWM_FMU_FUNC5 105
|
||||
param set-default PWM_FMU_FUNC6 106
|
||||
param set-default PWM_MAIN_FUNC1 101
|
||||
param set-default PWM_MAIN_FUNC2 102
|
||||
param set-default PWM_MAIN_FUNC3 103
|
||||
param set-default PWM_MAIN_FUNC4 104
|
||||
param set-default PWM_MAIN_FUNC5 105
|
||||
param set-default PWM_MAIN_FUNC6 106
|
||||
|
||||
set MIXER skip
|
||||
set MIXER_AUX none
|
||||
|
|
|
@ -31,6 +31,9 @@ parser.add_argument('--ethernet', action='store_true',
|
|||
help='Ethernet support')
|
||||
parser.add_argument('--board', type=str, action='store',
|
||||
help='board name, e.g. ')
|
||||
parser.add_argument('--board-with-io', dest='board_with_io', action='store_true',
|
||||
help='Indicate that the board as an IO for extra PWM',
|
||||
default=False)
|
||||
parser.add_argument('-v', '--verbose', dest='verbose', action='store_true',
|
||||
help='Verbose Output')
|
||||
|
||||
|
@ -40,23 +43,30 @@ verbose = args.verbose
|
|||
params_output_file = args.params_file
|
||||
timer_config_file = args.timer_config
|
||||
ethernet_supported = args.ethernet
|
||||
board_with_io = args.board_with_io
|
||||
board = args.board
|
||||
|
||||
root_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)),"../..")
|
||||
output_functions_file = os.path.join(root_dir,"src/lib/mixer_module/output_functions.yaml")
|
||||
|
||||
def process_param_prefix(param_prefix):
|
||||
if param_prefix == '${PWM_FMU_OR_HIL}':
|
||||
if board == 'px4_sitl': return 'PWM_FMU'
|
||||
if param_prefix == '${PWM_MAIN_OR_HIL}':
|
||||
if board == 'px4_sitl': return 'PWM_MAIN'
|
||||
return 'HIL_ACT'
|
||||
if param_prefix == '${PWM_MAIN_OR_AUX}':
|
||||
if board_with_io: return 'PWM_AUX'
|
||||
return 'PWM_MAIN'
|
||||
if '${' in param_prefix:
|
||||
raise Exception('unhandled variable in {:}'.format(param_prefix))
|
||||
return param_prefix
|
||||
|
||||
def process_channel_label(channel_label):
|
||||
if channel_label == '${PWM_FMU_OR_HIL}':
|
||||
if channel_label == '${PWM_MAIN_OR_HIL}':
|
||||
if board == 'px4_sitl': return 'PWM Sim'
|
||||
return 'HIL actuator'
|
||||
if channel_label == '${PWM_MAIN_OR_AUX}':
|
||||
if board_with_io: return 'PWM Aux'
|
||||
return 'PWM Main'
|
||||
if '${' in channel_label:
|
||||
raise Exception('unhandled variable in {:}'.format(channel_label))
|
||||
return channel_label
|
||||
|
@ -171,9 +181,8 @@ def get_actuator_output_params(yaml_config, output_functions,
|
|||
# We do this by extending the output_groups list and parse in a later iteration
|
||||
if 'generator' in group:
|
||||
if group['generator'] == 'pwm':
|
||||
# We might set these depending on presence of IO in build...
|
||||
param_prefix = process_param_prefix(group['param_prefix'])
|
||||
channel_labels = group['channel_labels']
|
||||
channel_labels = [process_channel_label(label) for label in group['channel_labels']]
|
||||
standard_params = group.get('standard_params', [])
|
||||
extra_function_groups = group.get('extra_function_groups', [])
|
||||
pwm_timer_param = group.get('pwm_timer_param', None)
|
||||
|
|
|
@ -256,6 +256,7 @@ if(EXISTS ${BOARD_DEFCONFIG})
|
|||
# IO board (placed in ROMFS)
|
||||
if(IO)
|
||||
set(config_io_board ${IO} CACHE INTERNAL "IO" FORCE)
|
||||
add_definitions(-DBOARD_WITH_IO)
|
||||
endif()
|
||||
|
||||
if(UAVCAN_PERIPHERALS)
|
||||
|
|
|
@ -140,7 +140,12 @@ private:
|
|||
|
||||
void update_telemetry_num_motors();
|
||||
|
||||
MixingOutput _mixing_output{"PWM_FMU", DIRECT_PWM_OUTPUT_CHANNELS, *this, MixingOutput::SchedulingPolicy::Auto, false, false};
|
||||
#ifdef BOARD_WITH_IO
|
||||
# define PARAM_PREFIX "PWM_AUX"
|
||||
#else
|
||||
# define PARAM_PREFIX "PWM_MAIN"
|
||||
#endif
|
||||
MixingOutput _mixing_output {PARAM_PREFIX, DIRECT_PWM_OUTPUT_CHANNELS, *this, MixingOutput::SchedulingPolicy::Auto, false, false};
|
||||
|
||||
Telemetry *_telemetry{nullptr};
|
||||
|
||||
|
|
|
@ -130,7 +130,12 @@ private:
|
|||
|
||||
static const int MAX_PER_INSTANCE{8};
|
||||
|
||||
MixingOutput _mixing_output{"PWM_FMU", FMU_MAX_ACTUATORS, *this, MixingOutput::SchedulingPolicy::Auto, true};
|
||||
#ifdef BOARD_WITH_IO
|
||||
# define PARAM_PREFIX "PWM_AUX"
|
||||
#else
|
||||
# define PARAM_PREFIX "PWM_MAIN"
|
||||
#endif
|
||||
MixingOutput _mixing_output {PARAM_PREFIX, FMU_MAX_ACTUATORS, *this, MixingOutput::SchedulingPolicy::Auto, true};
|
||||
|
||||
uint32_t _backup_schedule_interval_us{1_s};
|
||||
|
||||
|
|
|
@ -2,8 +2,8 @@ module_name: PWM Output
|
|||
actuator_output:
|
||||
output_groups:
|
||||
- generator: pwm
|
||||
param_prefix: PWM_FMU
|
||||
channel_labels: ['PWM Main', 'PWM Capture']
|
||||
param_prefix: '${PWM_MAIN_OR_AUX}'
|
||||
channel_labels: ['${PWM_MAIN_OR_AUX}', 'PWM Capture']
|
||||
standard_params:
|
||||
disarmed: { min: 800, max: 2200, default: 900 }
|
||||
min: { min: 800, max: 1400, default: 1000 }
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
#include <uORB/topics/parameter_update.h>
|
||||
|
||||
#if defined(CONFIG_ARCH_BOARD_PX4_SITL)
|
||||
#define PARAM_PREFIX "PWM_FMU"
|
||||
#define PARAM_PREFIX "PWM_MAIN"
|
||||
#else
|
||||
#define PARAM_PREFIX "HIL_ACT"
|
||||
#endif
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
module_name: PWM Sim
|
||||
actuator_output:
|
||||
output_groups:
|
||||
- param_prefix: ${PWM_FMU_OR_HIL}
|
||||
channel_label: ${PWM_FMU_OR_HIL}
|
||||
- param_prefix: ${PWM_MAIN_OR_HIL}
|
||||
channel_label: ${PWM_MAIN_OR_HIL}
|
||||
num_channels: 16
|
||||
|
||||
|
|
|
@ -79,6 +79,9 @@ endif()
|
|||
if(PX4_ETHERNET)
|
||||
set(added_arguments --ethernet)
|
||||
endif()
|
||||
if(config_io_board)
|
||||
set(board_with_io_arg --board-with-io)
|
||||
endif()
|
||||
add_custom_command(OUTPUT ${generated_serial_params_file} ${generated_module_params_file}
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${generated_params_dir}
|
||||
COMMAND ${PYTHON_EXECUTABLE} ${PX4_SOURCE_DIR}/Tools/serial/generate_config.py
|
||||
|
@ -87,7 +90,7 @@ add_custom_command(OUTPUT ${generated_serial_params_file} ${generated_module_par
|
|||
--config-files ${module_config_files} #--verbose
|
||||
COMMAND ${PYTHON_EXECUTABLE} ${PX4_SOURCE_DIR}/Tools/module_config/generate_params.py
|
||||
--params-file ${generated_module_params_file}
|
||||
${added_arguments}
|
||||
${added_arguments} ${board_with_io_arg}
|
||||
--timer-config ${PX4_BOARD_DIR}/src/timer_config.cpp
|
||||
--config-files ${module_config_files} #--verbose
|
||||
--board ${PX4_BOARD}
|
||||
|
|
|
@ -63,63 +63,6 @@ parameters:
|
|||
max: 2200
|
||||
default: 1500
|
||||
|
||||
PWM_AUX_MIN${i}:
|
||||
description:
|
||||
short: PWM aux ${i} minimum value
|
||||
long: |
|
||||
This is the minimum PWM pulse the autopilot is allowed to output.
|
||||
When set to -1 the value for PWM_AUX_MIN will be used
|
||||
type: int32
|
||||
unit: us
|
||||
min: -1
|
||||
max: 1600
|
||||
num_instances: *max_num_config_instances
|
||||
instance_start: 1
|
||||
default: -1
|
||||
|
||||
PWM_AUX_MAX${i}:
|
||||
description:
|
||||
short: PWM aux ${i} maximum value
|
||||
long: |
|
||||
This is the maximum PWM pulse the autopilot is allowed to output.
|
||||
When set to -1 the value for PWM_AUX_MAX will be used
|
||||
type: int32
|
||||
unit: us
|
||||
min: -1
|
||||
max: 2150
|
||||
num_instances: *max_num_config_instances
|
||||
instance_start: 1
|
||||
default: -1
|
||||
|
||||
PWM_AUX_FAIL${i}:
|
||||
description:
|
||||
short: PWM aux ${i} failsafe value
|
||||
long: |
|
||||
This is the PWM pulse the autopilot is outputting if in failsafe mode.
|
||||
When set to -1 the value is set automatically depending if the actuator
|
||||
is a motor (900us) or a servo (1500us)
|
||||
type: int32
|
||||
unit: us
|
||||
min: -1
|
||||
max: 2150
|
||||
num_instances: *max_num_config_instances
|
||||
instance_start: 1
|
||||
default: -1
|
||||
|
||||
PWM_AUX_DIS${i}:
|
||||
description:
|
||||
short: PWM aux ${i} disarmed value
|
||||
long: |
|
||||
This is the PWM pulse the autopilot is outputting if not armed.
|
||||
When set to -1 the value for PWM_AUX_DISARM will be used
|
||||
type: int32
|
||||
unit: us
|
||||
min: -1
|
||||
max: 2150
|
||||
num_instances: *max_num_config_instances
|
||||
instance_start: 1
|
||||
default: -1
|
||||
|
||||
PWM_AUX_TRIM${i}:
|
||||
description:
|
||||
short: PWM aux ${i} trim value
|
||||
|
|
|
@ -63,63 +63,6 @@ parameters:
|
|||
max: 2200
|
||||
default: 900
|
||||
|
||||
PWM_MAIN_MIN${i}:
|
||||
description:
|
||||
short: PWM main ${i} minimum value
|
||||
long: |
|
||||
This is the minimum PWM pulse the autopilot is allowed to output.
|
||||
When set to -1 the value for PWM_MAIN_MIN will be used
|
||||
type: int32
|
||||
unit: us
|
||||
min: -1
|
||||
max: 1600
|
||||
num_instances: *max_num_config_instances
|
||||
instance_start: 1
|
||||
default: -1
|
||||
|
||||
PWM_MAIN_MAX${i}:
|
||||
description:
|
||||
short: PWM main ${i} maximum value
|
||||
long: |
|
||||
This is the maximum PWM pulse the autopilot is allowed to output.
|
||||
When set to -1 the value for PWM_MAIN_MAX will be used
|
||||
type: int32
|
||||
unit: us
|
||||
min: -1
|
||||
max: 2150
|
||||
num_instances: *max_num_config_instances
|
||||
instance_start: 1
|
||||
default: -1
|
||||
|
||||
PWM_MAIN_FAIL${i}:
|
||||
description:
|
||||
short: PWM main ${i} failsafe value
|
||||
long: |
|
||||
This is the PWM pulse the autopilot is outputting if in failsafe mode.
|
||||
When set to -1 the value is set automatically depending if the actuator
|
||||
is a motor (900us) or a servo (1500us)
|
||||
type: int32
|
||||
unit: us
|
||||
min: -1
|
||||
max: 2150
|
||||
num_instances: *max_num_config_instances
|
||||
instance_start: 1
|
||||
default: -1
|
||||
|
||||
PWM_MAIN_DIS${i}:
|
||||
description:
|
||||
short: PWM main ${i} disarmed value
|
||||
long: |
|
||||
This is the PWM pulse the autopilot is outputting if not armed.
|
||||
When set to -1 the value for PWM_MAIN_DISARM will be used
|
||||
type: int32
|
||||
unit: us
|
||||
min: -1
|
||||
max: 2150
|
||||
num_instances: *max_num_config_instances
|
||||
instance_start: 1
|
||||
default: -1
|
||||
|
||||
PWM_MAIN_TRIM${i}:
|
||||
description:
|
||||
short: PWM main ${i} trim value
|
||||
|
|
|
@ -240,10 +240,10 @@ actuator_output:
|
|||
type: string
|
||||
allowed: [ pwm ]
|
||||
param_prefix:
|
||||
# parameter prefix for the min/max/disarmed/func params, e.g. PWM_FMU.
|
||||
# parameter prefix for the min/max/disarmed/func params, e.g. PWM_MAIN.
|
||||
# This also needs to be specified in the source code.
|
||||
type: string
|
||||
regex: '([0-9A-Z_]+|\$\{PWM_FMU_OR_HIL\})'
|
||||
regex: '([0-9A-Z_]+|\$\{PWM_MAIN_OR_AUX\}|\$\{PWM_MAIN_OR_HIL\})'
|
||||
required: true
|
||||
channel_label:
|
||||
# Human-readable per-channel label (index will be added), e.g. 'PWM Main'
|
||||
|
|
Loading…
Reference in New Issue