Go to the documentation of this file.
14 #ifndef PARKING_PLANNER__BICYCLE_MODEL_HPP_
15 #define PARKING_PLANNER__BICYCLE_MODEL_HPP_
34 namespace parking_planner
49 T length_front,
T length_rear,
T vehicle_width,
50 T front_overhang,
T rear_overhang) noexcept
52 m_length_front = length_front;
53 m_length_rear = length_rear;
54 m_vehicle_width = vehicle_width;
55 m_front_overhang = front_overhang;
56 m_rear_overhang = rear_overhang;
61 return std::vector<T>{m_length_front, m_length_rear, m_vehicle_width, m_front_overhang,
68 if (serialized_states.size() != BicycleModelParameters::internal_parameters_number) {
69 throw std::length_error {
"Need a vector of length " +
70 std::string{BicycleModelParameters::internal_parameters_number}
75 serialized_states[0], serialized_states[1], serialized_states[2],
77 serialized_states[4]);
94 return internal_parameters_number;
98 static constexpr std::size_t internal_parameters_number = 5;
121 template<
typename T,
typename V>
126 : m_parameters(parameters)
161 const std::size_t number_of_steps
164 const auto states_vec = states.
serialize();
165 const auto commands_vec = commands.
serialize();
167 const std::function<std::vector<T>(std::vector<T>, std::vector<T>)> dynfun =
168 [
this](
const auto states,
const auto commands) {
172 const auto results_vec =
RK4(states_vec, commands_vec, dynfun, stepsize, number_of_steps);
182 std::vector<T> serialized_states,
183 std::vector<T> serialized_commands)
const
196 std::vector<Point2D<T>> corners{};
200 corners.push_back(
Point2D<T>(-xrear, yhalf) );
201 corners.push_back(
Point2D<T>(-xrear, -yhalf) );
202 corners.push_back(
Point2D<T>(xfront, -yhalf) );
203 corners.push_back(
Point2D<T>(xfront, yhalf) );
205 polytope.rotate_and_shift(
222 #endif // PARKING_PLANNER__BICYCLE_MODEL_HPP_
static constexpr std::size_t get_serialized_length() noexcept
Definition: bicycle_model.hpp:92
Class describing a point in two-dimensional space.
Definition: geometry.hpp:45
VehicleStateDerivative< T > integrated_dynamics(VehicleState< T > states, VehicleCommand< T > commands, const float64_t stepsize, const std::size_t number_of_steps) const
Evaluate the integrated dynamics for given states and commands. A runge-kutta integration scheme is u...
Definition: bicycle_model.hpp:157
T get_heading() const noexcept
Definition: parking_planner_types.hpp:79
void set_rear_overhang(T rear_overhang) noexcept
Definition: bicycle_model.hpp:91
T get_rear_overhang() const noexcept
Definition: bicycle_model.hpp:86
void set_length_front(T length_front) noexcept
Definition: bicycle_model.hpp:87
T
Definition: catr_diff.py:22
Class implementing a kinematic bicycle model.
Definition: bicycle_model.hpp:122
T get_length_rear() const noexcept
Definition: bicycle_model.hpp:83
This file includes common type definition.
IntermediateState beta
Definition: kinematic_bicycle.snippet.hpp:42
Class to represent the inputs of a vehicle.
Definition: parking_planner_types.hpp:127
void set_length_rear(T length_rear) noexcept
Definition: bicycle_model.hpp:88
T get_vehicle_width() const noexcept
Definition: bicycle_model.hpp:84
T get_throttle() const noexcept
Definition: parking_planner_types.hpp:158
T get_length_front() const noexcept
Definition: bicycle_model.hpp:82
std::vector< T > serialize(void) const
Definition: bicycle_model.hpp:59
void set_front_overhang(T front_overhang) noexcept
Definition: bicycle_model.hpp:90
std::vector< T > serialize(void) const
Turn the object into flat vector of doubles (for use with numerical code)
Definition: parking_planner_types.hpp:55
T get_velocity() const noexcept
Definition: parking_planner_types.hpp:78
void set_vehicle_width(T vehicle_width) noexcept
Definition: bicycle_model.hpp:89
std::vector< T > dynamics_serialized(std::vector< T > serialized_states, std::vector< T > serialized_commands) const
Serialized version of the continuous-time dynamics evaluation. See the help of the dynamics function ...
Definition: bicycle_model.hpp:181
Class describing a polytope in two-dimensional space.
Definition: geometry.hpp:244
This file defines the lanelet2_map_provider_node class.
Definition: quick_sort.hpp:24
Class to represent the state of a vehicle.
Definition: parking_planner_types.hpp:37
T get_front_overhang() const noexcept
Definition: bicycle_model.hpp:85
T get_steering() const noexcept
Definition: parking_planner_types.hpp:80
Definition: controller_base.hpp:30
BicycleModel(BicycleModelParameters< V > parameters)
Definition: bicycle_model.hpp:125
std::vector< T > serialize(void) const
Turn the object into flat vector of doubles (for use with numerical code)
Definition: parking_planner_types.hpp:142
Polytope2D< T > compute_bounding_box(VehicleState< T > states) const
compute a bounding box of a given vehicle model for given states.
Definition: bicycle_model.hpp:194
X RK4(X x, U u, P p, std::function< X(X, U, P)> f, const float64_t stepsize, const std::size_t steps)
Template for an explicit Runge-Kutta integrator. CasADi has its own, but it for some reason doesn't c...
Definition: rungekutta.hpp:62
T get_y() const noexcept
Definition: parking_planner_types.hpp:77
VehicleStateDerivative< T > dynamics(VehicleState< T > states, VehicleCommand< T > commands) const
Evaluate the dynamics for given states and commands.
Definition: bicycle_model.hpp:135
static BicycleModelParameters deserialize(std::vector< T > serialized_states)
Definition: bicycle_model.hpp:66
Class for storing physical parameters of a bicycle model bicycle model.
Definition: bicycle_model.hpp:45
double float64_t
Definition: types.hpp:37
static VehicleState deserialize(std::vector< T > serialized_states)
Definition: parking_planner_types.hpp:61
T get_steering_rate() const noexcept
Definition: parking_planner_types.hpp:157
T get_x() const noexcept
Definition: parking_planner_types.hpp:76
BicycleModelParameters(T length_front, T length_rear, T vehicle_width, T front_overhang, T rear_overhang) noexcept
Definition: bicycle_model.hpp:48