Skip to content

Commit

Permalink
complementary_filter: move const initializations out of header
Browse files Browse the repository at this point in the history
Initialization of static consts other than int (here: float) inside the
class declaration is not permitted in C++. It works in gcc (due to a
non-standard extension), but throws an error in C++11.
  • Loading branch information
mintar committed Sep 19, 2016
1 parent 244f653 commit a514954
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,12 @@ class ComplementaryFilter
double dt);

private:
static const double kGravity = 9.81;
static const double gamma_ = 0.01;
static const double kGravity;
static const double gamma_;
// Bias estimation steady state thresholds
static const double kAngularVelocityThreshold = 0.2;
static const double kAccelerationThreshold = 0.1;
static const double kDeltaAngularVelocityThreshold = 0.01;
static const double kAngularVelocityThreshold;
static const double kAccelerationThreshold;
static const double kDeltaAngularVelocityThreshold;

// Gain parameter for the complementary filter, belongs in [0, 1].
double gain_acc_;
Expand Down
7 changes: 7 additions & 0 deletions imu_complementary_filter/src/complementary_filter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@

namespace imu_tools {

const double ComplementaryFilter::kGravity = 9.81;
const double ComplementaryFilter::gamma_ = 0.01;
// Bias estimation steady state thresholds
const double ComplementaryFilter::kAngularVelocityThreshold = 0.2;
const double ComplementaryFilter::kAccelerationThreshold = 0.1;
const double ComplementaryFilter::kDeltaAngularVelocityThreshold = 0.01;

ComplementaryFilter::ComplementaryFilter() :
gain_acc_(0.01),
gain_mag_(0.01),
Expand Down

0 comments on commit a514954

Please sign in to comment.