diff --git a/EKF/CMakeLists.txt b/EKF/CMakeLists.txt index 6400204045..9a97cf63d1 100644 --- a/EKF/CMakeLists.txt +++ b/EKF/CMakeLists.txt @@ -37,7 +37,7 @@ project (ECL CXX) set(CMAKE_BUILD_TYPE Release) set(CMAKE_CURRENT_SOURCE_DIR ./) set(CMAKE_CXX_FLAGS "-DPOSIX_SHARED") -set (EIGEN3_INCLUDE_DIR "/usr/local/include/eigen3/") +set(EIGEN3_INCLUDE_DIR "/usr/local/include/eigen3/") IF( NOT EIGEN3_INCLUDE_DIR ) MESSAGE( FATAL_ERROR "Please point the environment variable EIGEN3_INCLUDE_DIR to the include directory of your Eigen3 installation.") @@ -69,5 +69,5 @@ set(SRCS geo.cpp mathlib.cpp ) -add_definitions(-std=c++11) -add_library(ecl SHARED ${SRCS}) \ No newline at end of file +add_definitions(-std=c++11 -Wall -Werror) +add_library(ecl SHARED ${SRCS}) diff --git a/EKF/airspeed_fusion.cpp b/EKF/airspeed_fusion.cpp index 3ec6a8e141..ae57e343c6 100644 --- a/EKF/airspeed_fusion.cpp +++ b/EKF/airspeed_fusion.cpp @@ -196,9 +196,6 @@ void Ekf::fuseAirspeed() _state.quat_nominal.normalize(); // update covariance matrix via Pnew = (I - KH)P = P - KHP - float KH[_k_num_states][_k_num_states] = {}; - float KHP[_k_num_states][_k_num_states] = {}; - for (unsigned row = 0; row < _k_num_states; row++) { for (unsigned column = 0; column < _k_num_states; column++) { // Here it will be a lot of zeros, should optimize that... KH[row][column] = Kfusion[row] * H_TAS[column]; @@ -222,4 +219,4 @@ void Ekf::fuseAirspeed() makeSymmetrical(); limitCov(); } -} \ No newline at end of file +} diff --git a/EKF/gps_checks.cpp b/EKF/gps_checks.cpp index 47206c9d9a..45f903dfec 100644 --- a/EKF/gps_checks.cpp +++ b/EKF/gps_checks.cpp @@ -197,10 +197,10 @@ bool Ekf::gps_is_good(struct gps_message *gps) // This check can only be used if the vehicle is stationary during alignment if (!_control_status.flags.armed) { vel_limit = 10.0f * _params.req_hdrift; - float velN = fminf(fmaxf(gps->vel_ned[0], -vel_limit), vel_limit); - float velE = fminf(fmaxf(gps->vel_ned[1], -vel_limit), vel_limit); - _gps_velN_filt = velN * filter_coef + _gps_velN_filt * (1.0f - filter_coef); - _gps_velE_filt = velE * filter_coef + _gps_velE_filt * (1.0f - filter_coef); + float gps_velN = fminf(fmaxf(gps->vel_ned[0], -vel_limit), vel_limit); + float gps_velE = fminf(fmaxf(gps->vel_ned[1], -vel_limit), vel_limit); + _gps_velN_filt = gps_velN * filter_coef + _gps_velN_filt * (1.0f - filter_coef); + _gps_velE_filt = gps_velE * filter_coef + _gps_velE_filt * (1.0f - filter_coef); float horiz_speed = sqrtf(_gps_velN_filt * _gps_velN_filt + _gps_velE_filt * _gps_velE_filt); _gps_check_fail_status.flags.hspeed = (horiz_speed > _params.req_hdrift); diff --git a/EKF/vel_pos_fusion.cpp b/EKF/vel_pos_fusion.cpp index acc430c176..75165a1cf5 100644 --- a/EKF/vel_pos_fusion.cpp +++ b/EKF/vel_pos_fusion.cpp @@ -246,8 +246,6 @@ void Ekf::fuseVelPosHeight() _state.quat_nominal.normalize(); // update covarinace matrix via Pnew = (I - KH)P - float KHP[_k_num_states][_k_num_states] = {}; - for (unsigned row = 0; row < _k_num_states; row++) { for (unsigned column = 0; column < _k_num_states; column++) { KHP[row][column] = Kfusion[row] * P[state_index][column];