scenario_simulator_v2 C++ API
speed_profile_action.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 OPENSCENARIO_INTERPRETER__SYNTAX__SPEED_PROFILE_ACTION_HPP_
16 #define OPENSCENARIO_INTERPRETER__SYNTAX__SPEED_PROFILE_ACTION_HPP_
17 
24 #include <pugixml.hpp>
25 
27 {
28 inline namespace syntax
29 {
30 /* ---- SpeedProfileAction 1.2 -------------------------------------------------
31  *
32  * <xsd:complexType name="SpeedProfileAction">
33  * <xsd:sequence>
34  * <xsd:element name="DynamicConstraints" type="DynamicConstraints" minOccurs="0"/>
35  * <xsd:element name="SpeedProfileEntry" type="SpeedProfileEntry" maxOccurs="unbounded"/>
36  * </xsd:sequence>
37  * <xsd:attribute name="entityRef" type="String"/>
38  * <xsd:attribute name="followingMode" type="FollowingMode" use="required"/>
39  * </xsd:complexType>
40  *
41  * -------------------------------------------------------------------------- */
42 struct SpeedProfileAction : private Scope, // NOTE: Required for access to actors
44 {
45  /*
46  Reference entity. If set, the speed values will be interpreted as relative
47  delta to the speed of the referenced entity.
48  */
50 
51  /*
52  Defines whether to apply strictly linear interpolation between speed
53  target values (mode=position), or to apply jerk (change rate of
54  acceleration/deceleration) and other optional constraints of the
55  Performance class of a Vehicle entity resulting in a smoother speed
56  profile curve (mode=follow). For mode=follow the acceleration is zero at
57  the start and end of the profile.
58  */
60 
61  /*
62  Defines limitations to the action in terms of acceleration, deceleration,
63  speed and/or jerk. These settings has precedence over any Performance
64  settings (applies to vehicles only).
65  */
67 
68  const std::list<SpeedProfileEntry> speed_profile_entry; // Defines a series of speed targets.
69 
70  std::unordered_map<Entity, std::list<SpeedProfileEntry>::const_iterator> accomplishments;
71 
72  explicit SpeedProfileAction(const pugi::xml_node &, Scope &);
73 
74  auto accomplished() -> bool;
75 
76  auto apply(const Entity &, const SpeedProfileEntry &) -> void;
77 
78  auto endsImmediately() const -> bool;
79 
80  auto run() -> void;
81 
82  auto start() -> void;
83 };
84 } // namespace syntax
85 } // namespace openscenario_interpreter
86 
87 #endif // OPENSCENARIO_INTERPRETER__SYNTAX__SPEED_PROFILE_ACTION_HPP_
Definition: scope.hpp:154
Definition: hypot.hpp:22
Definition: dynamic_constraints.hpp:44
Definition: following_mode.hpp:42
Definition: speed_profile_action.hpp:44
const FollowingMode following_mode
Definition: speed_profile_action.hpp:59
const std::list< SpeedProfileEntry > speed_profile_entry
Definition: speed_profile_action.hpp:68
auto apply(const Entity &, const SpeedProfileEntry &) -> void
Definition: speed_profile_action.cpp:52
const Entity entity_ref
Definition: speed_profile_action.hpp:49
SpeedProfileAction(const pugi::xml_node &, Scope &)
Definition: speed_profile_action.cpp:28
auto run() -> void
Definition: speed_profile_action.cpp:120
std::unordered_map< Entity, std::list< SpeedProfileEntry >::const_iterator > accomplishments
Definition: speed_profile_action.hpp:70
auto endsImmediately() const -> bool
Definition: speed_profile_action.cpp:118
auto start() -> void
Definition: speed_profile_action.cpp:147
const DynamicConstraints dynamic_constraints
Definition: speed_profile_action.hpp:66
auto accomplished() -> bool
Definition: speed_profile_action.cpp:109
Definition: speed_profile_entry.hpp:35