Autoware.Auto
catr_core.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__CATR_CORE_HPP_
22 #define MOTION_MODEL__CATR_CORE_HPP_
23 
24 #include <common/types.hpp>
27 
30 
31 namespace autoware
32 {
33 namespace motion
34 {
35 namespace motion_model
36 {
37 
40 struct MOTION_MODEL_PUBLIC CatrInvariantWorkspace
41 {
50 };
51 
54 struct MOTION_MODEL_PUBLIC CatrVariantWorkspace
55 {
63 };
64 
65 
67 struct MOTION_MODEL_PUBLIC CatrState
68 {
69  static const index_t POSE_X = 0U;
70  static const index_t POSE_Y = 1U;
71  static const index_t VELOCITY = 2U;
72  static const index_t ACCELERATION = 3U;
73  static const index_t HEADING = 4U;
74  static const index_t TURN_RATE = 5U;
75 };
76 
81 template<int32_t NumStates>
82 MOTION_MODEL_LOCAL void catr_workspace_init_invariant(
83  const Eigen::Matrix<float32_t, NumStates, 1U> & x,
85 
93 template<int32_t NumStates>
94 MOTION_MODEL_LOCAL void catr_workspace_init_variant(
95  const Eigen::Matrix<float32_t, NumStates, 1U> & x,
96  const float32_t dt_s,
97  const CatrInvariantWorkspace & iws,
99 
105 template<int32_t NumStates>
106 MOTION_MODEL_LOCAL void catr_compute_jacobian(
107  const CatrInvariantWorkspace & iws,
108  const CatrVariantWorkspace & vws,
109  Eigen::Matrix<float32_t, NumStates, NumStates> & F);
110 
117 template<int32_t NumStates>
118 MOTION_MODEL_LOCAL void catr_predict(
119  const Eigen::Matrix<float32_t, NumStates, 1U> & ref,
120  const CatrInvariantWorkspace & iws,
121  const CatrVariantWorkspace & vws,
122  Eigen::Matrix<float32_t, NumStates, 1U> & x);
123 
124 } // namespace motion_model
125 } // namespace motion
126 } // namespace autoware
127 
128 #endif // MOTION_MODEL__CATR_CORE_HPP_
autoware::motion::motion_model::catr_workspace_init_variant
MOTION_MODEL_LOCAL void catr_workspace_init_variant(const Eigen::Matrix< float32_t, NumStates, 1U > &x, const float32_t dt_s, const CatrInvariantWorkspace &iws, CatrVariantWorkspace &ws)
Initialize dt varying values for CATR model.
Definition: catr_core.cpp:55
autoware::motion::motion_model::CatrVariantWorkspace::thp
float32_t thp
next heading after time step
Definition: catr_core.hpp:59
autoware::motion::motion_model::CatrInvariantWorkspace::c
float32_t c
cosine of current state's heading
Definition: catr_core.hpp:46
autoware::motion::motion_model::CatrInvariantWorkspace::a
float32_t a
current state acceleration
Definition: catr_core.hpp:44
motion_model.hpp
This file defines the motion model interface used by kalman filters.
autoware::motion::motion_model::CatrVariantWorkspace::dt
float32_t dt
time step
Definition: catr_core.hpp:56
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::CatrInvariantWorkspace::w2_inv
float32_t w2_inv
inverse square of heading rate, not calculated if w is 0
Definition: catr_core.hpp:49
autoware::motion::motion_model::CatrInvariantWorkspace::vw
float32_t vw
product of velocity times heading rate, not calculated if w is 0
Definition: catr_core.hpp:47
autoware::motion::motion_model::CatrInvariantWorkspace::s
float32_t s
sine of current state's heading
Definition: catr_core.hpp:45
autoware::motion::motion_model::CatrVariantWorkspace::awT
float32_t awT
product of acceleration, heading rate, and time step. If w is 0, path length
Definition: catr_core.hpp:62
autoware::motion::motion_model::CatrState
This is an enum-like struct for convenience.
Definition: catr_core.hpp:67
autoware::motion::motion_model::catr_predict
MOTION_MODEL_LOCAL void catr_predict(const Eigen::Matrix< float32_t, NumStates, 1U > &ref, const CatrInvariantWorkspace &iws, const CatrVariantWorkspace &vws, Eigen::Matrix< float32_t, NumStates, 1U > &x)
Propagate CATR model forward in time.
Definition: catr_core.cpp:150
autoware::motion::motion_model::catr_workspace_init_invariant
MOTION_MODEL_LOCAL void catr_workspace_init_invariant(const Eigen::Matrix< float32_t, NumStates, 1U > &x, CatrInvariantWorkspace &ws)
Initalize invariant values in catr workspace.
Definition: catr_core.cpp:33
autoware::common::types::bool8_t
bool bool8_t
Definition: types.hpp:39
autoware::motion::motion_model::CatrVariantWorkspace::vp
float32_t vp
next velocity after time step
Definition: catr_core.hpp:57
autoware::motion::motion_model::CatrInvariantWorkspace::w
float32_t w
current state heading rate
Definition: catr_core.hpp:43
autoware
This file defines the lanelet2_map_provider_node class.
Definition: quick_sort.hpp:24
autoware::motion::motion_model::CatrVariantWorkspace::sp
float32_t sp
sine of next heading, not calculated if w is 0
Definition: catr_core.hpp:60
autoware::motion::motion_model::CatrVariantWorkspace
This struct holds some common worker variables for CATR model's jacobian and prediction computation,...
Definition: catr_core.hpp:54
x
DifferentialState x
Definition: kinematic_bicycle.snippet.hpp:28
autoware::motion::motion_model::CatrVariantWorkspace::cp
float32_t cp
cosine of next heading, not calculated if w is 0
Definition: catr_core.hpp:61
autoware::common::types::float32_t
float float32_t
Definition: types.hpp:45
motion
Definition: controller_base.hpp:30
autoware::motion::motion_model::CatrVariantWorkspace::wT
float32_t wT
product of heading rate and time step, not calculated if w is 0
Definition: catr_core.hpp:58
autoware::motion::motion_model::catr_compute_jacobian
MOTION_MODEL_LOCAL void catr_compute_jacobian(const CatrInvariantWorkspace &iws, const CatrVariantWorkspace &vws, Eigen::Matrix< float32_t, NumStates, NumStates > &F)
Compute jacobian for CATR model, assumes ws is fully initialized.
Definition: catr_core.cpp:81
autoware::motion::motion_model::CatrInvariantWorkspace::w_inv
float32_t w_inv
inverse of heading rate, not calculated if w is 0
Definition: catr_core.hpp:48
visibility_control.hpp
autoware::motion::motion_model::CatrInvariantWorkspace::is_w_nonzero
bool8_t is_w_nonzero
if heading rate is above some small number threshold
Definition: catr_core.hpp:42
autoware::motion::motion_model::CatrInvariantWorkspace
This struct holds some common worker variables for CATR model's jacobian and prediction computation,...
Definition: catr_core.hpp:40