$darkmode
simple_steering_model.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 2020 Robert Bosch GmbH
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  * SPDX-License-Identifier: Apache-2.0
17  */
22 #pragma once
23 #ifndef CLOE_UTILITY_SIMPLE_STEERING_MODEL_HPP_
24 #define CLOE_UTILITY_SIMPLE_STEERING_MODEL_HPP_
25 
26 namespace cloe {
27 namespace utility {
28 
37  public:
38  SimpleSteeringModel() = default;
39  explicit SimpleSteeringModel(double delta_time_s) : dt_(delta_time_s) {}
40  ~SimpleSteeringModel() = default;
41 
52  void update_model(double steering_torque, double long_velocity) {
53  // Gain depending on vehicle velocity, to reduce oscillations
54  // ^ v_gain
55  // 1|*
56  // | *
57  // | *
58  // | *
59  // |- - - - * * * * * MIN
60  // |--------|-------> velocity
61  // 0 30 m/s
62  double v_gain = -0.03 * long_velocity + 1;
63 
64  // Minimize to value
65  if (v_gain <= 0.1) {
66  v_gain = 0.1;
67  }
68 
69  // target_steering_angle = target_steering_angle (t-1) + K * K_Ego_velocity_vx * dt * torque
70  steering_angle_ = steering_angle_ + 0.1 * v_gain * dt_ * steering_torque;
71  }
72 
76  double steering_angle() const { return steering_angle_; }
77 
78  private:
79  double dt_{0.02};
80  double steering_angle_{0.0};
81 };
82 
83 } // namespace utility
84 } // namespace cloe
85 
86 #endif // CLOE_UTILITY_SIMPLE_STEERING_MODEL_HPP_
double steering_angle() const
Definition: simple_steering_model.hpp:76
Definition: coordinator.hpp:36
Definition: simple_steering_model.hpp:36
void update_model(double steering_torque, double long_velocity)
Definition: simple_steering_model.hpp:52