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