scenario_simulator_v2 C++ API
lane_change.hpp
Go to the documentation of this file.
1 // Copyright 2015 TIER IV, Inc. All rights reserved.
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 #ifndef TRAFFIC_SIMULATOR__DATA_TYPE__LANE_CHANGE_HPP_
16 #define TRAFFIC_SIMULATOR__DATA_TYPE__LANE_CHANGE_HPP_
17 
18 #include <lanelet2_core/Forward.h>
19 
20 #include <iostream>
22 #include <type_traits>
23 #include <unordered_map>
24 
25 namespace traffic_simulator
26 {
27 namespace lane_change
28 {
29 enum class Direction { STRAIGHT = 0, LEFT = 1, RIGHT = 2 };
30 
31 enum class TrajectoryShape { CUBIC = 0, LINEAR = 1 };
32 
34 {
35  explicit constexpr AbsoluteTarget(const lanelet::Id lanelet_id = 0, const double offset = 0)
37  {
38  }
39  lanelet::Id lanelet_id;
40  double offset;
41 };
42 
43 struct Constraint
44 {
45  enum class Type { NONE = 0, LATERAL_VELOCITY = 1, LONGITUDINAL_DISTANCE = 2, TIME = 3 };
46  enum class Policy { FORCE = 0, BEST_EFFORT = 1 };
47  explicit constexpr Constraint(
48  const Type type = Type::NONE, const double value = 0, const Policy policy = Policy::FORCE)
50  {
51  }
53  double value;
55 };
56 
58 {
59  explicit RelativeTarget(
60  const std::string & entity_name, const Direction direction, const std::uint8_t shift = 0,
61  const double offset = 0)
63  {
64  }
67  std::uint8_t shift;
68  double offset;
69 };
70 
74 struct Parameter
75 {
76  explicit Parameter(
79  const Constraint & constraint = Constraint())
81  {
82  }
86  static inline constexpr auto default_lanechange_distance = 20.0;
87 };
88 
89 std::ostream & operator<<(std::ostream &, const Direction &);
90 std::ostream & operator<<(std::ostream &, const TrajectoryShape &);
91 std::ostream & operator<<(std::ostream &, const Constraint::Type &);
92 std::ostream & operator<<(std::ostream &, const Constraint::Policy &);
93 std::ostream & operator<<(std::ostream &, const Parameter &);
94 } // namespace lane_change
95 } // namespace traffic_simulator
96 
97 #endif // TRAFFIC_SIMULATOR__DATA_TYPE__LANE_CHANGE_HPP_
std::ostream & operator<<(std::ostream &, const Direction &)
Definition: lane_change.cpp:45
TrajectoryShape
Definition: lane_change.hpp:31
Direction
Definition: lane_change.hpp:29
Definition: api.hpp:49
std::string string
Definition: junit5.hpp:26
lanelet::Id lanelet_id
Definition: lane_change.hpp:39
constexpr AbsoluteTarget(const lanelet::Id lanelet_id=0, const double offset=0)
Definition: lane_change.hpp:35
double offset
Definition: lane_change.hpp:40
Definition: lane_change.hpp:44
Policy policy
Definition: lane_change.hpp:54
constexpr Constraint(const Type type=Type::NONE, const double value=0, const Policy policy=Policy::FORCE)
Definition: lane_change.hpp:47
double value
Definition: lane_change.hpp:53
Policy
Definition: lane_change.hpp:46
Type type
Definition: lane_change.hpp:52
Type
Definition: lane_change.hpp:45
parameters for behavior plugin
Definition: lane_change.hpp:75
AbsoluteTarget target
Definition: lane_change.hpp:83
Parameter(const AbsoluteTarget &target=AbsoluteTarget(), const TrajectoryShape trajectory_shape=TrajectoryShape::CUBIC, const Constraint &constraint=Constraint())
Definition: lane_change.hpp:76
Constraint constraint
Definition: lane_change.hpp:85
static constexpr auto default_lanechange_distance
Definition: lane_change.hpp:86
TrajectoryShape trajectory_shape
Definition: lane_change.hpp:84
Direction direction
Definition: lane_change.hpp:66
std::uint8_t shift
Definition: lane_change.hpp:67
double offset
Definition: lane_change.hpp:68
RelativeTarget(const std::string &entity_name, const Direction direction, const std::uint8_t shift=0, const double offset=0)
Definition: lane_change.hpp:59
std::string entity_name
Definition: lane_change.hpp:65