scenario_simulator_v2 C++ API
simulator_core.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__SIMULATOR_CORE_HPP_
16 #define OPENSCENARIO_INTERPRETER__SIMULATOR_CORE_HPP_
17 
28 
30 {
31 using NativeWorldPosition = geometry_msgs::msg::Pose;
32 
34 
36 
38 
40 {
41  static inline std::unique_ptr<traffic_simulator::API> core = nullptr;
42 
43 public:
44  template <typename Node, typename... Ts>
45  static auto activate(
46  const Node & node, const traffic_simulator::Configuration & configuration, Ts &&... xs) -> void
47  {
48  if (not active()) {
49  core = std::make_unique<traffic_simulator::API>(
50  node, configuration, std::forward<decltype(xs)>(xs)...);
51  } else {
52  throw Error("The simulator core has already been instantiated.");
53  }
54  }
55 
56  static auto active() { return static_cast<bool>(core); }
57 
58  static auto deactivate() -> void
59  {
60  if (active()) {
61  core->despawnEntities();
62  core->closeZMQConnection();
63  core.reset();
64  }
65  }
66 
67  static auto update() -> void { core->updateFrame(); }
68 
70  {
71  protected:
72  static auto canonicalize(const traffic_simulator::LaneletPose & non_canonicalized)
74  {
75  return traffic_simulator::pose::canonicalize(non_canonicalized, core->getHdmapUtils());
76  }
77 
78  template <typename T, typename std::enable_if_t<std::is_same_v<T, NativeLanePosition>, int> = 0>
79  static auto convert(const NativeWorldPosition & pose) -> NativeLanePosition
80  {
81  if (
82  const auto result =
83  traffic_simulator::pose::toLaneletPose(pose, false, core->getHdmapUtils())) {
84  return result.value();
85  } else {
86  throw Error(
87  "The specified WorldPosition = [", pose.position.x, ", ", pose.position.y, ", ",
88  pose.position.z,
89  "] could not be approximated to the proper Lane. Perhaps the "
90  "WorldPosition points to a location where multiple lanes overlap, and "
91  "there are at least two or more candidates for a LanePosition that "
92  "can be approximated to that WorldPosition. This issue can be "
93  "resolved by strictly specifying the location using LanePosition "
94  "instead of WorldPosition");
95  }
96  }
97 
98  template <
99  typename T, typename std::enable_if_t<std::is_same_v<T, NativeWorldPosition>, int> = 0>
100  static auto convert(const NativeLanePosition & native_lane_position) -> NativeWorldPosition
101  {
102  return traffic_simulator::pose::toMapPose(native_lane_position);
103  }
104 
106  const std::string & from_entity_name, const std::string & to_entity_name)
107  {
108  if (const auto from_entity = core->getEntity(from_entity_name)) {
109  if (const auto to_entity = core->getEntity(to_entity_name)) {
110  if (
111  const auto relative_pose = traffic_simulator::pose::relativePose(
112  from_entity->getMapPose(), to_entity->getMapPose()))
113  return relative_pose.value();
114  }
115  }
117  }
118 
120  const std::string & from_entity_name, const NativeWorldPosition & to_map_pose)
121  {
122  if (const auto from_entity = core->getEntity(from_entity_name)) {
123  if (
124  const auto relative_pose =
125  traffic_simulator::pose::relativePose(from_entity->getMapPose(), to_map_pose)) {
126  return relative_pose.value();
127  }
128  }
130  }
131 
133  const NativeWorldPosition & from_map_pose, const std::string & to_entity_name)
134  {
135  if (const auto to_entity = core->getEntity(to_entity_name)) {
136  if (
137  const auto relative_pose =
138  traffic_simulator::pose::relativePose(from_map_pose, to_entity->getMapPose())) {
139  return relative_pose.value();
140  }
141  }
143  }
144 
146  const std::string & from_entity_name, const std::string & to_entity_name,
147  const RoutingAlgorithm::value_type routing_algorithm = RoutingAlgorithm::undefined)
149  {
150  if (const auto to_entity = core->getEntity(to_entity_name)) {
151  if (const auto to_lanelet_pose = to_entity->getLaneletPose()) {
153  from_entity_name, to_lanelet_pose.value(), routing_algorithm);
154  }
155  }
157  }
158 
160  const std::string & from_entity_name, const NativeLanePosition & to_lanelet_pose,
161  const RoutingAlgorithm::value_type routing_algorithm = RoutingAlgorithm::undefined)
163  {
164  if (const auto from_entity = core->getEntity(from_entity_name)) {
165  if (const auto from_lanelet_pose = from_entity->getLaneletPose()) {
167  from_lanelet_pose.value(), to_lanelet_pose, routing_algorithm);
168  }
169  }
171  }
172 
174  const NativeLanePosition & from_lanelet_pose, const NativeLanePosition & to_lanelet_pose,
175  const RoutingAlgorithm::value_type routing_algorithm = RoutingAlgorithm::undefined)
177  {
178  const bool allow_lane_change = (routing_algorithm == RoutingAlgorithm::value_type::shortest);
180  from_lanelet_pose, to_lanelet_pose, allow_lane_change, core->getHdmapUtils());
181  }
182 
184  const std::string & from_entity_name, const std::string & to_entity_name,
185  const RoutingAlgorithm::value_type routing_algorithm = RoutingAlgorithm::undefined)
186  {
187  if (const auto from_entity = core->getEntity(from_entity_name)) {
188  if (const auto to_entity = core->getEntity(to_entity_name)) {
189  if (const auto from_lanelet_pose = from_entity->getLaneletPose()) {
190  if (const auto to_lanelet_pose = to_entity->getLaneletPose()) {
192  from_lanelet_pose.value(), from_entity->getBoundingBox(), to_lanelet_pose.value(),
193  to_entity->getBoundingBox(), routing_algorithm);
194  }
195  }
196  }
197  }
199  }
200 
202  const std::string & from_entity_name, const NativeLanePosition & to_lanelet_pose,
203  const RoutingAlgorithm::value_type routing_algorithm = RoutingAlgorithm::undefined)
204  {
205  if (const auto from_entity = core->getEntity(from_entity_name)) {
206  if (const auto from_lanelet_pose = from_entity->getLaneletPose()) {
208  from_lanelet_pose.value(), from_entity->getBoundingBox(), to_lanelet_pose,
209  traffic_simulator_msgs::msg::BoundingBox(), routing_algorithm);
210  }
211  }
213  }
214 
216  const NativeLanePosition & from_lanelet_pose,
217  const traffic_simulator_msgs::msg::BoundingBox & from_bounding_box,
218  const NativeLanePosition & to_lanelet_pose,
219  const traffic_simulator_msgs::msg::BoundingBox & to_bounding_box,
220  const RoutingAlgorithm::value_type routing_algorithm = RoutingAlgorithm::undefined)
222  {
223  const bool allow_lane_change = (routing_algorithm == RoutingAlgorithm::value_type::shortest);
225  from_lanelet_pose, from_bounding_box, to_lanelet_pose, to_bounding_box, allow_lane_change,
226  core->getHdmapUtils());
227  }
228 
230  const std::string & from_entity_name, const std::string & to_entity_name)
231  {
232  if (const auto from_entity = core->getEntity(from_entity_name)) {
233  if (const auto to_entity = core->getEntity(to_entity_name)) {
234  if (
235  const auto relative_pose = traffic_simulator::pose::boundingBoxRelativePose(
236  from_entity->getMapPose(), from_entity->getBoundingBox(), to_entity->getMapPose(),
237  to_entity->getBoundingBox())) {
238  return relative_pose.value();
239  }
240  }
241  }
243  }
244 
246  const std::string & from_entity_name, const NativeWorldPosition & to_map_pose)
247  {
248  if (const auto from_entity = core->getEntity(from_entity_name)) {
249  if (
250  const auto relative_pose = traffic_simulator::pose::boundingBoxRelativePose(
251  from_entity->getMapPose(), from_entity->getBoundingBox(), to_map_pose,
252  traffic_simulator_msgs::msg::BoundingBox())) {
253  return relative_pose.value();
254  }
255  }
257  }
258  };
259 
260  class ActionApplication // OpenSCENARIO 1.1.1 Section 3.1.5
261  {
262  protected:
263  template <typename... Ts>
264  static auto applyAcquirePositionAction(Ts &&... xs)
265  {
266  return core->requestAcquirePosition(std::forward<decltype(xs)>(xs)...);
267  }
268 
269  template <typename... Ts>
270  static auto applyAddEntityAction(Ts &&... xs)
271  {
272  return core->spawn(std::forward<decltype(xs)>(xs)...);
273  }
274 
275  template <typename EntityRef, typename DynamicConstraints>
276  static auto applyProfileAction(
277  const EntityRef & entity_ref, const DynamicConstraints & dynamic_constraints) -> void
278  {
279  return core->setBehaviorParameter(entity_ref, [&]() {
280  auto behavior_parameter = core->getBehaviorParameter(entity_ref);
281 
282  if (not std::isinf(dynamic_constraints.max_speed)) {
283  behavior_parameter.dynamic_constraints.max_speed = dynamic_constraints.max_speed;
284  }
285 
286  if (not std::isinf(dynamic_constraints.max_acceleration)) {
287  behavior_parameter.dynamic_constraints.max_acceleration =
288  dynamic_constraints.max_acceleration;
289  }
290 
291  if (not std::isinf(dynamic_constraints.max_acceleration_rate)) {
292  behavior_parameter.dynamic_constraints.max_acceleration_rate =
293  dynamic_constraints.max_acceleration_rate;
294  }
295 
296  if (not std::isinf(dynamic_constraints.max_deceleration)) {
297  behavior_parameter.dynamic_constraints.max_deceleration =
298  dynamic_constraints.max_deceleration;
299  }
300 
301  if (not std::isinf(dynamic_constraints.max_deceleration_rate)) {
302  behavior_parameter.dynamic_constraints.max_deceleration_rate =
303  dynamic_constraints.max_deceleration_rate;
304  }
305 
306  return behavior_parameter;
307  }());
308  }
309 
310  template <typename Controller>
312  const std::string & entity_ref, Controller && controller) -> void
313  {
314  core->setVelocityLimit(
315  entity_ref, controller.properties.template get<Double>(
316  "maxSpeed", std::numeric_limits<Double::value_type>::max()));
317 
318  core->setBehaviorParameter(entity_ref, [&]() {
319  auto message = core->getBehaviorParameter(entity_ref);
320  message.see_around = not controller.properties.template get<Boolean>("isBlind");
322  message.dynamic_constraints.max_acceleration =
323  controller.properties.template get<Double>("maxAcceleration", 10.0);
324  message.dynamic_constraints.max_acceleration_rate =
325  controller.properties.template get<Double>("maxAccelerationRate", 3.0);
326  message.dynamic_constraints.max_deceleration =
327  controller.properties.template get<Double>("maxDeceleration", 10.0);
328  message.dynamic_constraints.max_deceleration_rate =
329  controller.properties.template get<Double>("maxDecelerationRate", 3.0);
330  message.dynamic_constraints.max_speed =
331  controller.properties.template get<Double>("maxSpeed", 50.0);
332  return message;
333  }());
334 
335  if (controller.isAutoware()) {
336  core->attachLidarSensor(
337  entity_ref, controller.properties.template get<Double>("pointcloudPublishingDelay"));
338 
339  core->attachDetectionSensor([&]() {
340  simulation_api_schema::DetectionSensorConfiguration configuration;
341  // clang-format off
342  configuration.set_architecture_type(core->getROS2Parameter<std::string>("architecture_type", "awf/universe"));
343  configuration.set_entity(entity_ref);
344  configuration.set_detect_all_objects_in_range(controller.properties.template get<Boolean>("isClairvoyant"));
345  configuration.set_object_recognition_delay(controller.properties.template get<Double>("detectedObjectPublishingDelay"));
346  configuration.set_pos_noise_stddev(controller.properties.template get<Double>("detectedObjectPositionStandardDeviation"));
347  configuration.set_probability_of_lost(controller.properties.template get<Double>("detectedObjectMissingProbability"));
348  configuration.set_random_seed(controller.properties.template get<UnsignedInteger>("randomSeed"));
349  configuration.set_range(controller.properties.template get<Double>("detectionSensorRange",300.0));
350  configuration.set_object_recognition_ground_truth_delay(controller.properties.template get<Double>("detectedObjectGroundTruthPublishingDelay"));
351  configuration.set_update_duration(0.1);
352  // clang-format on
353  return configuration;
354  }());
355 
356  core->attachOccupancyGridSensor([&]() {
357  simulation_api_schema::OccupancyGridSensorConfiguration configuration;
358  // clang-format off
359  configuration.set_architecture_type(core->getROS2Parameter<std::string>("architecture_type", "awf/universe"));
360  configuration.set_entity(entity_ref);
361  configuration.set_filter_by_range(controller.properties.template get<Boolean>("isClairvoyant"));
362  configuration.set_height(200);
363  configuration.set_range(300);
364  configuration.set_resolution(0.5);
365  configuration.set_update_duration(0.1);
366  configuration.set_width(200);
367  // clang-format on
368  return configuration;
369  }());
370 
371  core->attachPseudoTrafficLightDetector([&]() {
372  simulation_api_schema::PseudoTrafficLightDetectorConfiguration configuration;
373  configuration.set_architecture_type(
374  core->getROS2Parameter<std::string>("architecture_type", "awf/universe"));
375  return configuration;
376  }());
377 
378  core->asFieldOperatorApplication(entity_ref)
379  .declare_parameter<bool>(
380  "allow_goal_modification",
381  controller.properties.template get<Boolean>("allowGoalModification"));
382 
383  for (const auto & module :
384  [](std::string manual_modules_string) {
385  manual_modules_string.erase(
386  std::remove_if(
387  manual_modules_string.begin(), manual_modules_string.end(),
388  [](const auto & c) { return std::isspace(c); }),
389  manual_modules_string.end());
390 
391  std::vector<std::string> modules;
392  std::string buffer;
393  std::istringstream modules_stream(manual_modules_string);
394  while (std::getline(modules_stream, buffer, ',')) {
395  modules.push_back(buffer);
396  }
397  return modules;
398  }(controller.properties.template get<String>(
399  "featureIdentifiersRequiringExternalPermissionForAutonomousDecisions"))) {
400  try {
401  core->asFieldOperatorApplication(entity_ref)
402  .requestAutoModeForCooperation(module, false);
403  } catch (const Error & error) {
404  throw Error(
405  "featureIdentifiersRequiringExternalPermissionForAutonomousDecisions is not "
406  "supported in this environment: ",
407  error.what());
408  }
409  }
410  }
411  }
412 
413  template <typename... Ts>
414  static auto applyAssignRouteAction(Ts &&... xs)
415  {
416  return core->requestAssignRoute(std::forward<decltype(xs)>(xs)...);
417  }
418 
419  template <typename... Ts>
420  static auto applyDeleteEntityAction(Ts &&... xs)
421  {
422  return core->despawn(std::forward<decltype(xs)>(xs)...);
423  }
424 
425  template <typename... Ts>
426  static auto applyFollowTrajectoryAction(Ts &&... xs)
427  {
428  return core->requestFollowTrajectory(std::forward<decltype(xs)>(xs)...);
429  }
430 
431  template <typename... Ts>
432  static auto applyLaneChangeAction(Ts &&... xs)
433  {
434  return core->requestLaneChange(std::forward<decltype(xs)>(xs)...);
435  }
436 
437  template <typename... Ts>
438  static auto applySpeedAction(Ts &&... xs)
439  {
440  return core->requestSpeedChange(std::forward<decltype(xs)>(xs)...);
441  }
442 
443  template <typename... Ts>
444  static auto applyTeleportAction(Ts &&... xs)
445  {
446  return core->setEntityStatus(std::forward<decltype(xs)>(xs)...);
447  }
448 
449  template <typename... Ts>
450  static auto applyWalkStraightAction(Ts &&... xs)
451  {
452  return core->requestWalkStraight(std::forward<decltype(xs)>(xs)...);
453  }
454  };
455 
456  // OpenSCENARIO 1.1.1 Section 3.1.5
458  {
459  protected:
460  template <typename... Ts>
461  static auto evaluateAcceleration(Ts &&... xs)
462  {
463  return core->getCurrentAccel(std::forward<decltype(xs)>(xs)...).linear.x;
464  }
465 
466  template <typename... Ts>
467  static auto evaluateCollisionCondition(Ts &&... xs) -> bool
468  {
469  return core->checkCollision(std::forward<decltype(xs)>(xs)...);
470  }
471 
472  template <typename... Ts>
474  const std::string & from_entity_name,
475  const std::string & to_entity_name) // for RelativeDistanceCondition
476  {
477  if (const auto from_entity = core->getEntity(from_entity_name)) {
478  if (const auto to_entity = core->getEntity(to_entity_name)) {
479  if (
481  from_entity->getMapPose(), from_entity->getBoundingBox(), to_entity->getMapPose(),
482  to_entity->getBoundingBox())) {
483  return distance.value();
484  }
485  }
486  }
487  return std::numeric_limits<double>::quiet_NaN();
488  }
489 
490  template <typename... Ts>
491  static auto evaluateSimulationTime(Ts &&... xs) -> double
492  {
493  if (SimulatorCore::active()) {
494  return core->getCurrentTime(std::forward<decltype(xs)>(xs)...);
495  } else {
496  return std::numeric_limits<double>::quiet_NaN();
497  }
498  }
499 
500  template <typename... Ts>
501  static auto evaluateSpeed(Ts &&... xs)
502  {
503  return core->getCurrentTwist(std::forward<decltype(xs)>(xs)...).linear.x;
504  }
505 
506  template <typename... Ts>
507  static auto evaluateStandStill(Ts &&... xs)
508  {
509  return core->getStandStillDuration(std::forward<decltype(xs)>(xs)...);
510  }
511 
512  template <typename... Ts>
513  static auto evaluateTimeHeadway(Ts &&... xs)
514  {
515  if (const auto result = core->getTimeHeadway(std::forward<decltype(xs)>(xs)...); result) {
516  return result.value();
517  } else {
518  using value_type = typename std::decay<decltype(result)>::type::value_type;
519  return std::numeric_limits<value_type>::quiet_NaN();
520  }
521  }
522  };
523 
525  {
526  protected:
527  template <typename Performance, typename Properties>
529  const std::string & entity_ref, const Performance & performance,
530  const Properties & properties)
531  {
532  core->activateOutOfRangeJob(
533  entity_ref, -performance.max_speed, +performance.max_speed, -performance.max_deceleration,
534  +performance.max_acceleration, properties.template get<Double>("minJerk", Double::lowest()),
535  properties.template get<Double>("maxJerk", Double::max()));
536  }
537 
538  template <typename... Ts>
539  static auto asFieldOperatorApplication(Ts &&... xs) -> decltype(auto)
540  {
541  return core->asFieldOperatorApplication(std::forward<decltype(xs)>(xs)...);
542  }
543 
544  static auto activateNonUserDefinedControllers() -> decltype(auto)
545  {
546  return core->startNpcLogic();
547  }
548 
549  template <typename... Ts>
550  static auto evaluateCurrentState(Ts &&... xs) -> decltype(auto)
551  {
552  return core->getCurrentAction(std::forward<decltype(xs)>(xs)...);
553  }
554 
555  template <typename EntityRef, typename OSCLanePosition>
557  const EntityRef & entity_ref, const OSCLanePosition & osc_lane_position)
558  {
559  if (const auto entity = core->getEntity(entity_ref)) {
560  const auto from_map_pose = entity->getMapPose();
561  const auto to_map_pose = static_cast<NativeWorldPosition>(osc_lane_position);
562  if (
563  const auto relative_pose =
564  traffic_simulator::pose::relativePose(from_map_pose, to_map_pose)) {
565  return static_cast<Double>(std::abs(
566  math::geometry::convertQuaternionToEulerAngle(relative_pose.value().orientation).z));
567  }
568  }
569  return Double::nan();
570  }
571 
572  template <typename EntityRef>
573  static auto evaluateRelativeHeading(const EntityRef & entity_ref)
574  {
575  if (auto lanelet_pose = core->getLaneletPose(entity_ref)) {
576  return static_cast<Double>(
577  std::abs(static_cast<traffic_simulator::LaneletPose>(lanelet_pose.value()).rpy.z));
578  } else {
579  return Double::nan();
580  }
581  }
582 
583  template <typename... Ts>
584  static auto getConventionalTrafficLights(Ts &&... xs) -> decltype(auto)
585  {
586  return core->getConventionalTrafficLights(std::forward<decltype(xs)>(xs)...);
587  }
588 
589  template <typename... Ts>
590  static auto getV2ITrafficLights(Ts &&... xs) -> decltype(auto)
591  {
592  return core->getV2ITrafficLights(std::forward<decltype(xs)>(xs)...);
593  }
594 
595  template <typename... Ts>
596  static auto resetConventionalTrafficLightPublishRate(Ts &&... xs) -> decltype(auto)
597  {
598  return core->resetConventionalTrafficLightPublishRate(std::forward<decltype(xs)>(xs)...);
599  }
600 
601  template <typename... Ts>
602  static auto resetV2ITrafficLightPublishRate(Ts &&... xs) -> decltype(auto)
603  {
604  return core->resetV2ITrafficLightPublishRate(std::forward<decltype(xs)>(xs)...);
605  }
606 
607  template <typename... Ts>
608  static auto sendCooperateCommand(Ts &&... xs) -> decltype(auto)
609  {
610  return asFieldOperatorApplication(core->getEgoName())
611  .sendCooperateCommand(std::forward<decltype(xs)>(xs)...);
612  }
613 
614  template <typename... Ts>
615  static auto setConventionalTrafficLightConfidence(Ts &&... xs) -> decltype(auto)
616  {
617  return core->setConventionalTrafficLightConfidence(std::forward<decltype(xs)>(xs)...);
618  }
619  };
620 };
621 } // namespace openscenario_interpreter
622 
623 #endif // OPENSCENARIO_INTERPRETER__SIMULATOR_CORE_HPP_
static auto applyAcquirePositionAction(Ts &&... xs)
Definition: simulator_core.hpp:264
static auto applyWalkStraightAction(Ts &&... xs)
Definition: simulator_core.hpp:450
static auto applyFollowTrajectoryAction(Ts &&... xs)
Definition: simulator_core.hpp:426
static auto applyAssignRouteAction(Ts &&... xs)
Definition: simulator_core.hpp:414
static auto applySpeedAction(Ts &&... xs)
Definition: simulator_core.hpp:438
static auto applyAssignControllerAction(const std::string &entity_ref, Controller &&controller) -> void
Definition: simulator_core.hpp:311
static auto applyProfileAction(const EntityRef &entity_ref, const DynamicConstraints &dynamic_constraints) -> void
Definition: simulator_core.hpp:276
static auto applyTeleportAction(Ts &&... xs)
Definition: simulator_core.hpp:444
static auto applyDeleteEntityAction(Ts &&... xs)
Definition: simulator_core.hpp:420
static auto applyLaneChangeAction(Ts &&... xs)
Definition: simulator_core.hpp:432
static auto applyAddEntityAction(Ts &&... xs)
Definition: simulator_core.hpp:270
static auto evaluateBoundingBoxEuclideanDistance(const std::string &from_entity_name, const std::string &to_entity_name)
Definition: simulator_core.hpp:473
static auto evaluateTimeHeadway(Ts &&... xs)
Definition: simulator_core.hpp:513
static auto evaluateCollisionCondition(Ts &&... xs) -> bool
Definition: simulator_core.hpp:467
static auto evaluateSimulationTime(Ts &&... xs) -> double
Definition: simulator_core.hpp:491
static auto evaluateStandStill(Ts &&... xs)
Definition: simulator_core.hpp:507
static auto evaluateSpeed(Ts &&... xs)
Definition: simulator_core.hpp:501
static auto evaluateAcceleration(Ts &&... xs)
Definition: simulator_core.hpp:461
static auto makeNativeRelativeWorldPosition(const std::string &from_entity_name, const std::string &to_entity_name)
Definition: simulator_core.hpp:105
static auto makeNativeBoundingBoxRelativeWorldPosition(const std::string &from_entity_name, const std::string &to_entity_name)
Definition: simulator_core.hpp:229
static auto makeNativeRelativeLanePosition(const std::string &from_entity_name, const NativeLanePosition &to_lanelet_pose, const RoutingAlgorithm::value_type routing_algorithm=RoutingAlgorithm::undefined) -> traffic_simulator::LaneletPose
Definition: simulator_core.hpp:159
static auto makeNativeBoundingBoxRelativeLanePosition(const std::string &from_entity_name, const std::string &to_entity_name, const RoutingAlgorithm::value_type routing_algorithm=RoutingAlgorithm::undefined)
Definition: simulator_core.hpp:183
static auto makeNativeBoundingBoxRelativeLanePosition(const NativeLanePosition &from_lanelet_pose, const traffic_simulator_msgs::msg::BoundingBox &from_bounding_box, const NativeLanePosition &to_lanelet_pose, const traffic_simulator_msgs::msg::BoundingBox &to_bounding_box, const RoutingAlgorithm::value_type routing_algorithm=RoutingAlgorithm::undefined) -> traffic_simulator::LaneletPose
Definition: simulator_core.hpp:215
static auto convert(const NativeLanePosition &native_lane_position) -> NativeWorldPosition
Definition: simulator_core.hpp:100
static auto convert(const NativeWorldPosition &pose) -> NativeLanePosition
Definition: simulator_core.hpp:79
static auto makeNativeRelativeLanePosition(const NativeLanePosition &from_lanelet_pose, const NativeLanePosition &to_lanelet_pose, const RoutingAlgorithm::value_type routing_algorithm=RoutingAlgorithm::undefined) -> traffic_simulator::LaneletPose
Definition: simulator_core.hpp:173
static auto makeNativeBoundingBoxRelativeWorldPosition(const std::string &from_entity_name, const NativeWorldPosition &to_map_pose)
Definition: simulator_core.hpp:245
static auto makeNativeRelativeLanePosition(const std::string &from_entity_name, const std::string &to_entity_name, const RoutingAlgorithm::value_type routing_algorithm=RoutingAlgorithm::undefined) -> traffic_simulator::LaneletPose
Definition: simulator_core.hpp:145
static auto canonicalize(const traffic_simulator::LaneletPose &non_canonicalized) -> NativeLanePosition
Definition: simulator_core.hpp:72
static auto makeNativeRelativeWorldPosition(const std::string &from_entity_name, const NativeWorldPosition &to_map_pose)
Definition: simulator_core.hpp:119
static auto makeNativeRelativeWorldPosition(const NativeWorldPosition &from_map_pose, const std::string &to_entity_name)
Definition: simulator_core.hpp:132
static auto makeNativeBoundingBoxRelativeLanePosition(const std::string &from_entity_name, const NativeLanePosition &to_lanelet_pose, const RoutingAlgorithm::value_type routing_algorithm=RoutingAlgorithm::undefined)
Definition: simulator_core.hpp:201
static auto evaluateCurrentState(Ts &&... xs) -> decltype(auto)
Definition: simulator_core.hpp:550
static auto evaluateRelativeHeading(const EntityRef &entity_ref)
Definition: simulator_core.hpp:573
static auto resetV2ITrafficLightPublishRate(Ts &&... xs) -> decltype(auto)
Definition: simulator_core.hpp:602
static auto resetConventionalTrafficLightPublishRate(Ts &&... xs) -> decltype(auto)
Definition: simulator_core.hpp:596
static auto evaluateRelativeHeading(const EntityRef &entity_ref, const OSCLanePosition &osc_lane_position)
Definition: simulator_core.hpp:556
static auto getV2ITrafficLights(Ts &&... xs) -> decltype(auto)
Definition: simulator_core.hpp:590
static auto getConventionalTrafficLights(Ts &&... xs) -> decltype(auto)
Definition: simulator_core.hpp:584
static auto sendCooperateCommand(Ts &&... xs) -> decltype(auto)
Definition: simulator_core.hpp:608
static auto activatePerformanceAssertion(const std::string &entity_ref, const Performance &performance, const Properties &properties)
Definition: simulator_core.hpp:528
static auto asFieldOperatorApplication(Ts &&... xs) -> decltype(auto)
Definition: simulator_core.hpp:539
static auto setConventionalTrafficLightConfidence(Ts &&... xs) -> decltype(auto)
Definition: simulator_core.hpp:615
static auto activateNonUserDefinedControllers() -> decltype(auto)
Definition: simulator_core.hpp:544
Definition: simulator_core.hpp:40
static auto deactivate() -> void
Definition: simulator_core.hpp:58
static auto active()
Definition: simulator_core.hpp:56
static auto activate(const Node &node, const traffic_simulator::Configuration &configuration, Ts &&... xs) -> void
Definition: simulator_core.hpp:45
static auto update() -> void
Definition: simulator_core.hpp:67
Definition: lanelet_pose.hpp:27
auto convertQuaternionToEulerAngle(const T &q)
Definition: quaternion_to_euler.hpp:30
Definition: escape_sequence.hpp:22
geometry_msgs::msg::Pose NativeWorldPosition
Definition: simulator_core.hpp:31
traffic_simulator::LaneletPose NativeRelativeLanePosition
Definition: simulator_core.hpp:37
NativeWorldPosition NativeRelativeWorldPosition
Definition: simulator_core.hpp:33
auto distance(const geometry_msgs::Pose &pose1, const geometry_msgs::Pose &pose2)
Definition: detection_sensor.cpp:34
auto boundingBoxDistance(const geometry_msgs::msg::Pose &from, const traffic_simulator_msgs::msg::BoundingBox &from_bounding_box, const geometry_msgs::msg::Pose &to, const traffic_simulator_msgs::msg::BoundingBox &to_bounding_box) -> std::optional< double >
Definition: distance.cpp:124
auto toMapPose(const CanonicalizedLaneletPose &lanelet_pose) -> const geometry_msgs::msg::Pose
Definition: pose.cpp:53
auto quietNaNPose() -> geometry_msgs::msg::Pose
Definition: pose.cpp:24
auto boundingBoxRelativeLaneletPose(const CanonicalizedLaneletPose &from, const traffic_simulator_msgs::msg::BoundingBox &from_bounding_box, const CanonicalizedLaneletPose &to, const traffic_simulator_msgs::msg::BoundingBox &to_bounding_box, bool allow_lane_change, const std::shared_ptr< hdmap_utils::HdMapUtils > &hdmap_utils_ptr) -> traffic_simulator::LaneletPose
Definition: pose.cpp:136
auto quietNaNLaneletPose() -> traffic_simulator::LaneletPose
Definition: pose.cpp:34
auto boundingBoxRelativePose(const geometry_msgs::msg::Pose &from, const traffic_simulator_msgs::msg::BoundingBox &from_bounding_box, const geometry_msgs::msg::Pose &to, const traffic_simulator_msgs::msg::BoundingBox &to_bounding_box) -> std::optional< geometry_msgs::msg::Pose >
Definition: pose.cpp:93
auto relativePose(const geometry_msgs::msg::Pose &from, const geometry_msgs::msg::Pose &to) -> std::optional< geometry_msgs::msg::Pose >
Definition: pose.cpp:71
auto toLaneletPose(const geometry_msgs::msg::Pose &map_pose, bool include_crosswalk, const std::shared_ptr< hdmap_utils::HdMapUtils > &hdmap_utils_ptr) -> std::optional< CanonicalizedLaneletPose >
Definition: pose.cpp:58
auto canonicalize(const LaneletPose &lanelet_pose, const std::shared_ptr< hdmap_utils::HdMapUtils > &hdmap_utils_ptr) -> CanonicalizedLaneletPose
Definition: pose.cpp:46
auto relativeLaneletPose(const CanonicalizedLaneletPose &from, const CanonicalizedLaneletPose &to, bool allow_lane_change, const std::shared_ptr< hdmap_utils::HdMapUtils > &hdmap_utils_ptr) -> traffic_simulator::LaneletPose
Definition: pose.cpp:113
traffic_simulator_msgs::msg::LaneletPose LaneletPose
Definition: lanelet_pose.hpp:22
Definition: junit5.hpp:25
std::string string
Definition: junit5.hpp:26
Definition: controller.hpp:46
Definition: double.hpp:25
Definition: dynamic_constraints.hpp:44
Definition: entity_ref.hpp:35
Definition: performance.hpp:39
const Double max_deceleration
Definition: performance.hpp:44
const Double max_acceleration
Definition: performance.hpp:40
const Double max_speed
Definition: performance.hpp:48
Definition: properties.hpp:42
Definition: configuration.hpp:30