mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-02 00:21:36 +08:00
Mixers: Use geometry filename as mixer name
This commit is contained in:
committed by
Beat Küng
parent
d43b33b1c4
commit
76447b0f4e
@@ -33,7 +33,7 @@
|
|||||||
|
|
||||||
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
||||||
|
|
||||||
set(geom_files
|
set(geometry_files
|
||||||
quad_x.toml
|
quad_x.toml
|
||||||
quad_h.toml
|
quad_h.toml
|
||||||
quad_plus.toml
|
quad_plus.toml
|
||||||
@@ -56,34 +56,34 @@ set(geom_files
|
|||||||
dodeca_bottom_cox.toml
|
dodeca_bottom_cox.toml
|
||||||
)
|
)
|
||||||
|
|
||||||
set(geom_list)
|
set(geometries_list)
|
||||||
foreach(geom_file ${geom_files})
|
foreach(geom_file ${geometry_files})
|
||||||
list(APPEND geom_list ${CMAKE_CURRENT_SOURCE_DIR}/geoms/${geom_file})
|
list(APPEND geometries_list ${CMAKE_CURRENT_SOURCE_DIR}/geometries/${geom_file})
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/mixer_multirotor.generated.h
|
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/mixer_multirotor.generated.h
|
||||||
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/geoms/tools/px_generate_mixers.py -f ${geom_list} -o ${CMAKE_CURRENT_BINARY_DIR}/mixer_multirotor.generated.h
|
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/geometries/tools/px_generate_mixers.py -f ${geometries_list} -o ${CMAKE_CURRENT_BINARY_DIR}/mixer_multirotor.generated.h
|
||||||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/geoms/tools/px_generate_mixers.py ${geom_list}
|
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/geometries/tools/px_generate_mixers.py ${geometries_list}
|
||||||
)
|
)
|
||||||
add_custom_target(mixer_gen
|
add_custom_target(mixer_gen
|
||||||
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/mixer_multirotor.generated.h
|
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/mixer_multirotor.generated.h
|
||||||
DEPENDS ${geom_list})
|
DEPENDS ${geometries_list})
|
||||||
|
|
||||||
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/mixer_multirotor_normalized.generated.h
|
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/mixer_multirotor_normalized.generated.h
|
||||||
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/geoms/tools/px_generate_mixers.py --normalize -f ${geom_list} -o ${CMAKE_CURRENT_BINARY_DIR}/mixer_multirotor_normalized.generated.h
|
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/geometries/tools/px_generate_mixers.py --normalize -f ${geometries_list} -o ${CMAKE_CURRENT_BINARY_DIR}/mixer_multirotor_normalized.generated.h
|
||||||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/geoms/tools/px_generate_mixers.py ${geom_list}
|
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/geometries/tools/px_generate_mixers.py ${geometries_list}
|
||||||
)
|
)
|
||||||
add_custom_target(mixer_gen_norm
|
add_custom_target(mixer_gen_norm
|
||||||
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/mixer_multirotor_normalized.generated.h
|
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/mixer_multirotor_normalized.generated.h
|
||||||
DEPENDS ${geom_list})
|
DEPENDS ${geometries_list})
|
||||||
|
|
||||||
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/mixer_multirotor_6dof.generated.h
|
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/mixer_multirotor_6dof.generated.h
|
||||||
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/geoms/tools/px_generate_mixers.py --sixdof -f ${geom_list} -o ${CMAKE_CURRENT_BINARY_DIR}/mixer_multirotor_6dof.generated.h
|
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/geometries/tools/px_generate_mixers.py --sixdof -f ${geometries_list} -o ${CMAKE_CURRENT_BINARY_DIR}/mixer_multirotor_6dof.generated.h
|
||||||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/geoms/tools/px_generate_mixers.py ${geom_list}
|
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/geometries/tools/px_generate_mixers.py ${geometries_list}
|
||||||
)
|
)
|
||||||
add_custom_target(mixer_gen_6dof
|
add_custom_target(mixer_gen_6dof
|
||||||
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/mixer_multirotor_6dof.generated.h
|
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/mixer_multirotor_6dof.generated.h
|
||||||
DEPENDS ${geom_list})
|
DEPENDS ${geometries_list})
|
||||||
|
|
||||||
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/mixer_multirotor_legacy.generated.h
|
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/mixer_multirotor_legacy.generated.h
|
||||||
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/multi_tables.py > ${CMAKE_CURRENT_BINARY_DIR}/mixer_multirotor_legacy.generated.h
|
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/multi_tables.py > ${CMAKE_CURRENT_BINARY_DIR}/mixer_multirotor_legacy.generated.h
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
# Generic Dodecacopter in X coax configuration, bottom half
|
# Generic Dodecacopter in X coax configuration, bottom half
|
||||||
|
|
||||||
[info]
|
[info]
|
||||||
name = "dodeca_bottom_cox"
|
|
||||||
key = "6a"
|
key = "6a"
|
||||||
description = "Generic Dodecacopter in X coax configuration, bottom half"
|
description = "Generic Dodecacopter in X coax configuration, bottom half"
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
# Generic Dodecacopter in X coax configuration, top half
|
# Generic Dodecacopter in X coax configuration, top half
|
||||||
|
|
||||||
[info]
|
[info]
|
||||||
name = "dodeca_top_cox"
|
|
||||||
key = "6m"
|
key = "6m"
|
||||||
description = "Generic Dodecacopter in X coax configuration, top half"
|
description = "Generic Dodecacopter in X coax configuration, top half"
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
# Generic Hexacopter in coaxial configuration
|
# Generic Hexacopter in coaxial configuration
|
||||||
|
|
||||||
[info]
|
[info]
|
||||||
name = "hex_cox"
|
|
||||||
key = "6c"
|
key = "6c"
|
||||||
description = "Generic Hexacopter in coaxial configuration"
|
description = "Generic Hexacopter in coaxial configuration"
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
# Generic Hexacopter in + configuration
|
# Generic Hexacopter in + configuration
|
||||||
|
|
||||||
[info]
|
[info]
|
||||||
name = "hex_plus"
|
|
||||||
key = "6+"
|
key = "6+"
|
||||||
description = "Generic Hexacopter in + configuration"
|
description = "Generic Hexacopter in + configuration"
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
# Generic Hexacopter in T configuration
|
# Generic Hexacopter in T configuration
|
||||||
|
|
||||||
[info]
|
[info]
|
||||||
name = "hex_t"
|
|
||||||
key = "6t"
|
key = "6t"
|
||||||
description = "Generic Hexacopter in T configuration"
|
description = "Generic Hexacopter in T configuration"
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
# Generic Hexacopter in X configuration
|
# Generic Hexacopter in X configuration
|
||||||
|
|
||||||
[info]
|
[info]
|
||||||
name = "hex_x"
|
|
||||||
key = "6x"
|
key = "6x"
|
||||||
description = "Generic Hexacopter in X configuration"
|
description = "Generic Hexacopter in X configuration"
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
# Generic Octacopter in coax configuration
|
# Generic Octacopter in coax configuration
|
||||||
|
|
||||||
[info]
|
[info]
|
||||||
name = "octa_cox"
|
|
||||||
key = "8c"
|
key = "8c"
|
||||||
description = "GenericOctacopter in coax configuration"
|
description = "GenericOctacopter in coax configuration"
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
# Generic Octacopter in wide coax configuration
|
# Generic Octacopter in wide coax configuration
|
||||||
|
|
||||||
[info]
|
[info]
|
||||||
name = "octa_cox_wide"
|
|
||||||
key = "8cw"
|
key = "8cw"
|
||||||
description = "Generic Octacopter in wide coax configuration"
|
description = "Generic Octacopter in wide coax configuration"
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
# Generic Octacopter in + configuration
|
# Generic Octacopter in + configuration
|
||||||
|
|
||||||
[info]
|
[info]
|
||||||
name = "octa_plus"
|
|
||||||
key = "8+"
|
key = "8+"
|
||||||
description = "Generic Octacopter in + configuration"
|
description = "Generic Octacopter in + configuration"
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
# Generic Octacopter in X configuration
|
# Generic Octacopter in X configuration
|
||||||
|
|
||||||
[info]
|
[info]
|
||||||
name = "octa_x"
|
|
||||||
key = "8x"
|
key = "8x"
|
||||||
description = "Generic Octacopter in X configuration"
|
description = "Generic Octacopter in X configuration"
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
# Same geometry as quad_wide, except CG is located at intersection of rear arms, so front motors are more loaded.
|
# Same geometry as quad_wide, except CG is located at intersection of rear arms, so front motors are more loaded.
|
||||||
|
|
||||||
[info]
|
[info]
|
||||||
name = "quad_deadcat"
|
|
||||||
key = "4dc"
|
key = "4dc"
|
||||||
description = "SK450 DeadCat Quadcopter, CG at intersection of rear arms"
|
description = "SK450 DeadCat Quadcopter, CG at intersection of rear arms"
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
# Generic Quadcopter in H configuration
|
# Generic Quadcopter in H configuration
|
||||||
|
|
||||||
[info]
|
[info]
|
||||||
name = "quad_h"
|
|
||||||
key = "4h"
|
key = "4h"
|
||||||
description = "Generic Quadcopter in H configuration"
|
description = "Generic Quadcopter in H configuration"
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
# Generic Quadcopter in + configuration
|
# Generic Quadcopter in + configuration
|
||||||
|
|
||||||
[info]
|
[info]
|
||||||
name = "quad_plus"
|
|
||||||
key = "4+"
|
key = "4+"
|
||||||
description = "Generic Quadcopter in + configuration"
|
description = "Generic Quadcopter in + configuration"
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
# Quadcopter in Y configuration with rear props tilted at 45 degrees
|
# Quadcopter in Y configuration with rear props tilted at 45 degrees
|
||||||
|
|
||||||
[info]
|
[info]
|
||||||
name = "quad_vtail"
|
|
||||||
key = "4vt"
|
key = "4vt"
|
||||||
description = "Quadcopter in Y configuration with rear props tilted at 45 degrees"
|
description = "Quadcopter in Y configuration with rear props tilted at 45 degrees"
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
# Generic Quadcopter in wide configuration
|
# Generic Quadcopter in wide configuration
|
||||||
|
|
||||||
[info]
|
[info]
|
||||||
name = "quad_wide"
|
|
||||||
key = "4w"
|
key = "4w"
|
||||||
description = "Quadcopter in wide configuration. Same geometry as SK450 Deadcat except the CG is moved backward to load all motors equally"
|
description = "Quadcopter in wide configuration. Same geometry as SK450 Deadcat except the CG is moved backward to load all motors equally"
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
# Generic Quadcopter in X configuration
|
# Generic Quadcopter in X configuration
|
||||||
|
|
||||||
[info]
|
[info]
|
||||||
name = "quad_x"
|
|
||||||
key = "4x"
|
key = "4x"
|
||||||
description = "Generic Quadcopter in X configuration"
|
description = "Generic Quadcopter in X configuration"
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
# with added pusher motor in the back
|
# with added pusher motor in the back
|
||||||
|
|
||||||
[info]
|
[info]
|
||||||
name = "quad_x_pusher"
|
|
||||||
key = "4x1p"
|
key = "4x1p"
|
||||||
description = "Quadcopter in X configuration, with added pusher motor in the back"
|
description = "Quadcopter in X configuration, with added pusher motor in the back"
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
# Quadcopter in Y configuration with coax rear props
|
# Quadcopter in Y configuration with coax rear props
|
||||||
|
|
||||||
[info]
|
[info]
|
||||||
name = "quad_y"
|
|
||||||
key = "4y"
|
key = "4y"
|
||||||
description = "Quadcopter in Y configuration with coax rear props"
|
description = "Quadcopter in Y configuration with coax rear props"
|
||||||
|
|
||||||
|
|||||||
@@ -67,6 +67,7 @@ def parse_geometry_toml(filename):
|
|||||||
'''
|
'''
|
||||||
Parses toml geometry file and returns a dictionary with curated list of rotors
|
Parses toml geometry file and returns a dictionary with curated list of rotors
|
||||||
'''
|
'''
|
||||||
|
import os
|
||||||
|
|
||||||
# Load toml file
|
# Load toml file
|
||||||
d = toml.load(filename)
|
d = toml.load(filename)
|
||||||
@@ -82,10 +83,12 @@ def parse_geometry_toml(filename):
|
|||||||
raise AttributeError('{}: Error, missing info section'.format(filename))
|
raise AttributeError('{}: Error, missing info section'.format(filename))
|
||||||
|
|
||||||
# Check info section
|
# Check info section
|
||||||
for field in ['name', 'key', 'description']:
|
for field in ['key', 'description']:
|
||||||
if field not in d['info']:
|
if field not in d['info']:
|
||||||
raise AttributeError('{}: Error, unspecified info field "{}"'.format(filename, field))
|
raise AttributeError('{}: Error, unspecified info field "{}"'.format(filename, field))
|
||||||
|
|
||||||
|
# Use filename as mixer name
|
||||||
|
d['info']['name'] = os.path.basename(filename).split('.')[0].lower()
|
||||||
|
|
||||||
# Convert rotors
|
# Convert rotors
|
||||||
rotor_list = []
|
rotor_list = []
|
||||||
@@ -234,7 +237,9 @@ def generate_mixer_multirotor_header(geometries_list, use_normalized_mix=False,
|
|||||||
# Print enum
|
# Print enum
|
||||||
buf.write(u"enum class MultirotorGeometry : MultirotorGeometryUnderlyingType {\n")
|
buf.write(u"enum class MultirotorGeometry : MultirotorGeometryUnderlyingType {\n")
|
||||||
for i, geometry in enumerate(geometries_list):
|
for i, geometry in enumerate(geometries_list):
|
||||||
buf.write(u"\t{} = {},\n".format(geometry['info']['name'].upper(), i))
|
buf.write(u"\t{},{}// {} (text key {})\n".format(
|
||||||
|
geometry['info']['name'].upper(), ' ' * (max(0, 30 - len(geometry['info']['name']))),
|
||||||
|
geometry['info']['description'], geometry['info']['key']))
|
||||||
buf.write(u"\n\tMAX_GEOMETRY\n")
|
buf.write(u"\n\tMAX_GEOMETRY\n")
|
||||||
buf.write(u"}; // enum class MultirotorGeometry\n\n")
|
buf.write(u"}; // enum class MultirotorGeometry\n\n")
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
# Tri Y
|
# Tri Y
|
||||||
|
|
||||||
[info]
|
[info]
|
||||||
name = "tri_y"
|
|
||||||
key = "3y"
|
key = "3y"
|
||||||
description = "Tri Y"
|
description = "Tri Y"
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
# Twin engine
|
# Twin engine
|
||||||
|
|
||||||
[info]
|
[info]
|
||||||
name = "twin_engine"
|
|
||||||
key = "2-"
|
key = "2-"
|
||||||
description = "Twin engine"
|
description = "Twin engine"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user