mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-06-19 01:31:29 +08:00
Compare commits
4 Commits
pr-singlew
...
pr-ekf2_sy
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d24d6681fd | ||
|
|
c22f725d85 | ||
|
|
7fab93ede8 | ||
|
|
0a665a526c |
@ -455,6 +455,7 @@
|
||||
#define RC_SERIAL_SINGLEWIRE 1 // Suport Single wire wiring
|
||||
#define RC_SERIAL_SWAP_RXTX 1 // Set Swap (but not supported in HW) to use Single wire
|
||||
#define RC_SERIAL_SWAP_USING_SINGLEWIRE 1 // Set to use Single wire swap as HW does not support swap
|
||||
#define BOARD_SUPPORTS_RC_SERIAL_PORT_OUTPUT
|
||||
|
||||
/* FLEXSPI4 */
|
||||
|
||||
|
||||
@ -104,9 +104,10 @@ const struct flexspi_nor_config_s g_flash_fast_config = {
|
||||
.busyBitPolarity = 0u,
|
||||
.lookupTable =
|
||||
{
|
||||
/* Read */// EEH+11H+32bit addr+20dummy cycles+ 4Bytes read data //200Mhz 18 dummy=10+8
|
||||
/* Read */// EEH+11H+32bit addr+20dummy cycles+ 4Bytes read data
|
||||
/* Macronix manual says 20 dummy cycles @ 200Mhz, FlexSPI peripheral Operand value needs to be 2N in DDR mode hence 0x28 */
|
||||
[0 + 0] = FLEXSPI_LUT_SEQ(CMD_DDR, FLEXSPI_8PAD, 0xEE, CMD_DDR, FLEXSPI_8PAD, 0x11), //0x871187ee,
|
||||
[0 + 1] = FLEXSPI_LUT_SEQ(RADDR_DDR, FLEXSPI_8PAD, 0x20, DUMMY_DDR, FLEXSPI_8PAD, 0x04),//0xb3048b20,
|
||||
[0 + 1] = FLEXSPI_LUT_SEQ(RADDR_DDR, FLEXSPI_8PAD, 0x20, DUMMY_DDR, FLEXSPI_8PAD, 0x28),//0xb3288b20,
|
||||
[0 + 2] = FLEXSPI_LUT_SEQ(READ_DDR, FLEXSPI_8PAD, 0x04, STOP_EXE, FLEXSPI_1PAD, 0x00), //0xa704,
|
||||
|
||||
/* Read status */
|
||||
|
||||
@ -314,7 +314,7 @@ void RCInput::swap_rx_tx()
|
||||
# ifdef TIOCSSINGLEWIRE
|
||||
|
||||
if (rv != OK) {
|
||||
ioctl(_rcs_fd, TIOCSSINGLEWIRE, SER_SINGLEWIRE_ENABLED | SER_SINGLEWIRE_PUSHPULL);
|
||||
ioctl(_rcs_fd, TIOCSSINGLEWIRE, SER_SINGLEWIRE_ENABLED);
|
||||
}
|
||||
|
||||
# else
|
||||
|
||||
@ -33,43 +33,19 @@
|
||||
|
||||
add_subdirectory(Utility)
|
||||
|
||||
option(EKF2_SYMFORCE_GEN "ekf2 generate symforce output" OFF)
|
||||
option(EKF2_SYMFORCE_GEN "ekf2 generate symforce output" ON)
|
||||
|
||||
# Symforce code generation TODO:fixme
|
||||
# Symforce code generation
|
||||
execute_process(
|
||||
COMMAND ${PYTHON_EXECUTABLE} -m symforce.symbolic
|
||||
RESULT_VARIABLE PYTHON_SYMFORCE_EXIT_CODE
|
||||
OUTPUT_QUIET
|
||||
)
|
||||
|
||||
# for now only provide symforce target helper if derivation.py generation isn't default
|
||||
if((NOT CONFIG_EKF2_MAGNETOMETER) OR (NOT CONFIG_EKF2_WIND))
|
||||
set(EKF2_SYMFORCE_GEN ON)
|
||||
endif()
|
||||
|
||||
set(EKF_DERIVATION_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/EKF/python/ekf_derivation)
|
||||
|
||||
set(EKF_GENERATED_FILES ${EKF_DERIVATION_SRC_DIR}/generated/state.h)
|
||||
set(EKF_GENERATED_DERIVATION_INCLUDE_PATH "${EKF_DERIVATION_SRC_DIR}/..")
|
||||
|
||||
if(EKF2_SYMFORCE_GEN AND (${PYTHON_SYMFORCE_EXIT_CODE} EQUAL 0))
|
||||
|
||||
# regenerate default in tree
|
||||
add_custom_command(
|
||||
OUTPUT
|
||||
${EKF_DERIVATION_SRC_DIR}/generated/predict_covariance.h
|
||||
${EKF_DERIVATION_SRC_DIR}/generated/state.h
|
||||
COMMAND
|
||||
${PYTHON_EXECUTABLE} ${EKF_DERIVATION_SRC_DIR}/derivation.py
|
||||
DEPENDS
|
||||
${EKF_DERIVATION_SRC_DIR}/derivation.py
|
||||
${EKF_DERIVATION_SRC_DIR}/utils/derivation_utils.py
|
||||
|
||||
WORKING_DIRECTORY ${EKF_DERIVATION_SRC_DIR}
|
||||
COMMENT "Symforce code generation (default)"
|
||||
USES_TERMINAL
|
||||
)
|
||||
|
||||
# generate to build directory
|
||||
set(EKF_DERIVATION_DST_DIR ${CMAKE_CURRENT_BINARY_DIR}/ekf_derivation)
|
||||
file(MAKE_DIRECTORY ${EKF_DERIVATION_DST_DIR})
|
||||
@ -91,8 +67,7 @@ if(EKF2_SYMFORCE_GEN AND (${PYTHON_SYMFORCE_EXIT_CODE} EQUAL 0))
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT
|
||||
${EKF_DERIVATION_DST_DIR}/generated/predict_covariance.h
|
||||
${EKF_DERIVATION_DST_DIR}/generated/state.h
|
||||
${EKF_GENERATED_FILES}
|
||||
COMMAND
|
||||
${PYTHON_EXECUTABLE} ${EKF_DERIVATION_SRC_DIR}/derivation.py ${SYMFORCE_ARGS}
|
||||
DEPENDS
|
||||
@ -100,19 +75,29 @@ if(EKF2_SYMFORCE_GEN AND (${PYTHON_SYMFORCE_EXIT_CODE} EQUAL 0))
|
||||
${EKF_DERIVATION_SRC_DIR}/utils/derivation_utils.py
|
||||
|
||||
WORKING_DIRECTORY ${EKF_DERIVATION_DST_DIR}
|
||||
COMMENT "Symforce code generation"
|
||||
COMMENT "ekf2 symforce code generation"
|
||||
#USES_TERMINAL
|
||||
)
|
||||
else()
|
||||
# generation disabled or symforce not available, use pre-generated default files in tree (src/modules/ekf2/EKF/python/ekf_derivation/generated)
|
||||
set(EKF_GENERATED_FILES ${EKF_DERIVATION_SRC_DIR}/generated/state.h)
|
||||
set(EKF_GENERATED_DERIVATION_INCLUDE_PATH "${EKF_DERIVATION_SRC_DIR}/..")
|
||||
endif()
|
||||
|
||||
# symforce in tree code generation helper
|
||||
if(${PYTHON_SYMFORCE_EXIT_CODE} EQUAL 0)
|
||||
# regenerate default symforce output in tree (src/modules/ekf2/EKF/python/ekf_derivation/generated)
|
||||
add_custom_target(ekf2_generate_symforce_default
|
||||
COMMAND ${PYTHON_EXECUTABLE} ${EKF_DERIVATION_SRC_DIR}/derivation.py
|
||||
DEPENDS ${EKF_DERIVATION_SRC_DIR}/derivation.py
|
||||
WORKING_DIRECTORY ${EKF_DERIVATION_SRC_DIR}
|
||||
COMMENT "Symforce code generation (default)"
|
||||
USES_TERMINAL
|
||||
)
|
||||
|
||||
|
||||
|
||||
add_custom_target(ekf2_symforce_generate
|
||||
DEPENDS
|
||||
${EKF_DERIVATION_SRC_DIR}/generated/predict_covariance.h
|
||||
${EKF_DERIVATION_DST_DIR}/generated/predict_covariance.h
|
||||
)
|
||||
endif()
|
||||
|
||||
add_custom_target(ekf_symforce_generated DEPENDS ${EKF_GENERATED_FILES})
|
||||
|
||||
set(EKF_LIBS)
|
||||
set(EKF_SRCS)
|
||||
list(APPEND EKF_SRCS
|
||||
@ -257,9 +242,11 @@ px4_add_module(
|
||||
px4_work_queue
|
||||
world_magnetic_model
|
||||
|
||||
ekf_symforce_generated
|
||||
${EKF_LIBS}
|
||||
bias_estimator
|
||||
output_predictor
|
||||
|
||||
UNITY_BUILD
|
||||
)
|
||||
|
||||
|
||||
@ -142,7 +142,7 @@ add_library(ecl_EKF
|
||||
${EKF_SRCS}
|
||||
)
|
||||
|
||||
add_dependencies(ecl_EKF prebuild_targets)
|
||||
add_dependencies(ecl_EKF prebuild_targets ekf_symforce_generated)
|
||||
target_include_directories(ecl_EKF PUBLIC ${EKF_GENERATED_DERIVATION_INCLUDE_PATH})
|
||||
|
||||
target_link_libraries(ecl_EKF
|
||||
|
||||
@ -130,7 +130,9 @@ void Ekf::controlMagFusion()
|
||||
_innov_check_fail_status.flags.reject_mag_z = (aid_src.test_ratio[2] > 1.f);
|
||||
|
||||
// determine if we should use mag fusion
|
||||
bool continuing_conditions_passing = (_params.mag_fusion_type != MagFuseType::NONE)
|
||||
bool continuing_conditions_passing = ((_params.mag_fusion_type == MagFuseType::INIT)
|
||||
|| (_params.mag_fusion_type == MagFuseType::AUTO)
|
||||
|| (_params.mag_fusion_type == MagFuseType::HEADING))
|
||||
&& _control_status.flags.tilt_align
|
||||
&& (_control_status.flags.yaw_align || (!_control_status.flags.ev_yaw && !_control_status.flags.yaw_align))
|
||||
&& mag_sample.mag.longerThan(0.f)
|
||||
|
||||
@ -101,7 +101,8 @@ enum MagFuseType : uint8_t {
|
||||
// Integer definitions for mag_fusion_type
|
||||
AUTO = 0, ///< The selection of either heading or 3D magnetometer fusion will be automatic
|
||||
HEADING = 1, ///< Simple yaw angle fusion will always be used. This is less accurate, but less affected by earth field distortions. It should not be used for pitch angles outside the range from -60 to +60 deg
|
||||
NONE = 5 ///< Do not use magnetometer under any circumstance..
|
||||
NONE = 5, ///< Do not use magnetometer under any circumstance.
|
||||
INIT = 6 ///< Use the mag for heading initialization only.
|
||||
};
|
||||
#endif // CONFIG_EKF2_MAGNETOMETER
|
||||
|
||||
|
||||
@ -769,6 +769,7 @@ void EKF2::VerifyParams()
|
||||
if ((_param_ekf2_mag_type.get() != MagFuseType::AUTO)
|
||||
&& (_param_ekf2_mag_type.get() != MagFuseType::HEADING)
|
||||
&& (_param_ekf2_mag_type.get() != MagFuseType::NONE)
|
||||
&& (_param_ekf2_mag_type.get() != MagFuseType::INIT)
|
||||
) {
|
||||
|
||||
mavlink_log_critical(&_mavlink_log_pub, "EKF2_MAG_TYPE invalid, resetting to default");
|
||||
|
||||
@ -401,19 +401,18 @@ parameters:
|
||||
heading or 3-component vector. The fusion of magnetometer data as a three
|
||||
component vector enables vehicle body fixed hard iron errors to be learned,
|
||||
but requires a stable earth field. If set to 'Automatic' magnetic heading
|
||||
fusion is used when on-ground and 3-axis magnetic field fusion in-flight
|
||||
with fallback to magnetic heading fusion if there is insufficient motion
|
||||
to make yaw or magnetic field states observable. If set to 'Magnetic heading'
|
||||
magnetic heading fusion is used at all times. If set to 'None' the magnetometer
|
||||
will not be used under any circumstance. If no external source of yaw is
|
||||
available, it is possible to use post-takeoff horizontal movement combined
|
||||
with GPS velocity measurements to align the yaw angle with the timer required
|
||||
(depending on the amount of movement and GPS data quality).
|
||||
fusion is used when on-ground and 3-axis magnetic field fusion in-flight.
|
||||
If set to 'Magnetic heading' magnetic heading fusion is used at all times.
|
||||
If set to 'None' the magnetometer will not be used under any circumstance.
|
||||
If no external source of yaw is available, it is possible to use post-takeoff
|
||||
horizontal movement combined with GNSS velocity measurements to align the yaw angle.
|
||||
If set to 'Init' the magnetometer is only used to initalize the heading.
|
||||
type: enum
|
||||
values:
|
||||
0: Automatic
|
||||
1: Magnetic heading
|
||||
5: None
|
||||
6: Init
|
||||
default: 0
|
||||
reboot_required: true
|
||||
EKF2_MAG_ACCLIM:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user