mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-27 02:06:27 +08:00
params: use PWM_MAIN_* instead of PWM_FMU_*
This commit is contained in:
@@ -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_CT 6.5
|
||||||
param set-default CA_MC_R3_KM -0.05
|
param set-default CA_MC_R3_KM -0.05
|
||||||
|
|
||||||
param set-default PWM_FMU_FUNC1 101
|
param set-default PWM_MAIN_FUNC1 101
|
||||||
param set-default PWM_FMU_FUNC2 102
|
param set-default PWM_MAIN_FUNC2 102
|
||||||
param set-default PWM_FMU_FUNC3 103
|
param set-default PWM_MAIN_FUNC3 103
|
||||||
param set-default PWM_FMU_FUNC4 104
|
param set-default PWM_MAIN_FUNC4 104
|
||||||
|
|
||||||
set MIXER skip
|
set MIXER skip
|
||||||
set MIXER_AUX none
|
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_CT 9.5
|
||||||
param set-default CA_MC_R5_KM -0.05
|
param set-default CA_MC_R5_KM -0.05
|
||||||
|
|
||||||
param set-default PWM_FMU_FUNC1 101
|
param set-default PWM_MAIN_FUNC1 101
|
||||||
param set-default PWM_FMU_FUNC2 102
|
param set-default PWM_MAIN_FUNC2 102
|
||||||
param set-default PWM_FMU_FUNC3 103
|
param set-default PWM_MAIN_FUNC3 103
|
||||||
param set-default PWM_FMU_FUNC4 104
|
param set-default PWM_MAIN_FUNC4 104
|
||||||
param set-default PWM_FMU_FUNC5 105
|
param set-default PWM_MAIN_FUNC5 105
|
||||||
param set-default PWM_FMU_FUNC6 106
|
param set-default PWM_MAIN_FUNC6 106
|
||||||
|
|
||||||
set MAV_TYPE 13
|
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_CT 6.5
|
||||||
param set-default CA_MC_R3_KM -0.05
|
param set-default CA_MC_R3_KM -0.05
|
||||||
|
|
||||||
param set-default PWM_FMU_FUNC1 101
|
param set-default PWM_MAIN_FUNC1 101
|
||||||
param set-default PWM_FMU_FUNC2 102
|
param set-default PWM_MAIN_FUNC2 102
|
||||||
param set-default PWM_FMU_FUNC3 103
|
param set-default PWM_MAIN_FUNC3 103
|
||||||
param set-default PWM_FMU_FUNC4 104
|
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_CT 6.5
|
||||||
param set-default CA_MC_R5_KM -0.05
|
param set-default CA_MC_R5_KM -0.05
|
||||||
|
|
||||||
param set-default PWM_FMU_FUNC1 101
|
param set-default PWM_MAIN_FUNC1 101
|
||||||
param set-default PWM_FMU_FUNC2 102
|
param set-default PWM_MAIN_FUNC2 102
|
||||||
param set-default PWM_FMU_FUNC3 103
|
param set-default PWM_MAIN_FUNC3 103
|
||||||
param set-default PWM_FMU_FUNC4 104
|
param set-default PWM_MAIN_FUNC4 104
|
||||||
param set-default PWM_FMU_FUNC5 105
|
param set-default PWM_MAIN_FUNC5 105
|
||||||
param set-default PWM_FMU_FUNC6 106
|
param set-default PWM_MAIN_FUNC6 106
|
||||||
|
|
||||||
set MIXER skip
|
set MIXER skip
|
||||||
set MIXER_AUX none
|
set MIXER_AUX none
|
||||||
|
|||||||
@@ -31,6 +31,9 @@ parser.add_argument('--ethernet', action='store_true',
|
|||||||
help='Ethernet support')
|
help='Ethernet support')
|
||||||
parser.add_argument('--board', type=str, action='store',
|
parser.add_argument('--board', type=str, action='store',
|
||||||
help='board name, e.g. ')
|
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',
|
parser.add_argument('-v', '--verbose', dest='verbose', action='store_true',
|
||||||
help='Verbose Output')
|
help='Verbose Output')
|
||||||
|
|
||||||
@@ -40,23 +43,30 @@ verbose = args.verbose
|
|||||||
params_output_file = args.params_file
|
params_output_file = args.params_file
|
||||||
timer_config_file = args.timer_config
|
timer_config_file = args.timer_config
|
||||||
ethernet_supported = args.ethernet
|
ethernet_supported = args.ethernet
|
||||||
|
board_with_io = args.board_with_io
|
||||||
board = args.board
|
board = args.board
|
||||||
|
|
||||||
root_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)),"../..")
|
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")
|
output_functions_file = os.path.join(root_dir,"src/lib/mixer_module/output_functions.yaml")
|
||||||
|
|
||||||
def process_param_prefix(param_prefix):
|
def process_param_prefix(param_prefix):
|
||||||
if param_prefix == '${PWM_FMU_OR_HIL}':
|
if param_prefix == '${PWM_MAIN_OR_HIL}':
|
||||||
if board == 'px4_sitl': return 'PWM_FMU'
|
if board == 'px4_sitl': return 'PWM_MAIN'
|
||||||
return 'HIL_ACT'
|
return 'HIL_ACT'
|
||||||
|
if param_prefix == '${PWM_MAIN_OR_AUX}':
|
||||||
|
if board_with_io: return 'PWM_AUX'
|
||||||
|
return 'PWM_MAIN'
|
||||||
if '${' in param_prefix:
|
if '${' in param_prefix:
|
||||||
raise Exception('unhandled variable in {:}'.format(param_prefix))
|
raise Exception('unhandled variable in {:}'.format(param_prefix))
|
||||||
return param_prefix
|
return param_prefix
|
||||||
|
|
||||||
def process_channel_label(channel_label):
|
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'
|
if board == 'px4_sitl': return 'PWM Sim'
|
||||||
return 'HIL actuator'
|
return 'HIL actuator'
|
||||||
|
if channel_label == '${PWM_MAIN_OR_AUX}':
|
||||||
|
if board_with_io: return 'PWM Aux'
|
||||||
|
return 'PWM Main'
|
||||||
if '${' in channel_label:
|
if '${' in channel_label:
|
||||||
raise Exception('unhandled variable in {:}'.format(channel_label))
|
raise Exception('unhandled variable in {:}'.format(channel_label))
|
||||||
return 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
|
# We do this by extending the output_groups list and parse in a later iteration
|
||||||
if 'generator' in group:
|
if 'generator' in group:
|
||||||
if group['generator'] == 'pwm':
|
if group['generator'] == 'pwm':
|
||||||
# We might set these depending on presence of IO in build...
|
|
||||||
param_prefix = process_param_prefix(group['param_prefix'])
|
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', [])
|
standard_params = group.get('standard_params', [])
|
||||||
extra_function_groups = group.get('extra_function_groups', [])
|
extra_function_groups = group.get('extra_function_groups', [])
|
||||||
pwm_timer_param = group.get('pwm_timer_param', None)
|
pwm_timer_param = group.get('pwm_timer_param', None)
|
||||||
|
|||||||
@@ -256,6 +256,7 @@ if(EXISTS ${BOARD_DEFCONFIG})
|
|||||||
# IO board (placed in ROMFS)
|
# IO board (placed in ROMFS)
|
||||||
if(IO)
|
if(IO)
|
||||||
set(config_io_board ${IO} CACHE INTERNAL "IO" FORCE)
|
set(config_io_board ${IO} CACHE INTERNAL "IO" FORCE)
|
||||||
|
add_definitions(-DBOARD_WITH_IO)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(UAVCAN_PERIPHERALS)
|
if(UAVCAN_PERIPHERALS)
|
||||||
|
|||||||
@@ -140,7 +140,12 @@ private:
|
|||||||
|
|
||||||
void update_telemetry_num_motors();
|
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};
|
Telemetry *_telemetry{nullptr};
|
||||||
|
|
||||||
|
|||||||
@@ -130,7 +130,12 @@ private:
|
|||||||
|
|
||||||
static const int MAX_PER_INSTANCE{8};
|
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};
|
uint32_t _backup_schedule_interval_us{1_s};
|
||||||
|
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ module_name: PWM Output
|
|||||||
actuator_output:
|
actuator_output:
|
||||||
output_groups:
|
output_groups:
|
||||||
- generator: pwm
|
- generator: pwm
|
||||||
param_prefix: PWM_FMU
|
param_prefix: '${PWM_MAIN_OR_AUX}'
|
||||||
channel_labels: ['PWM Main', 'PWM Capture']
|
channel_labels: ['${PWM_MAIN_OR_AUX}', 'PWM Capture']
|
||||||
standard_params:
|
standard_params:
|
||||||
disarmed: { min: 800, max: 2200, default: 900 }
|
disarmed: { min: 800, max: 2200, default: 900 }
|
||||||
min: { min: 800, max: 1400, default: 1000 }
|
min: { min: 800, max: 1400, default: 1000 }
|
||||||
|
|||||||
@@ -45,7 +45,7 @@
|
|||||||
#include <uORB/topics/parameter_update.h>
|
#include <uORB/topics/parameter_update.h>
|
||||||
|
|
||||||
#if defined(CONFIG_ARCH_BOARD_PX4_SITL)
|
#if defined(CONFIG_ARCH_BOARD_PX4_SITL)
|
||||||
#define PARAM_PREFIX "PWM_FMU"
|
#define PARAM_PREFIX "PWM_MAIN"
|
||||||
#else
|
#else
|
||||||
#define PARAM_PREFIX "HIL_ACT"
|
#define PARAM_PREFIX "HIL_ACT"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
module_name: PWM Sim
|
module_name: PWM Sim
|
||||||
actuator_output:
|
actuator_output:
|
||||||
output_groups:
|
output_groups:
|
||||||
- param_prefix: ${PWM_FMU_OR_HIL}
|
- param_prefix: ${PWM_MAIN_OR_HIL}
|
||||||
channel_label: ${PWM_FMU_OR_HIL}
|
channel_label: ${PWM_MAIN_OR_HIL}
|
||||||
num_channels: 16
|
num_channels: 16
|
||||||
|
|
||||||
|
|||||||
@@ -79,6 +79,9 @@ endif()
|
|||||||
if(PX4_ETHERNET)
|
if(PX4_ETHERNET)
|
||||||
set(added_arguments --ethernet)
|
set(added_arguments --ethernet)
|
||||||
endif()
|
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}
|
add_custom_command(OUTPUT ${generated_serial_params_file} ${generated_module_params_file}
|
||||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${generated_params_dir}
|
COMMAND ${CMAKE_COMMAND} -E make_directory ${generated_params_dir}
|
||||||
COMMAND ${PYTHON_EXECUTABLE} ${PX4_SOURCE_DIR}/Tools/serial/generate_config.py
|
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
|
--config-files ${module_config_files} #--verbose
|
||||||
COMMAND ${PYTHON_EXECUTABLE} ${PX4_SOURCE_DIR}/Tools/module_config/generate_params.py
|
COMMAND ${PYTHON_EXECUTABLE} ${PX4_SOURCE_DIR}/Tools/module_config/generate_params.py
|
||||||
--params-file ${generated_module_params_file}
|
--params-file ${generated_module_params_file}
|
||||||
${added_arguments}
|
${added_arguments} ${board_with_io_arg}
|
||||||
--timer-config ${PX4_BOARD_DIR}/src/timer_config.cpp
|
--timer-config ${PX4_BOARD_DIR}/src/timer_config.cpp
|
||||||
--config-files ${module_config_files} #--verbose
|
--config-files ${module_config_files} #--verbose
|
||||||
--board ${PX4_BOARD}
|
--board ${PX4_BOARD}
|
||||||
|
|||||||
@@ -63,63 +63,6 @@ parameters:
|
|||||||
max: 2200
|
max: 2200
|
||||||
default: 1500
|
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}:
|
PWM_AUX_TRIM${i}:
|
||||||
description:
|
description:
|
||||||
short: PWM aux ${i} trim value
|
short: PWM aux ${i} trim value
|
||||||
|
|||||||
@@ -63,63 +63,6 @@ parameters:
|
|||||||
max: 2200
|
max: 2200
|
||||||
default: 900
|
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}:
|
PWM_MAIN_TRIM${i}:
|
||||||
description:
|
description:
|
||||||
short: PWM main ${i} trim value
|
short: PWM main ${i} trim value
|
||||||
|
|||||||
@@ -240,10 +240,10 @@ actuator_output:
|
|||||||
type: string
|
type: string
|
||||||
allowed: [ pwm ]
|
allowed: [ pwm ]
|
||||||
param_prefix:
|
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.
|
# This also needs to be specified in the source code.
|
||||||
type: string
|
type: string
|
||||||
regex: '([0-9A-Z_]+|\$\{PWM_FMU_OR_HIL\})'
|
regex: '([0-9A-Z_]+|\$\{PWM_MAIN_OR_AUX\}|\$\{PWM_MAIN_OR_HIL\})'
|
||||||
required: true
|
required: true
|
||||||
channel_label:
|
channel_label:
|
||||||
# Human-readable per-channel label (index will be added), e.g. 'PWM Main'
|
# Human-readable per-channel label (index will be added), e.g. 'PWM Main'
|
||||||
|
|||||||
Reference in New Issue
Block a user