diff --git a/.travis.yml b/.travis.yml index d4d3d338c1..f23dc37247 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,16 +1,23 @@ language: cpp -sudo: required -compiler: g++ -before_install: -- sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test -- sudo apt-get update -qq +matrix: + fast_finish: true + include: + - os: linux + dist: trusty + compiler: gcc + - os: linux + dist: trusty + compiler: clang + env: CC=clang CXX=clang++ -install: -- sudo apt-get install -qq g++-4.8 libeigen3-dev -- export CXX="g++-4.8" - -before_script: - - chmod +x build.sh +addons: + apt: + packages: + - clang + - cmake + - g++ + - gcc + - libeigen3-dev script: ./build.sh diff --git a/CMakeLists.txt b/CMakeLists.txt index 12d688ee7d..351fe611ce 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -40,23 +40,23 @@ px4_add_module( attitude_fw/ecl_controller.cpp attitude_fw/ecl_pitch_controller.cpp attitude_fw/ecl_roll_controller.cpp - attitude_fw/ecl_yaw_controller.cpp attitude_fw/ecl_wheel_controller.cpp + attitude_fw/ecl_yaw_controller.cpp + EKF/airspeed_fusion.cpp + EKF/control.cpp + EKF/covariance.cpp + EKF/ekf.cpp + EKF/ekf_helper.cpp + EKF/estimator_interface.cpp + EKF/gps_checks.cpp + EKF/mag_fusion.cpp + EKF/optflow_fusion.cpp + EKF/sideslip_fusion.cpp + EKF/terrain_estimator.cpp + EKF/vel_pos_fusion.cpp l1/ecl_l1_pos_controller.cpp validation/data_validator.cpp validation/data_validator_group.cpp - EKF/estimator_interface.cpp - EKF/ekf.cpp - EKF/ekf_helper.cpp - EKF/covariance.cpp - EKF/vel_pos_fusion.cpp - EKF/mag_fusion.cpp - EKF/gps_checks.cpp - EKF/airspeed_fusion.cpp - EKF/sideslip_fusion.cpp - EKF/optflow_fusion.cpp - EKF/control.cpp - EKF/terrain_estimator.cpp DEPENDS platforms__common ) diff --git a/EKF/CMakeLists.txt b/EKF/CMakeLists.txt index 0d7d6a93e9..10d92ad81a 100644 --- a/EKF/CMakeLists.txt +++ b/EKF/CMakeLists.txt @@ -33,47 +33,61 @@ cmake_minimum_required(VERSION 2.8) -project (ECL CXX) -set(CMAKE_BUILD_TYPE Release) -set(CMAKE_CXX_FLAGS "-DPOSIX_SHARED") +project(ECL CXX) +set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}) + +# Find Eigen message("looking for FindEigen3.cmake in ${CMAKE_MODULE_PATH}") find_package(Eigen3 REQUIRED) - -if( NOT EIGEN3_INCLUDE_DIR ) - message( FATAL_ERROR "Eigen3 not found.") +if(NOT EIGEN3_INCLUDE_DIR) + message(FATAL_ERROR "Eigen3 not found.") endif() -if( NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/../matrix/.git" ) -message( SEND_ERROR "The git submodules are not available. Please run -git submodule update --init --recursive" -) +set(MATRIX_DIR ${CMAKE_SOURCE_DIR}/../matrix) +if(NOT EXISTS "${MATRIX_DIR}/.git") + message(SEND_ERROR "The git submodules are not available. Please run git submodule update --init --recursive") endif() include_directories( - ./ - ../ - ../matrix + .. + ${MATRIX_DIR} ${EIGEN3_INCLUDE_DIR} -) + ) + set(SRCS - estimator_interface.cpp + airspeed_fusion.cpp + control.cpp + covariance.cpp ekf.cpp ekf_helper.cpp - covariance.cpp - vel_pos_fusion.cpp - mag_fusion.cpp - gps_checks.cpp - airspeed_fusion.cpp - sideslip_fusion.cpp - control.cpp + estimator_interface.cpp geo.cpp + gps_checks.cpp + mag_fusion.cpp mathlib.cpp -) -add_definitions(-std=c++11 -Wall -Werror) + optflow_fusion.cpp + sideslip_fusion.cpp + terrain_estimator.cpp + vel_pos_fusion.cpp + ) -# Eigen throws various warnings -add_definitions(-Wno-deprecated-declarations -Wno-enum-compare -Wno-unused-local-typedefs) +add_definitions(-DPOSIX_SHARED) +add_compile_options( + -pedantic + -std=c++11 + -Wall + -Werror + -Wno-deprecated-declarations + -Wno-enum-compare + -Wno-unused-local-typedefs + -Wno-unused-parameter + ) + +# clang tolerate unknown gcc options +if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + add_compile_options(-Wno-unknown-warning-option) +endif() add_library(ecl SHARED ${SRCS}) diff --git a/EKF/ekf_helper.cpp b/EKF/ekf_helper.cpp index 12ec0a9d2e..5f22cdf25a 100644 --- a/EKF/ekf_helper.cpp +++ b/EKF/ekf_helper.cpp @@ -42,6 +42,8 @@ #include "ekf.h" #include "mathlib.h" +using std::abs; + // Reset the velocity states. If we have a recent and valid // gps measurement then use for velocity initialisation bool Ekf::resetVelocity() diff --git a/EKF/mathlib.h b/EKF/mathlib.h index 0c96a8f9d4..f84fedfb9c 100644 --- a/EKF/mathlib.h +++ b/EKF/mathlib.h @@ -52,7 +52,6 @@ namespace math { // using namespace Eigen; -using namespace std; float min(float val1, float val2); float max(float val1, float val2); @@ -64,4 +63,4 @@ float degrees(float radians); #else #include #endif //POSIX_SHARED -#endif //MATHLIB_H \ No newline at end of file +#endif //MATHLIB_H diff --git a/build.sh b/build.sh index 5daff21095..281e3e3e12 100755 --- a/build.sh +++ b/build.sh @@ -36,7 +36,7 @@ set -e # Build EKF shared library. -mkdir Build +mkdir Build -p cd Build cmake ../EKF make diff --git a/matrix b/matrix index db4374882b..cf924956d7 160000 --- a/matrix +++ b/matrix @@ -1 +1 @@ -Subproject commit db4374882bba122cb55370c5ea5efacbb8aa11c1 +Subproject commit cf924956d7d62ce18bfc4f8441e9177ddb69c0dc