scenario_simulator_v2 C++ API
entity_manager.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__ENTITY__ENTITY_MANAGER_HPP_
16 #define TRAFFIC_SIMULATOR__ENTITY__ENTITY_MANAGER_HPP_
17 
18 #include <tf2/LinearMath/Quaternion.h>
19 #include <tf2_ros/static_transform_broadcaster.h>
20 #include <tf2_ros/transform_broadcaster.h>
21 
22 #include <memory>
23 #include <optional>
24 #include <rclcpp/node_interfaces/get_node_topics_interface.hpp>
25 #include <rclcpp/node_interfaces/node_topics_interface.hpp>
26 #include <rclcpp/rclcpp.hpp>
28 #include <stdexcept>
29 #include <string>
30 #include <tf2_geometry_msgs/tf2_geometry_msgs.hpp>
47 #include <traffic_simulator_msgs/msg/behavior_parameter.hpp>
48 #include <traffic_simulator_msgs/msg/bounding_box.hpp>
49 #include <traffic_simulator_msgs/msg/entity_status_with_trajectory_array.hpp>
50 #include <traffic_simulator_msgs/msg/vehicle_parameters.hpp>
51 #include <type_traits>
52 #include <unordered_map>
53 #include <utility>
54 #include <vector>
55 #include <visualization_msgs/msg/marker_array.hpp>
56 
57 namespace traffic_simulator
58 {
59 namespace entity
60 {
61 class LaneletMarkerQoS : public rclcpp::QoS
62 {
63 public:
64  explicit LaneletMarkerQoS(std::size_t depth = 1) : rclcpp::QoS(depth) { transient_local(); }
65 };
66 
67 class EntityMarkerQoS : public rclcpp::QoS
68 {
69 public:
70  explicit EntityMarkerQoS(std::size_t depth = 100) : rclcpp::QoS(depth) {}
71 };
72 
74 {
75  Configuration configuration;
76 
77  std::shared_ptr<rclcpp::node_interfaces::NodeTopicsInterface> node_topics_interface;
78  const rclcpp::node_interfaces::NodeParametersInterface::SharedPtr node_parameters_;
79 
80  tf2_ros::StaticTransformBroadcaster broadcaster_;
81  tf2_ros::TransformBroadcaster base_link_broadcaster_;
82 
83  const rclcpp::Clock::SharedPtr clock_ptr_;
84 
85  std::unordered_map<std::string, std::shared_ptr<traffic_simulator::entity::EntityBase>> entities_;
86 
87  bool npc_logic_started_;
88 
89  using EntityStatusWithTrajectoryArray =
90  traffic_simulator_msgs::msg::EntityStatusWithTrajectoryArray;
91  const rclcpp::Publisher<EntityStatusWithTrajectoryArray>::SharedPtr entity_status_array_pub_ptr_;
92 
93  using MarkerArray = visualization_msgs::msg::MarkerArray;
94  const rclcpp::Publisher<MarkerArray>::SharedPtr lanelet_marker_pub_ptr_;
95 
96  const std::shared_ptr<hdmap_utils::HdMapUtils> hdmap_utils_ptr_;
97 
98  MarkerArray markers_raw_;
99 
100  std::shared_ptr<traffic_simulator::TrafficLights> traffic_lights_ptr_;
101 
102 public:
109  const std::shared_ptr<traffic_simulator::TrafficLights> & traffic_lights_ptr) -> void
110  {
111  traffic_lights_ptr_ = traffic_lights_ptr;
112  }
113 
114  template <typename Node>
115  auto getOrigin(Node & node) const
116  {
117  geographic_msgs::msg::GeoPoint origin;
118  {
119  if (!node.has_parameter("origin_latitude")) {
120  node.declare_parameter("origin_latitude", 0.0);
121  }
122  if (!node.has_parameter("origin_longitude")) {
123  node.declare_parameter("origin_longitude", 0.0);
124  }
125  node.get_parameter("origin_latitude", origin.latitude);
126  node.get_parameter("origin_longitude", origin.longitude);
127  }
128 
129  return origin;
130  }
131 
132  template <class NodeT, class AllocatorT = std::allocator<void>>
133  explicit EntityManager(
134  NodeT && node, const Configuration & configuration,
135  const rclcpp::node_interfaces::NodeParametersInterface::SharedPtr & node_parameters)
136  : configuration(configuration),
137  node_topics_interface(rclcpp::node_interfaces::get_node_topics_interface(node)),
138  node_parameters_(node_parameters),
139  broadcaster_(node),
140  base_link_broadcaster_(node),
141  clock_ptr_(node->get_clock()),
142  npc_logic_started_(false),
143  entity_status_array_pub_ptr_(rclcpp::create_publisher<EntityStatusWithTrajectoryArray>(
144  node, "entity/status", EntityMarkerQoS(),
145  rclcpp::PublisherOptionsWithAllocator<AllocatorT>())),
146  lanelet_marker_pub_ptr_(rclcpp::create_publisher<MarkerArray>(
147  node, "lanelet/marker", LaneletMarkerQoS(),
148  rclcpp::PublisherOptionsWithAllocator<AllocatorT>())),
149  hdmap_utils_ptr_(std::make_shared<hdmap_utils::HdMapUtils>(
150  configuration.lanelet2_map_path(), getOrigin(*node))),
151  markers_raw_(hdmap_utils_ptr_->generateMarker())
152  {
154  }
155 
156  ~EntityManager() = default;
157 
158 public:
159  // clang-format off
160 #define FORWARD_TO_ENTITY(IDENTIFIER, ...) \
161  \
166  template <typename... Ts> \
167  decltype(auto) IDENTIFIER(const std::string & name, Ts &&... xs) __VA_ARGS__ \
168  try { \
169  return entities_.at(name)->IDENTIFIER(std::forward<decltype(xs)>(xs)...); \
170  } catch (const std::out_of_range &) { \
171  THROW_SEMANTIC_ERROR("entity : ", name, "does not exist"); \
172  } \
173  static_assert(true, "")
174  // clang-format on
175 
215 
216 #undef FORWARD_TO_ENTITY
217 
218  auto getCurrentAction(const std::string & name) const -> std::string;
219 
220  visualization_msgs::msg::MarkerArray makeDebugMarker() const;
221 
222  auto updateNpcLogic(const std::string & name, const double current_time, const double step_time)
223  -> const CanonicalizedEntityStatus &;
224 
226 
227  void broadcastTransform(
228  const geometry_msgs::msg::PoseStamped & pose, const bool static_transform = true);
229 
230  bool checkCollision(
231  const std::string & first_entity_name, const std::string & second_entity_name);
232 
233  bool despawnEntity(const std::string & name);
234 
235  bool entityExists(const std::string & name);
236 
237  auto getEntityNames() const -> const std::vector<std::string>;
238 
239  auto getEntity(const std::string & name) const
240  -> std::shared_ptr<traffic_simulator::entity::EntityBase>;
241 
242  auto getEntityStatus(const std::string & name) const -> const CanonicalizedEntityStatus &;
243 
244  auto getHdmapUtils() -> const std::shared_ptr<hdmap_utils::HdMapUtils> &;
245 
246  auto getNumberOfEgo() const -> std::size_t;
247 
248  auto getObstacle(const std::string & name)
249  -> std::optional<traffic_simulator_msgs::msg::Obstacle>;
250 
251  auto getPedestrianParameters(const std::string & name) const
252  -> const traffic_simulator_msgs::msg::PedestrianParameters &;
253 
254  auto getVehicleParameters(const std::string & name) const
255  -> const traffic_simulator_msgs::msg::VehicleParameters &;
256 
257  auto getWaypoints(const std::string & name) -> traffic_simulator_msgs::msg::WaypointsArray;
258 
259  template <typename T>
260  auto getGoalPoses(const std::string & name) -> std::vector<T>
261  {
262  if constexpr (std::is_same_v<std::decay_t<T>, CanonicalizedLaneletPose>) {
263  if (not npc_logic_started_) {
264  return {};
265  } else {
266  return entities_.at(name)->getGoalPoses();
267  }
268  } else {
269  if (not npc_logic_started_) {
270  return {};
271  } else {
272  std::vector<geometry_msgs::msg::Pose> poses;
273  for (const auto & lanelet_pose : getGoalPoses<CanonicalizedLaneletPose>(name)) {
274  poses.push_back(pose::toMapPose(lanelet_pose));
275  }
276  return poses;
277  }
278  }
279  }
280 
281  template <typename EntityType>
282  bool is(const std::string & name) const
283  {
284  return dynamic_cast<EntityType const *>(entities_.at(name).get()) != nullptr;
285  }
286 
287  bool isEgoSpawned() const;
288 
289  const std::string getEgoName() const;
290 
291  bool isInLanelet(const std::string & name, const lanelet::Id lanelet_id, const double tolerance);
292 
293  bool isStopping(const std::string & name) const;
294 
295  void requestLaneChange(
296  const std::string & name, const traffic_simulator::lane_change::Direction & direction);
297 
306  void resetBehaviorPlugin(const std::string & name, const std::string & behavior_plugin_name);
307 
308  void setVerbose(const bool verbose);
309 
310  template <typename Entity, typename Pose, typename Parameters, typename... Ts>
311  auto spawnEntity(
312  const std::string & name, const Pose & pose, const Parameters & parameters,
313  const double current_time, Ts &&... xs)
314  {
315  static_assert(
316  std::disjunction<
317  std::is_same<Pose, CanonicalizedLaneletPose>,
318  std::is_same<Pose, geometry_msgs::msg::Pose>>::value,
319  "Pose must be of type CanonicalizedLaneletPose or geometry_msgs::msg::Pose");
320 
322  EntityStatus entity_status;
323 
324  if constexpr (std::is_same_v<std::decay_t<Entity>, EgoEntity>) {
325  if (auto iter = std::find_if(
326  std::begin(entities_), std::end(entities_),
327  [this](auto && each) { return is<EgoEntity>(each.first); });
328  iter != std::end(entities_)) {
329  THROW_SEMANTIC_ERROR("multi ego simulation does not support yet");
330  } else {
331  entity_status.type.type = traffic_simulator_msgs::msg::EntityType::EGO;
332  }
333  } else if constexpr (std::is_same_v<std::decay_t<Entity>, VehicleEntity>) {
334  entity_status.type.type = traffic_simulator_msgs::msg::EntityType::VEHICLE;
335  } else if constexpr (std::is_same_v<std::decay_t<Entity>, PedestrianEntity>) {
336  entity_status.type.type = traffic_simulator_msgs::msg::EntityType::PEDESTRIAN;
337  } else {
338  entity_status.type.type = traffic_simulator_msgs::msg::EntityType::MISC_OBJECT;
339  }
340 
341  entity_status.subtype = parameters.subtype;
342  entity_status.time = current_time;
343  entity_status.name = name;
344  entity_status.bounding_box = parameters.bounding_box;
345  entity_status.action_status = traffic_simulator_msgs::msg::ActionStatus();
346  entity_status.action_status.current_action = "waiting for initialize";
347 
348  const auto include_crosswalk = [](const auto & entity_type) {
349  return (traffic_simulator_msgs::msg::EntityType::PEDESTRIAN == entity_type.type) ||
350  (traffic_simulator_msgs::msg::EntityType::MISC_OBJECT == entity_type.type);
351  }(entity_status.type);
352 
353  const auto matching_distance = [](const auto & local_parameters) {
354  if constexpr (std::is_same_v<
355  std::decay_t<Parameters>, traffic_simulator_msgs::msg::VehicleParameters>) {
356  return std::max(
357  local_parameters.axles.front_axle.track_width,
358  local_parameters.axles.rear_axle.track_width) *
359  0.5 +
360  1.0;
361  } else {
362  return local_parameters.bounding_box.dimensions.y * 0.5 + 1.0;
363  }
364  }(parameters);
365 
366  if constexpr (std::is_same_v<std::decay_t<Pose>, LaneletPose>) {
368  "LaneletPose is not supported type as pose argument. Only CanonicalizedLaneletPose and "
369  "msg::Pose are supported as pose argument of EntityManager::spawnEntity().");
370  } else if constexpr (std::is_same_v<std::decay_t<Pose>, CanonicalizedLaneletPose>) {
371  entity_status.pose = pose::toMapPose(pose);
372  return CanonicalizedEntityStatus(entity_status, pose);
373  } else if constexpr (std::is_same_v<std::decay_t<Pose>, geometry_msgs::msg::Pose>) {
374  entity_status.pose = pose;
375  const auto canonicalized_lanelet_pose = pose::toCanonicalizedLaneletPose(
376  pose, parameters.bounding_box, include_crosswalk, matching_distance, hdmap_utils_ptr_);
377  return CanonicalizedEntityStatus(entity_status, canonicalized_lanelet_pose);
378  }
379  };
380 
381  if (const auto [iter, success] = entities_.emplace(
382  name, std::make_unique<Entity>(
383  name, makeEntityStatus(), hdmap_utils_ptr_, parameters,
384  std::forward<decltype(xs)>(xs)...));
385  success) {
386  // FIXME: this ignores V2I traffic lights
387  iter->second->setTrafficLights(traffic_lights_ptr_->getConventionalTrafficLights());
388  return success;
389  } else {
390  THROW_SEMANTIC_ERROR("Entity ", std::quoted(name), " is already exists.");
391  }
392  }
393 
394  template <typename MessageT, typename... Args>
395  auto createPublisher(Args &&... args)
396  {
397  return rclcpp::create_publisher<MessageT>(node_topics_interface, std::forward<Args>(args)...);
398  }
399 
400  template <typename MessageT, typename... Args>
401  auto createSubscription(Args &&... args)
402  {
403  return rclcpp::create_subscription<MessageT>(
404  node_topics_interface, std::forward<Args>(args)...);
405  }
406 
407  void update(const double current_time, const double step_time);
408 
410 
411  auto startNpcLogic(const double current_time) -> void;
412 
413  auto isNpcLogicStarted() const -> bool { return npc_logic_started_; }
414 };
415 } // namespace entity
416 } // namespace traffic_simulator
417 
418 #endif // TRAFFIC_SIMULATOR__ENTITY__ENTITY_MANAGER_HPP_
Definition: ego_entity.hpp:37
Definition: entity_base.hpp:51
Definition: entity_manager.hpp:74
auto getGoalPoses(const std::string &name) -> std::vector< T >
Definition: entity_manager.hpp:256
void resetBehaviorPlugin(const std::string &name, const std::string &behavior_plugin_name)
Reset behavior plugin of the target entity. The internal behavior is to take over the various paramet...
Definition: entity_manager.cpp:293
bool is(const std::string &name) const
Definition: entity_manager.hpp:278
decltype(auto) requestLaneChange(const std::string &name, Ts &&... xs)
Forward to arguments to the EntityBase:: requestLaneChange function.
Definition: entity_manager.hpp:195
auto createSubscription(Args &&... args)
Definition: entity_manager.hpp:397
void updateHdmapMarker()
Definition: entity_manager.cpp:416
decltype(auto) getEntityTypename(const std::string &name, Ts &&... xs) const
Forward to arguments to the EntityBase:: getEntityTypename function.
Definition: entity_manager.hpp:183
void broadcastEntityTransform()
Definition: entity_manager.cpp:41
decltype(auto) reachPosition(const std::string &name, Ts &&... xs) const
Forward to arguments to the EntityBase:: reachPosition function.
Definition: entity_manager.hpp:190
decltype(auto) getBoundingBox(const std::string &name, Ts &&... xs) const
Forward to arguments to the EntityBase:: getBoundingBox function.
Definition: entity_manager.hpp:177
auto getCurrentAction(const std::string &name) const -> std::string
Definition: entity_manager.cpp:325
decltype(auto) requestAssignRoute(const std::string &name, Ts &&... xs)
Forward to arguments to the EntityBase:: requestAssignRoute function.
Definition: entity_manager.hpp:192
decltype(auto) getDefaultMatchingDistanceForLaneletPoseCalculation(const std::string &name, Ts &&... xs) const
Forward to arguments to the EntityBase:: getDefaultMatchingDistanceForLaneletPoseCalculation function...
Definition: entity_manager.hpp:181
decltype(auto) getEntityType(const std::string &name, Ts &&... xs) const
Forward to arguments to the EntityBase:: getEntityType function.
Definition: entity_manager.hpp:182
decltype(auto) getTraveledDistance(const std::string &name, Ts &&... xs) const
Forward to arguments to the EntityBase:: getTraveledDistance function.
Definition: entity_manager.hpp:187
decltype(auto) setLinearVelocity(const std::string &name, Ts &&... xs)
Forward to arguments to the EntityBase:: setLinearVelocity function.
Definition: entity_manager.hpp:206
bool despawnEntity(const std::string &name)
Definition: entity_manager.cpp:141
decltype(auto) getStandStillDuration(const std::string &name, Ts &&... xs) const
Forward to arguments to the EntityBase:: getStandStillDuration function.
Definition: entity_manager.hpp:186
auto getEntityNames() const -> const std::vector< std::string >
Definition: entity_manager.cpp:151
const std::string getEgoName() const
Definition: entity_manager.cpp:199
decltype(auto) setDecelerationLimit(const std::string &name, Ts &&... xs)
Forward to arguments to the EntityBase:: setDecelerationLimit function.
Definition: entity_manager.hpp:203
decltype(auto) setAccelerationRateLimit(const std::string &name, Ts &&... xs)
Forward to arguments to the EntityBase:: setAccelerationRateLimit function.
Definition: entity_manager.hpp:200
decltype(auto) requestFollowTrajectory(const std::string &name, Ts &&... xs)
Forward to arguments to the EntityBase:: requestFollowTrajectory function.
Definition: entity_manager.hpp:194
auto getEntityStatus(const std::string &name) const -> const CanonicalizedEntityStatus &
Definition: entity_manager.cpp:177
decltype(auto) getCurrentAccel(const std::string &name, Ts &&... xs) const
Forward to arguments to the EntityBase:: getCurrentAccel function.
Definition: entity_manager.hpp:179
decltype(auto) requestAcquirePosition(const std::string &name, Ts &&... xs)
Forward to arguments to the EntityBase:: requestAcquirePosition function.
Definition: entity_manager.hpp:191
void setVerbose(const bool verbose)
Definition: entity_manager.cpp:338
decltype(auto) activateOutOfRangeJob(const std::string &name, Ts &&... xs)
Forward to arguments to the EntityBase:: activateOutOfRangeJob function.
Definition: entity_manager.hpp:172
decltype(auto) setDecelerationRateLimit(const std::string &name, Ts &&... xs)
Forward to arguments to the EntityBase:: setDecelerationRateLimit function.
Definition: entity_manager.hpp:204
bool isEgoSpawned() const
Definition: entity_manager.cpp:254
decltype(auto) isControlledBySimulator(const std::string &name, Ts &&... xs)
Forward to arguments to the EntityBase:: isControlledBySimulator function.
Definition: entity_manager.hpp:188
decltype(auto) getLinearJerk(const std::string &name, Ts &&... xs) const
Forward to arguments to the EntityBase:: getLinearJerk function.
Definition: entity_manager.hpp:184
decltype(auto) requestSpeedChange(const std::string &name, Ts &&... xs)
Forward to arguments to the EntityBase:: requestSpeedChange function.
Definition: entity_manager.hpp:210
decltype(auto) setAcceleration(const std::string &name, Ts &&... xs)
Forward to arguments to the EntityBase:: setAcceleration function.
Definition: entity_manager.hpp:198
decltype(auto) getCanonicalizedStatusBeforeUpdate(const std::string &name, Ts &&... xs) const
Forward to arguments to the EntityBase:: getCanonicalizedStatusBeforeUpdate function.
Definition: entity_manager.hpp:178
decltype(auto) requestClearRoute(const std::string &name, Ts &&... xs)
Forward to arguments to the EntityBase:: requestClearRoute function.
Definition: entity_manager.hpp:193
bool entityExists(const std::string &name)
Definition: entity_manager.cpp:146
bool checkCollision(const std::string &first_entity_name, const std::string &second_entity_name)
Definition: entity_manager.cpp:117
auto getWaypoints(const std::string &name) -> traffic_simulator_msgs::msg::WaypointsArray
Definition: entity_manager.cpp:244
decltype(auto) getBehaviorParameter(const std::string &name, Ts &&... xs) const
Forward to arguments to the EntityBase:: getBehaviorParameter function.
Definition: entity_manager.hpp:176
auto isNpcLogicStarted() const -> bool
Definition: entity_manager.hpp:409
decltype(auto) getRouteLanelets(const std::string &name, Ts &&... xs) const
Forward to arguments to the EntityBase:: getRouteLanelets function.
Definition: entity_manager.hpp:185
decltype(auto) setMapPose(const std::string &name, Ts &&... xs)
Forward to arguments to the EntityBase:: setMapPose function.
Definition: entity_manager.hpp:207
decltype(auto) get2DPolygon(const std::string &name, Ts &&... xs) const
Forward to arguments to the EntityBase:: get2DPolygon function.
Definition: entity_manager.hpp:175
decltype(auto) requestWalkStraight(const std::string &name, Ts &&... xs)
Forward to arguments to the EntityBase:: requestWalkStraight function.
Definition: entity_manager.hpp:197
auto spawnEntity(const std::string &name, const Pose &pose, const Parameters &parameters, const double current_time, Ts &&... xs)
Definition: entity_manager.hpp:307
decltype(auto) setLinearJerk(const std::string &name, Ts &&... xs)
Forward to arguments to the EntityBase:: setLinearJerk function.
Definition: entity_manager.hpp:205
auto setTrafficLights(const std::shared_ptr< traffic_simulator::TrafficLights > &traffic_lights_ptr) -> void
Definition: entity_manager.hpp:108
decltype(auto) requestSynchronize(const std::string &name, Ts &&... xs)
Forward to arguments to the EntityBase:: requestSynchronize function.
Definition: entity_manager.hpp:196
decltype(auto) setAccelerationLimit(const std::string &name, Ts &&... xs)
Forward to arguments to the EntityBase:: setAccelerationLimit function.
Definition: entity_manager.hpp:199
EntityManager(NodeT &&node, const Configuration &configuration, const rclcpp::node_interfaces::NodeParametersInterface::SharedPtr &node_parameters)
Definition: entity_manager.hpp:133
auto getHdmapUtils() -> const std::shared_ptr< hdmap_utils::HdMapUtils > &
Definition: entity_manager.cpp:187
auto getPedestrianParameters(const std::string &name) const -> const traffic_simulator_msgs::msg::PedestrianParameters &
Definition: entity_manager.cpp:222
auto getOrigin(Node &node) const
Definition: entity_manager.hpp:115
bool isInLanelet(const std::string &name, const lanelet::Id lanelet_id, const double tolerance)
Definition: entity_manager.cpp:264
decltype(auto) setBehaviorParameter(const std::string &name, Ts &&... xs)
Forward to arguments to the EntityBase:: setBehaviorParameter function.
Definition: entity_manager.hpp:201
void broadcastTransform(const geometry_msgs::msg::PoseStamped &pose, const bool static_transform=true)
Definition: entity_manager.cpp:96
void update(const double current_time, const double step_time)
Definition: entity_manager.cpp:366
auto getEntity(const std::string &name) const -> std::shared_ptr< traffic_simulator::entity::EntityBase >
Definition: entity_manager.cpp:160
visualization_msgs::msg::MarkerArray makeDebugMarker() const
Definition: entity_manager.cpp:132
auto createPublisher(Args &&... args)
Definition: entity_manager.hpp:391
auto updateNpcLogic(const std::string &name, const double current_time, const double step_time) -> const CanonicalizedEntityStatus &
Definition: entity_manager.cpp:346
auto getVehicleParameters(const std::string &name) const -> const traffic_simulator_msgs::msg::VehicleParameters &
Definition: entity_manager.cpp:233
decltype(auto) laneMatchingSucceed(const std::string &name, Ts &&... xs) const
Forward to arguments to the EntityBase:: laneMatchingSucceed function.
Definition: entity_manager.hpp:189
decltype(auto) getCurrentTwist(const std::string &name, Ts &&... xs) const
Forward to arguments to the EntityBase:: getCurrentTwist function.
Definition: entity_manager.hpp:180
auto startNpcLogic(const double current_time) -> void
Definition: entity_manager.cpp:428
decltype(auto) setVelocityLimit(const std::string &name, Ts &&... xs)
Forward to arguments to the EntityBase:: setVelocityLimit function.
Definition: entity_manager.hpp:209
auto getObstacle(const std::string &name) -> std::optional< traffic_simulator_msgs::msg::Obstacle >
Definition: entity_manager.cpp:212
decltype(auto) setControlledBySimulator(const std::string &name, Ts &&... xs)
Forward to arguments to the EntityBase:: setControlledBySimulator function.
Definition: entity_manager.hpp:202
decltype(auto) asFieldOperatorApplication(const std::string &name, Ts &&... xs) const
Forward to arguments to the EntityBase:: asFieldOperatorApplication function.
Definition: entity_manager.hpp:173
auto getNumberOfEgo() const -> std::size_t
Definition: entity_manager.cpp:192
decltype(auto) setTwist(const std::string &name, Ts &&... xs)
Forward to arguments to the EntityBase:: setTwist function.
Definition: entity_manager.hpp:208
decltype(auto) cancelRequest(const std::string &name, Ts &&... xs)
Forward to arguments to the EntityBase:: cancelRequest function.
Definition: entity_manager.hpp:174
bool isStopping(const std::string &name) const
Definition: entity_manager.cpp:276
Definition: entity_manager.hpp:68
EntityMarkerQoS(std::size_t depth=100)
Definition: entity_manager.hpp:70
Definition: entity_manager.hpp:62
LaneletMarkerQoS(std::size_t depth=1)
Definition: entity_manager.hpp:64
Definition: entity_status.hpp:32
Definition: lanelet_pose.hpp:27
#define THROW_SYNTAX_ERROR(...)
Definition: exception.hpp:62
#define THROW_SEMANTIC_ERROR(...)
Definition: exception.hpp:59
#define FORWARD_TO_ENTITY(IDENTIFIER,...)
Definition: entity_manager.hpp:160
Definition: cache.hpp:46
Definition: cache.hpp:27
Direction
Definition: lane_change.hpp:29
auto toCanonicalizedLaneletPose(const geometry_msgs::msg::Pose &map_pose, const bool include_crosswalk, const std::shared_ptr< hdmap_utils::HdMapUtils > &hdmap_utils_ptr) -> std::optional< CanonicalizedLaneletPose >
Definition: pose.cpp:73
auto toMapPose(const CanonicalizedLaneletPose &lanelet_pose) -> geometry_msgs::msg::Pose
Definition: pose.cpp:59
Definition: api.hpp:49
traffic_simulator_msgs::msg::EntityType EntityType
Definition: entity_status.hpp:26
traffic_simulator_msgs::msg::LaneletPose LaneletPose
Definition: lanelet_pose.hpp:22
traffic_simulator_msgs::msg::EntityStatus EntityStatus
Definition: entity_status.hpp:25
Definition: junit5.hpp:25
std::string string
Definition: junit5.hpp:26
Definition: configuration.hpp:29
auto makeEntityStatus(std::shared_ptr< hdmap_utils::HdMapUtils > hdmap_utils, traffic_simulator::lanelet_pose::CanonicalizedLaneletPose pose, traffic_simulator_msgs::msg::BoundingBox bbox, const double speed=0.0, const std::string name="default_entity_name", const uint8_t type=traffic_simulator_msgs::msg::EntityType::VEHICLE) -> traffic_simulator::EntityStatus
Definition: helper_functions.hpp:107
class definition of the traffic sink