Compare commits

..

1 Commits

Author SHA1 Message Date
Peter van der Perk
c00ed78dda rc_input: singlewire use push_pull 2024-06-01 19:15:42 +02:00
9 changed files with 51 additions and 43 deletions

View File

@ -455,7 +455,6 @@
#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 */

View File

@ -104,10 +104,9 @@ const struct flexspi_nor_config_s g_flash_fast_config = {
.busyBitPolarity = 0u,
.lookupTable =
{
/* 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 */
/* Read */// EEH+11H+32bit addr+20dummy cycles+ 4Bytes read data //200Mhz 18 dummy=10+8
[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, 0x28),//0xb3288b20,
[0 + 1] = FLEXSPI_LUT_SEQ(RADDR_DDR, FLEXSPI_8PAD, 0x20, DUMMY_DDR, FLEXSPI_8PAD, 0x04),//0xb3048b20,
[0 + 2] = FLEXSPI_LUT_SEQ(READ_DDR, FLEXSPI_8PAD, 0x04, STOP_EXE, FLEXSPI_1PAD, 0x00), //0xa704,
/* Read status */

View File

@ -314,7 +314,7 @@ void RCInput::swap_rx_tx()
# ifdef TIOCSSINGLEWIRE
if (rv != OK) {
ioctl(_rcs_fd, TIOCSSINGLEWIRE, SER_SINGLEWIRE_ENABLED);
ioctl(_rcs_fd, TIOCSSINGLEWIRE, SER_SINGLEWIRE_ENABLED | SER_SINGLEWIRE_PUSHPULL);
}
# else

View File

@ -33,19 +33,43 @@
add_subdirectory(Utility)
option(EKF2_SYMFORCE_GEN "ekf2 generate symforce output" ON)
option(EKF2_SYMFORCE_GEN "ekf2 generate symforce output" OFF)
# Symforce code generation
# Symforce code generation TODO:fixme
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})
@ -67,7 +91,8 @@ if(EKF2_SYMFORCE_GEN AND (${PYTHON_SYMFORCE_EXIT_CODE} EQUAL 0))
add_custom_command(
OUTPUT
${EKF_GENERATED_FILES}
${EKF_DERIVATION_DST_DIR}/generated/predict_covariance.h
${EKF_DERIVATION_DST_DIR}/generated/state.h
COMMAND
${PYTHON_EXECUTABLE} ${EKF_DERIVATION_SRC_DIR}/derivation.py ${SYMFORCE_ARGS}
DEPENDS
@ -75,28 +100,18 @@ 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 "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)"
COMMENT "Symforce code generation"
USES_TERMINAL
)
endif()
add_custom_target(ekf_symforce_generated DEPENDS ${EKF_GENERATED_FILES})
add_custom_target(ekf2_symforce_generate
DEPENDS
${EKF_DERIVATION_SRC_DIR}/generated/predict_covariance.h
${EKF_DERIVATION_DST_DIR}/generated/predict_covariance.h
)
endif()
set(EKF_LIBS)
set(EKF_SRCS)
@ -242,11 +257,9 @@ px4_add_module(
px4_work_queue
world_magnetic_model
ekf_symforce_generated
${EKF_LIBS}
bias_estimator
output_predictor
UNITY_BUILD
)

View File

@ -142,7 +142,7 @@ add_library(ecl_EKF
${EKF_SRCS}
)
add_dependencies(ecl_EKF prebuild_targets ekf_symforce_generated)
add_dependencies(ecl_EKF prebuild_targets)
target_include_directories(ecl_EKF PUBLIC ${EKF_GENERATED_DERIVATION_INCLUDE_PATH})
target_link_libraries(ecl_EKF

View File

@ -130,9 +130,7 @@ 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::INIT)
|| (_params.mag_fusion_type == MagFuseType::AUTO)
|| (_params.mag_fusion_type == MagFuseType::HEADING))
bool continuing_conditions_passing = (_params.mag_fusion_type != MagFuseType::NONE)
&& _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)

View File

@ -101,8 +101,7 @@ 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.
INIT = 6 ///< Use the mag for heading initialization only.
NONE = 5 ///< Do not use magnetometer under any circumstance..
};
#endif // CONFIG_EKF2_MAGNETOMETER

View File

@ -769,7 +769,6 @@ 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");

View File

@ -401,18 +401,19 @@ 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.
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.
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).
type: enum
values:
0: Automatic
1: Magnetic heading
5: None
6: Init
default: 0
reboot_required: true
EKF2_MAG_ACCLIM: