mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-15 10:57:34 +08:00
wind_estimator: cmake add symforce generation helper target (wind_estimator_generate_airspeed_fusion)
This commit is contained in:
@@ -36,3 +36,12 @@ add_library(wind_estimator
|
||||
WindEstimator.hpp
|
||||
)
|
||||
add_dependencies(wind_estimator prebuild_targets)
|
||||
|
||||
add_custom_target(wind_estimator_generate_airspeed_fusion
|
||||
COMMAND ${PYTHON_EXECUTABLE} derivation.py
|
||||
#DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/python/derivation.py
|
||||
#BYPRODUCTS ${CMAKE_CURRENT_SOURCE_DIR}/python/generated/fuse_airspeed.h
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/python
|
||||
COMMENT "Generating fuse_airspeed"
|
||||
USES_TERMINAL
|
||||
)
|
||||
|
||||
@@ -44,7 +44,6 @@ import fileinput
|
||||
with fileinput.FileInput(os.path.abspath(metadata.generated_files[0]), inplace=True, backup='.bak') as file:
|
||||
for line in file:
|
||||
line = line.replace("std::max", "math::max")
|
||||
line = line.replace("std", "matrix")
|
||||
line = line.replace("Eigen", "matrix")
|
||||
line = line.replace("matrix/Dense", "matrix/math.hpp")
|
||||
print(line, end='')
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
*.bak
|
||||
@@ -43,8 +43,8 @@ void FuseAirspeed(const matrix::Matrix<Scalar, 3, 1>& v_local,
|
||||
// Intermediate terms (11)
|
||||
const Scalar _tmp0 = -state(0, 0) + v_local(0, 0);
|
||||
const Scalar _tmp1 = -state(1, 0) + v_local(1, 0);
|
||||
const Scalar _tmp2 = matrix::sqrt(Scalar(matrix::pow(_tmp0, Scalar(2)) + matrix::pow(_tmp1, Scalar(2)) +
|
||||
epsilon + matrix::pow(v_local(2, 0), Scalar(2))));
|
||||
const Scalar _tmp2 = std::sqrt(Scalar(std::pow(_tmp0, Scalar(2)) + std::pow(_tmp1, Scalar(2)) +
|
||||
epsilon + std::pow(v_local(2, 0), Scalar(2))));
|
||||
const Scalar _tmp3 = state(2, 0) / _tmp2;
|
||||
const Scalar _tmp4 = _tmp0 * _tmp3;
|
||||
const Scalar _tmp5 = _tmp1 * _tmp3;
|
||||
|
||||
Reference in New Issue
Block a user