NASA Astrobee Robot Software  Astrobee Version:
Flight software for the Astrobee robots operating inside the International Space Station.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
butterO10.h
Go to the documentation of this file.
1 /* Copyright (c) 2017, United States Government, as represented by the
2  * Administrator of the National Aeronautics and Space Administration.
3  *
4  * All rights reserved.
5  *
6  * The Astrobee platform is licensed under the Apache License, Version 2.0
7  * (the "License"); you may not use this file except in compliance with the
8  * License. You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15  * License for the specific language governing permissions and limitations
16  * under the License.
17  */
18 
19 #ifndef IMU_INTEGRATION_BUTTERO10_H_
20 #define IMU_INTEGRATION_BUTTERO10_H_
21 
22 #include <imu_integration/filter.h>
23 
25 
26 #include <array>
27 
28 namespace imu_integration {
29 template <class Params>
30 class ButterO10 : public Filter {
31  public:
32  ButterO10() : initialized_(false) {}
33  // Returns filtered value and timestamp
34  double AddValue(const double value) final {
35  if (!initialized_) Initialize(value, Params::kGain);
36 
37  const int last_index = xv_.size() - 1;
38  // Shift input and output vals
39  for (int i = 0; i < last_index; ++i) {
40  xv_[i] = xv_[i + 1];
41  yv_[i] = yv_[i + 1];
42  }
43  // Add new values
44  xv_[last_index] = value / Params::kGain;
45  // Generate new output
46  yv_[last_index] = (xv_[0] + xv_[12]) + Params::kX111 * (xv_[1] + xv_[11]) + Params::kX210 * (xv_[2] + xv_[10]) +
47  Params::kX39 * (xv_[3] + xv_[9]) + Params::kX48 * (xv_[4] + xv_[8]) +
48  Params::kX57 * (xv_[5] + xv_[7]) + Params::kX6 * xv_[6] + (Params::kY2 * yv_[2]) +
49  (Params::kY3 * yv_[3]) + (Params::kY4 * yv_[4]) + (Params::kY5 * yv_[5]) +
50  (Params::kY6 * yv_[6]) + (Params::kY7 * yv_[7]) + (Params::kY8 * yv_[8]) +
51  (Params::kY9 * yv_[9]) + (Params::kY10 * yv_[10]) + (Params::kY11 * yv_[11]);
52 
53  // Return most recent output
54  return yv_[last_index];
55  }
56 
57  private:
58  void Initialize(const double first_value, const double gain) {
59  for (auto& val : xv_) {
60  val = first_value / gain;
61  }
62  for (auto& val : yv_) {
63  val = first_value;
64  }
65 
66  initialized_ = true;
67  }
68 
69  // Notation taken from mkfilter site
70  // /www/usr/fisher/helpers/mkfilter
71  std::array<double, 13> xv_;
72  std::array<double, 13> yv_;
73  bool initialized_;
74 };
75 
77  static constexpr double kGain = 1.204389877e+09;
78  static constexpr double kX111 = 10.9994195280;
79  static constexpr double kX210 = 55.9941952810;
80  static constexpr double kX39 = 174.9738787600;
81  static constexpr double kX48 = 374.930343370;
82  static constexpr double kX57 = 581.8781008900;
83  static constexpr double kX6 = 671.8537210700;
84  static constexpr double kY2 = -0.1440551095;
85  static constexpr double kY3 = 1.7182080129;
86  static constexpr double kY4 = -9.2532994947;
87  static constexpr double kY5 = 29.6350557040;
88  static constexpr double kY6 = -62.5163645520;
89  static constexpr double kY7 = 90.7861740400;
90  static constexpr double kY8 = -91.9332301310;
91  static constexpr double kY9 = 64.1155101770;
92  static constexpr double kY10 = -29.4805657920;
93  static constexpr double kY11 = 8.0725645969;
94 };
96 } // namespace imu_integration
97 
98 #endif // IMU_INTEGRATION_BUTTERO10_H_
filter.h
imu_integration::ButterO10::ButterO10
ButterO10()
Definition: butterO10.h:32
imu_integration::ParamsButterO10S62_5Lp3N20_83
Definition: butterO10.h:76
imu_integration::Filter
Definition: filter.h:23
logger.h
imu_integration::ParamsButterO10S62_5Lp3N20_83::kX48
static constexpr double kX48
Definition: butterO10.h:81
imu_integration::ParamsButterO10S62_5Lp3N20_83::kX111
static constexpr double kX111
Definition: butterO10.h:78
imu_integration::ParamsButterO10S62_5Lp3N20_83::kY2
static constexpr double kY2
Definition: butterO10.h:84
imu_integration::ParamsButterO10S62_5Lp3N20_83::kX210
static constexpr double kX210
Definition: butterO10.h:79
imu_integration::ParamsButterO10S62_5Lp3N20_83::kX57
static constexpr double kX57
Definition: butterO10.h:82
imu_integration
Definition: butterO1.h:26
imu_integration::ParamsButterO10S62_5Lp3N20_83::kY5
static constexpr double kY5
Definition: butterO10.h:87
imu_integration::ParamsButterO10S62_5Lp3N20_83::kX6
static constexpr double kX6
Definition: butterO10.h:83
imu_integration::ParamsButterO10S62_5Lp3N20_83::kY4
static constexpr double kY4
Definition: butterO10.h:86
imu_integration::ParamsButterO10S62_5Lp3N20_83::kY11
static constexpr double kY11
Definition: butterO10.h:93
imu_integration::ButterO10::AddValue
double AddValue(const double value) final
Definition: butterO10.h:34
imu_integration::ParamsButterO10S62_5Lp3N20_83::kY6
static constexpr double kY6
Definition: butterO10.h:88
imu_integration::ParamsButterO10S62_5Lp3N20_83::kY7
static constexpr double kY7
Definition: butterO10.h:89
imu_integration::ParamsButterO10S62_5Lp3N20_83::kY8
static constexpr double kY8
Definition: butterO10.h:90
imu_integration::ParamsButterO10S62_5Lp3N20_83::kX39
static constexpr double kX39
Definition: butterO10.h:80
imu_integration::ParamsButterO10S62_5Lp3N20_83::kY10
static constexpr double kY10
Definition: butterO10.h:92
imu_integration::ParamsButterO10S62_5Lp3N20_83::kGain
static constexpr double kGain
Definition: butterO10.h:77
imu_integration::ParamsButterO10S62_5Lp3N20_83::kY3
static constexpr double kY3
Definition: butterO10.h:85
imu_integration::ParamsButterO10S62_5Lp3N20_83::kY9
static constexpr double kY9
Definition: butterO10.h:91
imu_integration::ButterO10
Definition: butterO10.h:30