ethzasl-msf - Modular Sensor Fusion
Time delay compensated single and multi sensor fusion framework based on an EKF
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
static_ordering_assertions.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012-2013 Simon Lynen, ASL, ETH Zurich, Switzerland
3  * You can contact the author at <slynen at ethz dot ch>
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 #ifndef STATIC_ORDERING_ASSERTIONS_CORE_H_
18 #define STATIC_ORDERING_ASSERTIONS_CORE_H_
19 
20 #include <msf_core/msf_tmp.h>
21 
22 namespace {
23 
24 template<typename EKFState_T>
25 struct StaticAssertCoreStateOrderingCorrect {
26  typedef typename EKFState_T::StateSequence_T StateSequence_T;
27  typedef typename EKFState_T::StateDefinition_T StateDefinition_T;
28 
29  enum {
30  value
31  };
32 
33  // For now we have no make sure, the core states are in the correct order
34  //(calculation of observation noise cov has hardcoded order)
35  // DO NOT REMOVE THIS!! UNLESS YOU ALSO FIXED CalcQCore!
36  // TODO: (slynen) This should be ok now, apart from the Cov init matrix.
37  //{
38  enum {
39  idxstartcorr_p_ = msf_tmp::getStartIndex<StateSequence_T,
40  typename msf_tmp::getEnumStateType<StateSequence_T, StateDefinition_T::p>::value,
41  msf_tmp::CorrectionStateLengthForType>::value,
42 
43  idxstartcorr_v_ = msf_tmp::getStartIndex<StateSequence_T,
44  typename msf_tmp::getEnumStateType<StateSequence_T, StateDefinition_T::v>::value,
45  msf_tmp::CorrectionStateLengthForType>::value,
46 
47  idxstartcorr_q_ = msf_tmp::getStartIndex<StateSequence_T,
48  typename msf_tmp::getEnumStateType<StateSequence_T, StateDefinition_T::q>::value,
49  msf_tmp::CorrectionStateLengthForType>::value,
50 
51  idxstartcorr_b_w_ = msf_tmp::getStartIndex<StateSequence_T,
52  typename msf_tmp::getEnumStateType<StateSequence_T,
53  StateDefinition_T::b_w>::value,
54  msf_tmp::CorrectionStateLengthForType>::value,
55 
56  idxstartcorr_b_a_ = msf_tmp::getStartIndex<StateSequence_T,
57  typename msf_tmp::getEnumStateType<StateSequence_T,
58  StateDefinition_T::b_a>::value,
59  msf_tmp::CorrectionStateLengthForType>::value
60  };
61 
62  static_assert(idxstartcorr_p_==0, "Indexing of core states has been altered, "
63  "but this is currently not allowed");
64  static_assert(idxstartcorr_v_==3, "Indexing of core states has been altered, "
65  "but this is currently not allowed");
66  static_assert(idxstartcorr_q_==6, "Indexing of core states has been altered, "
67  "but this is currently not allowed");
68  static_assert(idxstartcorr_b_w_==9, "Indexing of core states has been altered, "
69  "but this is currently not allowed");
70  static_assert(idxstartcorr_b_a_==12, "Indexing of core states has been altered, "
71  "but this is currently not allowed");
72  //}
73 };
74 
75 }
76 
77 #endif // STATIC_ORDERING_ASSERTIONS_H_