Autoware.Auto
parameter_estimator.hpp
Go to the documentation of this file.
1 // Copyright 2018 the Autoware Foundation
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 //    http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 //
15 // Co-developed by Tier IV, Inc. and Apex.AI, Inc.
16 
21 #ifndef MOTION_MODEL__PARAMETER_ESTIMATOR_HPP_
22 #define MOTION_MODEL__PARAMETER_ESTIMATOR_HPP_
23 
24 #include <common/types.hpp>
25 #include <chrono>
27 
29 
30 namespace autoware
31 {
32 namespace motion
33 {
34 namespace motion_model
35 {
36 
39 template<int32_t NumStates>
40 class ParameterEstimator : public MotionModel<NumStates>
41 {
42 public:
47  {
48  if (this != &rhs) {
49  m_state = rhs.m_state;
50  }
51  return *this;
52  }
61  void predict(
62  Eigen::Matrix<float32_t, NumStates, 1U> & x,
63  const std::chrono::nanoseconds & dt) const override
64  {
65  // parameter estimators have no dynamics, so the values should not change over time
66  (void)dt;
67  x = m_state;
68  }
75  void predict(const std::chrono::nanoseconds & dt) override
76  {
77  // parameter estimators have no dynamics, so the values should not change over time
78  (void)dt;
79  // Nothing to do!
80  }
85  Eigen::Matrix<float32_t, NumStates, NumStates> & F,
86  const std::chrono::nanoseconds & dt) override
87  {
88  (void)dt;
89  // identity
90  F.setIdentity();
91  }
99  Eigen::Matrix<float32_t, NumStates, NumStates> & F,
100  const std::chrono::nanoseconds & dt) override
101  {
102  compute_jacobian(F, dt);
103  // no prediction!
104  }
108  float32_t operator[](const motion_model::index_t idx) const override
109  {
110  return m_state(idx);
111  }
114  void reset(const Eigen::Matrix<float32_t, NumStates, 1U> & x) override
115  {
116  m_state = x;
117  }
120  const Eigen::Matrix<float32_t, NumStates, 1U> & get_state() const override
121  {
122  return m_state;
123  }
124 
125 private:
126  Eigen::Matrix<float32_t, NumStates, 1U> m_state;
127 }; // class MotionModel
128 } // namespace motion_model
129 } // namespace motion
130 } // namespace autoware
131 
132 
133 #endif // MOTION_MODEL__PARAMETER_ESTIMATOR_HPP_
autoware::motion::motion_model::ParameterEstimator::operator=
ParameterEstimator & operator=(const ParameterEstimator &rhs)
Default assignment operator.
Definition: parameter_estimator.hpp:46
autoware::motion::motion_model::ParameterEstimator::predict
void predict(const std::chrono::nanoseconds &dt) override
Update current state with a given motion. Note that this should be called after compute_jacobian() as...
Definition: parameter_estimator.hpp:75
motion_model.hpp
This file defines the motion model interface used by kalman filters.
types.hpp
This file includes common type definition.
autoware::motion::motion_model::index_t
Eigen::Index index_t
indexing matches what matrices use
Definition: motion_model.hpp:41
autoware::motion::motion_model::ParameterEstimator::get_state
const Eigen::Matrix< float32_t, NumStates, 1U > & get_state() const override
const access to internal state
Definition: parameter_estimator.hpp:120
autoware::motion::motion_model::ParameterEstimator::compute_jacobian_and_predict
void compute_jacobian_and_predict(Eigen::Matrix< float32_t, NumStates, NumStates > &F, const std::chrono::nanoseconds &dt) override
This is called by Esrcf. This should be first a computation of the jacobian, and then a motion to upd...
Definition: parameter_estimator.hpp:98
autoware::motion::motion_model::ParameterEstimator
Simple "motion model" with no dynamics for parameter estimation.
Definition: parameter_estimator.hpp:40
autoware
This file defines the lanelet2_map_provider_node class.
Definition: quick_sort.hpp:24
autoware::motion::motion_model::ParameterEstimator::compute_jacobian
void compute_jacobian(Eigen::Matrix< float32_t, NumStates, NumStates > &F, const std::chrono::nanoseconds &dt) override
Compute the jacobian based on the current state and store the result somewhere else.
Definition: parameter_estimator.hpp:84
autoware::motion::motion_model::MotionModel
Virtual interface for all motion models for use with prediction.
Definition: motion_model.hpp:46
x
DifferentialState x
Definition: kinematic_bicycle.snippet.hpp:28
autoware::common::types::float32_t
float float32_t
Definition: types.hpp:45
motion
Definition: controller_base.hpp:30
autoware::motion::motion_model::ParameterEstimator::reset
void reset(const Eigen::Matrix< float32_t, NumStates, 1U > &x) override
Set the state.
Definition: parameter_estimator.hpp:114
autoware::motion::motion_model::ParameterEstimator::predict
void predict(Eigen::Matrix< float32_t, NumStates, 1U > &x, const std::chrono::nanoseconds &dt) const override
Do motion based on current state, store result somewhere else. This is intended to be used with motio...
Definition: parameter_estimator.hpp:61
autoware::motion::motion_model::ParameterEstimator::operator[]
float32_t operator[](const motion_model::index_t idx) const override
Get elements of the model's state.
Definition: parameter_estimator.hpp:108