scenario_simulator_v2 C++ API
speed_condition.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_CONDITION_HPP_
16 #define OPENSCENARIO_INTERPRETER__SYNTAX__SPEED_CONDITION_HPP_
17 
25 #include <pugixml.hpp>
26 #include <valarray>
27 
29 {
30 inline namespace syntax
31 {
32 /*
33  SpeedCondition (OpenSCENARIO XML 1.3.1)
34 
35  Compares a triggering entity's/entities' speed to a target speed. The
36  logical operator for the comparison is given by the rule attribute. If
37  direction is used, only the projection to that direction is used in the
38  comparison.
39 
40  <xsd:complexType name="SpeedCondition">
41  <xsd:attribute name="rule" type="Rule" use="required"/>
42  <xsd:attribute name="value" type="Double" use="required"/>
43  <xsd:attribute name="direction" type="DirectionalDimension"/>
44  </xsd:complexType>
45 */
47 {
48  /*
49  The operator (less, greater, equal).
50  */
51  const Rule rule;
52 
53  /*
54  Speed value of the speed condition. Unit: [m/s].
55  */
56  const Double value;
57 
58  /*
59  Direction of the speed (if not given, the total speed is considered).
60  */
61  const std::optional<DirectionalDimension> direction;
62 
64 
65  std::vector<std::valarray<double>> results; // for description
66 
67  static inline auto compatibility = Compatibility::legacy;
68 
69  explicit SpeedCondition(const pugi::xml_node &, Scope &, const TriggeringEntities &);
70 
71  auto description() const -> String;
72 
73  static auto evaluate(const Entities *, const Entity &) -> Eigen::Vector3d;
74 
75  static auto evaluate(
76  const Entities *, const Entity &, const std::optional<DirectionalDimension> &,
77  const Compatibility = Compatibility::legacy) -> double;
78 
79  auto evaluate() -> Object;
80 };
81 } // namespace syntax
82 } // namespace openscenario_interpreter
83 
84 #endif // OPENSCENARIO_INTERPRETER__SYNTAX__SPEED_CONDITION_HPP_
Definition: scope.hpp:154
std::string String
Definition: string.hpp:24
Definition: hypot.hpp:22
Compatibility
Definition: compatibility.hpp:22
Definition: cache.hpp:27
Definition: directional_dimension.hpp:43
Definition: speed_condition.hpp:47
static auto compatibility
Definition: speed_condition.hpp:67
const TriggeringEntities triggering_entities
Definition: speed_condition.hpp:63
auto evaluate() -> Object
Definition: speed_condition.cpp:85
const Rule rule
Definition: speed_condition.hpp:51
auto description() const -> String
Definition: speed_condition.cpp:36
const Double value
Definition: speed_condition.hpp:56
std::vector< std::valarray< double > > results
Definition: speed_condition.hpp:65
SpeedCondition(const pugi::xml_node &, Scope &, const TriggeringEntities &)
Definition: speed_condition.cpp:25
const std::optional< DirectionalDimension > direction
Definition: speed_condition.hpp:61
Definition: triggering_entities.hpp:40