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