Browse Source

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
master
Daniel Agar 8 years ago committed by GitHub
parent
commit
eb4f5ecbb9
  1. 29
      .travis.yml
  2. 22
      CMakeLists.txt
  3. 66
      EKF/CMakeLists.txt
  4. 2
      EKF/ekf_helper.cpp
  5. 3
      EKF/mathlib.h
  6. 2
      build.sh
  7. 2
      matrix

29
.travis.yml

@ -1,16 +1,23 @@ @@ -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

22
CMakeLists.txt

@ -40,23 +40,23 @@ px4_add_module( @@ -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
l1/ecl_l1_pos_controller.cpp
validation/data_validator.cpp
validation/data_validator_group.cpp
EKF/estimator_interface.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/covariance.cpp
EKF/vel_pos_fusion.cpp
EKF/mag_fusion.cpp
EKF/estimator_interface.cpp
EKF/gps_checks.cpp
EKF/airspeed_fusion.cpp
EKF/sideslip_fusion.cpp
EKF/mag_fusion.cpp
EKF/optflow_fusion.cpp
EKF/control.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
DEPENDS
platforms__common
)

66
EKF/CMakeLists.txt

@ -33,47 +33,61 @@ @@ -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
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
covariance.cpp
ekf.cpp
ekf_helper.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})

2
EKF/ekf_helper.cpp

@ -42,6 +42,8 @@ @@ -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()

3
EKF/mathlib.h

@ -52,7 +52,6 @@ @@ -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); @@ -64,4 +63,4 @@ float degrees(float radians);
#else
#include <mathlib/mathlib.h>
#endif //POSIX_SHARED
#endif //MATHLIB_H
#endif //MATHLIB_H

2
build.sh

@ -36,7 +36,7 @@ @@ -36,7 +36,7 @@
set -e
# Build EKF shared library.
mkdir Build
mkdir Build -p
cd Build
cmake ../EKF
make

2
matrix

@ -1 +1 @@ @@ -1 +1 @@
Subproject commit db4374882bba122cb55370c5ea5efacbb8aa11c1
Subproject commit cf924956d7d62ce18bfc4f8441e9177ddb69c0dc
Loading…
Cancel
Save