cmake add all EKF sources (#243)

- trivial cmake cleanup
 - travis-ci build with both gcc and clang
 - update matrix to latest (matches PX4)
 - closes #240
This commit is contained in:
Daniel Agar
2017-02-27 00:46:48 -05:00
committed by GitHub
parent 507f48a147
commit eb4f5ecbb9
7 changed files with 76 additions and 54 deletions
+18 -11
View File
@@ -1,16 +1,23 @@
language: cpp language: cpp
sudo: required
compiler: g++
before_install: matrix:
- sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test fast_finish: true
- sudo apt-get update -qq include:
- os: linux
dist: trusty
compiler: gcc
- os: linux
dist: trusty
compiler: clang
env: CC=clang CXX=clang++
install: addons:
- sudo apt-get install -qq g++-4.8 libeigen3-dev apt:
- export CXX="g++-4.8" packages:
- clang
before_script: - cmake
- chmod +x build.sh - g++
- gcc
- libeigen3-dev
script: ./build.sh script: ./build.sh
+13 -13
View File
@@ -40,23 +40,23 @@ px4_add_module(
attitude_fw/ecl_controller.cpp attitude_fw/ecl_controller.cpp
attitude_fw/ecl_pitch_controller.cpp attitude_fw/ecl_pitch_controller.cpp
attitude_fw/ecl_roll_controller.cpp attitude_fw/ecl_roll_controller.cpp
attitude_fw/ecl_yaw_controller.cpp
attitude_fw/ecl_wheel_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 l1/ecl_l1_pos_controller.cpp
validation/data_validator.cpp validation/data_validator.cpp
validation/data_validator_group.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 DEPENDS
platforms__common platforms__common
) )
+40 -26
View File
@@ -33,47 +33,61 @@
cmake_minimum_required(VERSION 2.8) cmake_minimum_required(VERSION 2.8)
project (ECL CXX) project(ECL CXX)
set(CMAKE_BUILD_TYPE Release)
set(CMAKE_CXX_FLAGS "-DPOSIX_SHARED")
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}) set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR})
# Find Eigen
message("looking for FindEigen3.cmake in ${CMAKE_MODULE_PATH}") message("looking for FindEigen3.cmake in ${CMAKE_MODULE_PATH}")
find_package(Eigen3 REQUIRED) find_package(Eigen3 REQUIRED)
if(NOT EIGEN3_INCLUDE_DIR)
if( NOT EIGEN3_INCLUDE_DIR ) message(FATAL_ERROR "Eigen3 not found.")
message( FATAL_ERROR "Eigen3 not found.")
endif() endif()
if( NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/../matrix/.git" ) set(MATRIX_DIR ${CMAKE_SOURCE_DIR}/../matrix)
message( SEND_ERROR "The git submodules are not available. Please run if(NOT EXISTS "${MATRIX_DIR}/.git")
git submodule update --init --recursive" message(SEND_ERROR "The git submodules are not available. Please run git submodule update --init --recursive")
)
endif() endif()
include_directories( include_directories(
./ ..
../ ${MATRIX_DIR}
../matrix
${EIGEN3_INCLUDE_DIR} ${EIGEN3_INCLUDE_DIR}
) )
set(SRCS set(SRCS
estimator_interface.cpp airspeed_fusion.cpp
control.cpp
covariance.cpp
ekf.cpp ekf.cpp
ekf_helper.cpp ekf_helper.cpp
covariance.cpp estimator_interface.cpp
vel_pos_fusion.cpp
mag_fusion.cpp
gps_checks.cpp
airspeed_fusion.cpp
sideslip_fusion.cpp
control.cpp
geo.cpp geo.cpp
gps_checks.cpp
mag_fusion.cpp
mathlib.cpp mathlib.cpp
) optflow_fusion.cpp
add_definitions(-std=c++11 -Wall -Werror) sideslip_fusion.cpp
terrain_estimator.cpp
vel_pos_fusion.cpp
)
# Eigen throws various warnings add_definitions(-DPOSIX_SHARED)
add_definitions(-Wno-deprecated-declarations -Wno-enum-compare -Wno-unused-local-typedefs) 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}) add_library(ecl SHARED ${SRCS})
+2
View File
@@ -42,6 +42,8 @@
#include "ekf.h" #include "ekf.h"
#include "mathlib.h" #include "mathlib.h"
using std::abs;
// Reset the velocity states. If we have a recent and valid // Reset the velocity states. If we have a recent and valid
// gps measurement then use for velocity initialisation // gps measurement then use for velocity initialisation
bool Ekf::resetVelocity() bool Ekf::resetVelocity()
+1 -2
View File
@@ -52,7 +52,6 @@
namespace math namespace math
{ {
// using namespace Eigen; // using namespace Eigen;
using namespace std;
float min(float val1, float val2); float min(float val1, float val2);
float max(float val1, float val2); float max(float val1, float val2);
@@ -64,4 +63,4 @@ float degrees(float radians);
#else #else
#include <mathlib/mathlib.h> #include <mathlib/mathlib.h>
#endif //POSIX_SHARED #endif //POSIX_SHARED
#endif //MATHLIB_H #endif //MATHLIB_H
+1 -1
View File
@@ -36,7 +36,7 @@
set -e set -e
# Build EKF shared library. # Build EKF shared library.
mkdir Build mkdir Build -p
cd Build cd Build
cmake ../EKF cmake ../EKF
make make
+1 -1
Submodule matrix updated: db4374882b...cf924956d7