scenario_simulator_v2 C++ API
api.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__API__API_HPP_
16 #define TRAFFIC_SIMULATOR__API__API_HPP_
17 
18 #include <simulation_api_schema.pb.h>
19 
20 #include <autoware_auto_vehicle_msgs/msg/vehicle_control_command.hpp>
21 #include <autoware_auto_vehicle_msgs/msg/vehicle_state_command.hpp>
22 #include <boost/variant.hpp>
23 #include <cassert>
24 #include <memory>
25 #include <optional>
26 #include <rclcpp/rclcpp.hpp>
27 #include <rosgraph_msgs/msg/clock.hpp>
30 #include <std_msgs/msg/float64.hpp>
31 #include <stdexcept>
32 #include <string>
45 #include <traffic_simulator_msgs/msg/behavior_parameter.hpp>
46 #include <utility>
47 
49 {
51 {
52  static auto autoware() noexcept -> const std::string &
53  {
54  static const std::string name = "Autoware";
55  return name;
56  }
57 };
58 
60 {
61 };
62 
63 class API
64 {
65 public:
66  template <typename NodeT, typename AllocatorT = std::allocator<void>, typename... Ts>
67  explicit API(NodeT && node, const Configuration & configuration, Ts &&... xs)
68  : configuration(configuration),
69  node_parameters_(
70  rclcpp::node_interfaces::get_node_parameters_interface(std::forward<NodeT>(node))),
71  entity_manager_ptr_(
72  std::make_shared<entity::EntityManager>(node, configuration, node_parameters_)),
73  traffic_lights_ptr_(std::make_shared<TrafficLights>(
74  node, entity_manager_ptr_->getHdmapUtils(),
75  getROS2Parameter<std::string>("architecture_type", "awf/universe"))),
76  traffic_controller_ptr_(std::make_shared<traffic::TrafficController>(
77  entity_manager_ptr_->getHdmapUtils(), [this]() { return API::getEntityNames(); },
78  [this](const auto & entity_name) {
79  if (const auto entity = getEntity(entity_name)) {
80  return entity->getMapPose();
81  } else {
82  THROW_SEMANTIC_ERROR("Entity ", std::quoted(entity_name), " does not exists.");
83  }
84  },
85  [this](const auto & name) { return API::despawn(name); }, configuration.auto_sink)),
86  clock_pub_(rclcpp::create_publisher<rosgraph_msgs::msg::Clock>(
87  node, "/clock", rclcpp::QoS(rclcpp::KeepLast(1)).best_effort(),
88  rclcpp::PublisherOptionsWithAllocator<AllocatorT>())),
89  debug_marker_pub_(rclcpp::create_publisher<visualization_msgs::msg::MarkerArray>(
90  node, "debug_marker", rclcpp::QoS(100), rclcpp::PublisherOptionsWithAllocator<AllocatorT>())),
91  real_time_factor_subscriber(rclcpp::create_subscription<std_msgs::msg::Float64>(
92  node, "/real_time_factor", rclcpp::QoS(rclcpp::KeepLast(1)).best_effort(),
93  [this](const std_msgs::msg::Float64 & message) {
98  if (message.data >= 0.001) {
99  clock_.realtime_factor = message.data;
100  simulation_api_schema::UpdateStepTimeRequest request;
101  request.set_simulation_step_time(clock_.getStepTime());
102  zeromq_client_.call(request);
103  }
104  })),
105  clock_(node->get_parameter("use_sim_time").as_bool(), std::forward<decltype(xs)>(xs)...),
106  zeromq_client_(
107  simulation_interface::protocol, configuration.simulator_host, getZMQSocketPort(*node))
108  {
109  entity_manager_ptr_->setTrafficLights(traffic_lights_ptr_);
110  setVerbose(configuration.verbose);
111 
112  if (not configuration.standalone_mode) {
113  simulation_api_schema::InitializeRequest request;
114  request.set_initialize_time(clock_.getCurrentSimulationTime());
115  request.set_lanelet2_map_path(configuration.lanelet2_map_path().string());
116  request.set_realtime_factor(clock_.realtime_factor);
117  request.set_step_time(clock_.getStepTime());
119  clock_.getCurrentRosTime(), *request.mutable_initialize_ros_time());
120  if (not zeromq_client_.call(request).result().success()) {
121  throw common::SimulationError("Failed to initialize simulator by InitializeRequest");
122  }
123  }
124  }
125 
126  template <typename ParameterT, typename... Ts>
127  auto getROS2Parameter(Ts &&... xs) const -> decltype(auto)
128  {
129  return getParameter<ParameterT>(node_parameters_, std::forward<Ts>(xs)...);
130  }
131 
132  template <typename Node>
133  int getZMQSocketPort(Node & node)
134  {
135  if (!node.has_parameter("port")) node.declare_parameter("port", 5555);
136  return node.get_parameter("port").as_int();
137  }
138 
139  void closeZMQConnection() { zeromq_client_.closeConnection(); }
140 
141  void setVerbose(const bool verbose);
142 
143  template <typename Pose>
144  auto spawn(
145  const std::string & name, const Pose & pose,
146  const traffic_simulator_msgs::msg::VehicleParameters & parameters,
147  const std::string & behavior = VehicleBehavior::defaultBehavior(),
148  const std::string & model3d = "")
149  {
150  auto register_to_entity_manager = [&]() {
151  if (behavior == VehicleBehavior::autoware()) {
152  return entity_manager_ptr_->entityExists(name) or
153  entity_manager_ptr_->spawnEntity<entity::EgoEntity>(
154  name, pose, parameters, getCurrentTime(), configuration, node_parameters_);
155  } else {
156  return entity_manager_ptr_->spawnEntity<entity::VehicleEntity>(
157  name, pose, parameters, getCurrentTime(), behavior);
158  }
159  };
160 
161  auto register_to_environment_simulator = [&]() {
162  if (configuration.standalone_mode) {
163  return true;
164  } else if (const auto entity = entity_manager_ptr_->getEntity(name); not entity) {
165  throw common::SemanticError(
166  "Entity ", name, " can not be registered in simulator - it has not been spawned yet.");
167  } else {
168  simulation_api_schema::SpawnVehicleEntityRequest req;
169  simulation_interface::toProto(parameters, *req.mutable_parameters());
170  req.mutable_parameters()->set_name(name);
171  req.set_asset_key(model3d);
172  simulation_interface::toProto(entity->getMapPose(), *req.mutable_pose());
173  req.set_is_ego(behavior == VehicleBehavior::autoware());
175  req.set_initial_speed(0.0);
176  return zeromq_client_.call(req).result().success();
177  }
178  };
179 
180  return register_to_entity_manager() and register_to_environment_simulator();
181  }
182 
183  template <typename Pose>
184  auto spawn(
185  const std::string & name, const Pose & pose,
186  const traffic_simulator_msgs::msg::PedestrianParameters & parameters,
188  const std::string & model3d = "")
189  {
190  auto register_to_entity_manager = [&]() {
191  return entity_manager_ptr_->spawnEntity<entity::PedestrianEntity>(
192  name, pose, parameters, getCurrentTime(), behavior);
193  };
194 
195  auto register_to_environment_simulator = [&]() {
196  if (configuration.standalone_mode) {
197  return true;
198  } else if (const auto entity = entity_manager_ptr_->getEntity(name); not entity) {
199  throw common::SemanticError(
200  "Entity ", name, " can not be registered in simulator - it has not been spawned yet.");
201  } else {
202  simulation_api_schema::SpawnPedestrianEntityRequest req;
203  simulation_interface::toProto(parameters, *req.mutable_parameters());
204  req.mutable_parameters()->set_name(name);
205  req.set_asset_key(model3d);
206  simulation_interface::toProto(entity->getMapPose(), *req.mutable_pose());
207  return zeromq_client_.call(req).result().success();
208  }
209  };
210 
211  return register_to_entity_manager() and register_to_environment_simulator();
212  }
213 
214  template <typename Pose>
215  auto spawn(
216  const std::string & name, const Pose & pose,
217  const traffic_simulator_msgs::msg::MiscObjectParameters & parameters,
218  const std::string & model3d = "")
219  {
220  auto register_to_entity_manager = [&]() {
221  return entity_manager_ptr_->spawnEntity<entity::MiscObjectEntity>(
222  name, pose, parameters, getCurrentTime());
223  };
224 
225  auto register_to_environment_simulator = [&]() {
226  if (configuration.standalone_mode) {
227  return true;
228  } else if (const auto entity = entity_manager_ptr_->getEntity(name); not entity) {
229  throw common::SemanticError(
230  "Entity ", name, " can not be registered in simulator - it has not been spawned yet.");
231  } else {
232  simulation_api_schema::SpawnMiscObjectEntityRequest req;
233  simulation_interface::toProto(parameters, *req.mutable_parameters());
234  req.mutable_parameters()->set_name(name);
235  req.set_asset_key(model3d);
236  simulation_interface::toProto(entity->getMapPose(), *req.mutable_pose());
237  return zeromq_client_.call(req).result().success();
238  }
239  };
240 
241  return register_to_entity_manager() and register_to_environment_simulator();
242  }
243 
244  bool despawn(const std::string & name);
245  bool despawnEntities();
246 
247  auto setEntityStatus(const std::string & name, const EntityStatus & status) -> void;
248  auto respawn(
249  const std::string & name, const geometry_msgs::msg::PoseWithCovarianceStamped & new_pose,
250  const geometry_msgs::msg::PoseStamped & goal_pose) -> void;
251  auto setEntityStatus(
252  const std::string & name, const geometry_msgs::msg::Pose & map_pose,
253  const traffic_simulator_msgs::msg::ActionStatus & action_status =
255  auto setEntityStatus(
256  const std::string & name, const LaneletPose & lanelet_pose,
257  const traffic_simulator_msgs::msg::ActionStatus & action_status) -> void;
258  auto setEntityStatus(
259  const std::string & name, const CanonicalizedLaneletPose & canonicalized_lanelet_pose,
260  const traffic_simulator_msgs::msg::ActionStatus & action_status =
262  auto setEntityStatus(
263  const std::string & name, const std::string & reference_entity_name,
264  const geometry_msgs::msg::Pose & relative_pose,
265  const traffic_simulator_msgs::msg::ActionStatus & action_status =
267  auto setEntityStatus(
268  const std::string & name, const std::string & reference_entity_name,
269  const geometry_msgs::msg::Point & relative_position,
270  const geometry_msgs::msg::Vector3 & relative_rpy,
271  const traffic_simulator_msgs::msg::ActionStatus & action_status =
273 
274  std::optional<double> getTimeHeadway(const std::string & from, const std::string & to);
275 
276  auto attachImuSensor(
277  const std::string &, const simulation_api_schema::ImuSensorConfiguration & configuration)
278  -> bool;
279 
281  const simulation_api_schema::PseudoTrafficLightDetectorConfiguration &);
282 
283  bool attachLidarSensor(const simulation_api_schema::LidarConfiguration &);
284  bool attachLidarSensor(
285  const std::string &, const double lidar_sensor_delay,
287 
288  bool attachDetectionSensor(const simulation_api_schema::DetectionSensorConfiguration &);
290  const std::string &, double detection_sensor_range, bool detect_all_objects_in_range,
291  double pos_noise_stddev, int random_seed, double probability_of_lost,
292  double object_recognition_delay);
293 
294  bool attachOccupancyGridSensor(const simulation_api_schema::OccupancyGridSensorConfiguration &);
295 
296  bool updateFrame();
297 
298  double getCurrentTime() const noexcept { return clock_.getCurrentScenarioTime(); }
299 
300  void startNpcLogic();
301 
302  void requestLaneChange(const std::string & name, const lanelet::Id & lanelet_id);
303 
304  void requestLaneChange(const std::string & name, const lane_change::Direction & direction);
305 
306  void requestLaneChange(const std::string & name, const lane_change::Parameter &);
307 
308  void requestLaneChange(
309  const std::string & name, const lane_change::RelativeTarget & target,
310  const lane_change::TrajectoryShape trajectory_shape,
311  const lane_change::Constraint & constraint);
312 
313  void requestLaneChange(
314  const std::string & name, const lane_change::AbsoluteTarget & target,
315  const lane_change::TrajectoryShape trajectory_shape,
316  const lane_change::Constraint & constraint);
317 
336  auto addTrafficSource(
337  const double radius, const double rate, const double speed,
338  const geometry_msgs::msg::Pose & position,
339  const traffic::TrafficSource::Distribution & distribution,
340  const bool allow_spawn_outside_lane = false, const bool require_footprint_fitting = false,
341  const bool random_orientation = false, std::optional<int> random_seed = std::nullopt) -> void;
342 
343  auto getV2ITrafficLights() { return traffic_lights_ptr_->getV2ITrafficLights(); }
344 
346  {
347  return traffic_lights_ptr_->getConventionalTrafficLights();
348  }
349 
350  auto getEntity(const std::string & name) const -> std::shared_ptr<entity::EntityBase>;
351 
352  // clang-format off
353 #define FORWARD_TO_ENTITY_MANAGER(NAME) \
354  \
359  template <typename... Ts> \
360  decltype(auto) NAME(Ts &&... xs) \
361  { \
362  assert(entity_manager_ptr_); \
363  return (*entity_manager_ptr_).NAME(std::forward<decltype(xs)>(xs)...); \
364  } \
365  static_assert(true, "")
366  // clang-format on
367 
409 
410 private:
411  FORWARD_TO_ENTITY_MANAGER(getDefaultMatchingDistanceForLaneletPoseCalculation);
412 
413 public:
414 #undef FORWARD_TO_ENTITY_MANAGER
415 
416 private:
417  bool updateTimeInSim();
418 
419  bool updateEntitiesStatusInSim();
420 
421  bool updateTrafficLightsInSim();
422 
423  const Configuration configuration;
424 
425  const rclcpp::node_interfaces::NodeParametersInterface::SharedPtr node_parameters_;
426 
427  const std::shared_ptr<entity::EntityManager> entity_manager_ptr_;
428 
429  const std::shared_ptr<TrafficLights> traffic_lights_ptr_;
430 
431  const std::shared_ptr<traffic::TrafficController> traffic_controller_ptr_;
432 
433  const rclcpp::Publisher<rosgraph_msgs::msg::Clock>::SharedPtr clock_pub_;
434 
435  const rclcpp::Publisher<visualization_msgs::msg::MarkerArray>::SharedPtr debug_marker_pub_;
436 
437  const rclcpp::Subscription<std_msgs::msg::Float64>::SharedPtr real_time_factor_subscriber;
438 
439  SimulationClock clock_;
440 
441  zeromq::MultiClient zeromq_client_;
442 };
443 } // namespace traffic_simulator
444 
445 #endif // TRAFFIC_SIMULATOR__API__API_HPP_
#define FORWARD_TO_ENTITY_MANAGER(NAME)
Definition: api.hpp:353
Definition: api.hpp:64
auto spawn(const std::string &name, const Pose &pose, const traffic_simulator_msgs::msg::MiscObjectParameters &parameters, const std::string &model3d="")
Definition: api.hpp:215
auto getV2ITrafficLights()
Definition: api.hpp:343
decltype(auto) getCanonicalizedStatusBeforeUpdate(Ts &&... xs)
Forward to arguments to the EntityManager:: getCanonicalizedStatusBeforeUpdate function.
Definition: api.hpp:377
decltype(auto) getHdmapUtils(Ts &&... xs)
Forward to arguments to the EntityManager:: getHdmapUtils function.
Definition: api.hpp:378
decltype(auto) requestFollowTrajectory(Ts &&... xs)
Forward to arguments to the EntityManager:: requestFollowTrajectory function.
Definition: api.hpp:389
double getCurrentTime() const noexcept
Definition: api.hpp:298
decltype(auto) resetBehaviorPlugin(Ts &&... xs)
Forward to arguments to the EntityManager:: resetBehaviorPlugin function.
Definition: api.hpp:394
auto addTrafficSource(const double radius, const double rate, const double speed, const geometry_msgs::msg::Pose &position, const traffic::TrafficSource::Distribution &distribution, const bool allow_spawn_outside_lane=false, const bool require_footprint_fitting=false, const bool random_orientation=false, std::optional< int > random_seed=std::nullopt) -> void
Add a traffic source to the simulation.
Definition: api.cpp:406
API(NodeT &&node, const Configuration &configuration, Ts &&... xs)
Definition: api.hpp:67
decltype(auto) isEgoSpawned(Ts &&... xs)
Forward to arguments to the EntityManager:: isEgoSpawned function.
Definition: api.hpp:382
decltype(auto) getTraveledDistance(Ts &&... xs)
Forward to arguments to the EntityManager:: getTraveledDistance function.
Definition: api.hpp:381
void requestLaneChange(const std::string &name, const lanelet::Id &lanelet_id)
Definition: api.cpp:373
auto setEntityStatus(const std::string &name, const EntityStatus &status) -> void
Definition: api.cpp:123
decltype(auto) setMapPose(Ts &&... xs)
Forward to arguments to the EntityManager:: setMapPose function.
Definition: api.hpp:402
decltype(auto) setBehaviorParameter(Ts &&... xs)
Forward to arguments to the EntityManager:: setBehaviorParameter function.
Definition: api.hpp:398
void startNpcLogic()
Definition: api.cpp:363
auto getConventionalTrafficLights()
Definition: api.hpp:345
decltype(auto) isInLanelet(Ts &&... xs)
Forward to arguments to the EntityManager:: isInLanelet function.
Definition: api.hpp:383
decltype(auto) setDecelerationRateLimit(Ts &&... xs)
Forward to arguments to the EntityManager:: setDecelerationRateLimit function.
Definition: api.hpp:400
decltype(auto) requestWalkStraight(Ts &&... xs)
Forward to arguments to the EntityManager:: requestWalkStraight function.
Definition: api.hpp:392
int getZMQSocketPort(Node &node)
Definition: api.hpp:133
decltype(auto) getBoundingBox(Ts &&... xs)
Forward to arguments to the EntityManager:: getBoundingBox function.
Definition: api.hpp:370
bool attachOccupancyGridSensor(const simulation_api_schema::OccupancyGridSensorConfiguration &)
Definition: api.cpp:248
decltype(auto) getStandStillDuration(Ts &&... xs)
Forward to arguments to the EntityManager:: getStandStillDuration function.
Definition: api.hpp:380
decltype(auto) requestSynchronize(Ts &&... xs)
Forward to arguments to the EntityManager:: requestSynchronize function.
Definition: api.hpp:391
decltype(auto) setAccelerationLimit(Ts &&... xs)
Forward to arguments to the EntityManager:: setAccelerationLimit function.
Definition: api.hpp:396
decltype(auto) requestClearRoute(Ts &&... xs)
Forward to arguments to the EntityManager:: requestClearRoute function.
Definition: api.hpp:393
void setVerbose(const bool verbose)
Definition: api.cpp:31
decltype(auto) checkCollision(Ts &&... xs)
Forward to arguments to the EntityManager:: checkCollision function.
Definition: api.hpp:367
decltype(auto) reachPosition(Ts &&... xs)
Forward to arguments to the EntityManager:: reachPosition function.
Definition: api.hpp:386
decltype(auto) setAcceleration(Ts &&... xs)
Forward to arguments to the EntityManager:: setAcceleration function.
Definition: api.hpp:395
decltype(auto) getCurrentAccel(Ts &&... xs)
Forward to arguments to the EntityManager:: getCurrentAccel function.
Definition: api.hpp:371
auto getROS2Parameter(Ts &&... xs) const -> decltype(auto)
Definition: api.hpp:127
auto spawn(const std::string &name, const Pose &pose, const traffic_simulator_msgs::msg::VehicleParameters &parameters, const std::string &behavior=VehicleBehavior::defaultBehavior(), const std::string &model3d="")
Definition: api.hpp:144
decltype(auto) getLinearJerk(Ts &&... xs)
Forward to arguments to the EntityManager:: getLinearJerk function.
Definition: api.hpp:379
decltype(auto) getEntityStatus(Ts &&... xs)
Forward to arguments to the EntityManager:: getEntityStatus function.
Definition: api.hpp:376
bool attachDetectionSensor(const simulation_api_schema::DetectionSensorConfiguration &)
Definition: api.cpp:225
std::optional< double > getTimeHeadway(const std::string &from, const std::string &to)
Definition: api.cpp:133
decltype(auto) setTwist(Ts &&... xs)
Forward to arguments to the EntityManager:: setTwist function.
Definition: api.hpp:403
decltype(auto) isNpcLogicStarted(Ts &&... xs)
Forward to arguments to the EntityManager:: isNpcLogicStarted function.
Definition: api.hpp:384
decltype(auto) getCurrentAction(Ts &&... xs)
Forward to arguments to the EntityManager:: getCurrentAction function.
Definition: api.hpp:372
auto spawn(const std::string &name, const Pose &pose, const traffic_simulator_msgs::msg::PedestrianParameters &parameters, const std::string &behavior=PedestrianBehavior::defaultBehavior(), const std::string &model3d="")
Definition: api.hpp:184
auto respawn(const std::string &name, const geometry_msgs::msg::PoseWithCovarianceStamped &new_pose, const geometry_msgs::msg::PoseStamped &goal_pose) -> void
Definition: api.cpp:54
decltype(auto) laneMatchingSucceed(Ts &&... xs)
Forward to arguments to the EntityManager:: laneMatchingSucceed function.
Definition: api.hpp:385
void closeZMQConnection()
Definition: api.hpp:139
decltype(auto) getEntityNames(Ts &&... xs)
Forward to arguments to the EntityManager:: getEntityNames function.
Definition: api.hpp:375
decltype(auto) setAccelerationRateLimit(Ts &&... xs)
Forward to arguments to the EntityManager:: setAccelerationRateLimit function.
Definition: api.hpp:397
bool attachPseudoTrafficLightDetector(const simulation_api_schema::PseudoTrafficLightDetectorConfiguration &)
Definition: api.cpp:217
decltype(auto) requestSpeedChange(Ts &&... xs)
Forward to arguments to the EntityManager:: requestSpeedChange function.
Definition: api.hpp:390
decltype(auto) setLinearVelocity(Ts &&... xs)
Forward to arguments to the EntityManager:: setLinearVelocity function.
Definition: api.hpp:401
decltype(auto) cancelRequest(Ts &&... xs)
Forward to arguments to the EntityManager:: cancelRequest function.
Definition: api.hpp:366
decltype(auto) setDecelerationLimit(Ts &&... xs)
Forward to arguments to the EntityManager:: setDecelerationLimit function.
Definition: api.hpp:399
bool despawnEntities()
Definition: api.cpp:47
decltype(auto) setVelocityLimit(Ts &&... xs)
Forward to arguments to the EntityManager:: setVelocityLimit function.
Definition: api.hpp:404
decltype(auto) entityExists(Ts &&... xs)
Forward to arguments to the EntityManager:: entityExists function.
Definition: api.hpp:368
bool despawn(const std::string &name)
Definition: api.cpp:33
decltype(auto) getCurrentTwist(Ts &&... xs)
Forward to arguments to the EntityManager:: getCurrentTwist function.
Definition: api.hpp:373
decltype(auto) activateOutOfRangeJob(Ts &&... xs)
Forward to arguments to the EntityManager:: activateOutOfRangeJob function.
Definition: api.hpp:364
bool attachLidarSensor(const simulation_api_schema::LidarConfiguration &)
Definition: api.cpp:260
decltype(auto) getEgoName(Ts &&... xs)
Forward to arguments to the EntityManager:: getEgoName function.
Definition: api.hpp:374
decltype(auto) asFieldOperatorApplication(Ts &&... xs)
Forward to arguments to the EntityManager:: asFieldOperatorApplication function.
Definition: api.hpp:365
auto getEntity(const std::string &name) const -> std::shared_ptr< entity::EntityBase >
Definition: api.cpp:102
decltype(auto) requestAssignRoute(Ts &&... xs)
Forward to arguments to the EntityManager:: requestAssignRoute function.
Definition: api.hpp:388
auto attachImuSensor(const std::string &, const simulation_api_schema::ImuSensorConfiguration &configuration) -> bool
Definition: api.cpp:209
decltype(auto) getBehaviorParameter(Ts &&... xs)
Forward to arguments to the EntityManager:: getBehaviorParameter function.
Definition: api.hpp:369
bool updateFrame()
Definition: api.cpp:336
decltype(auto) requestAcquirePosition(Ts &&... xs)
Forward to arguments to the EntityManager:: requestAcquirePosition function.
Definition: api.hpp:387
Definition: simulation_clock.hpp:24
auto getCurrentRosTime() -> rclcpp::Time
Definition: simulation_clock.cpp:41
double realtime_factor
Definition: simulation_clock.hpp:49
auto getCurrentScenarioTime() const
Definition: simulation_clock.hpp:32
auto getCurrentSimulationTime() const
Definition: simulation_clock.hpp:37
auto getStepTime() const
Definition: simulation_clock.hpp:39
Definition: traffic_lights.hpp:124
Definition: ego_entity.hpp:37
Definition: misc_object_entity.hpp:27
Definition: pedestrian_entity.hpp:34
Definition: vehicle_entity.hpp:37
Definition: lanelet_pose.hpp:27
std::vector< std::tuple< VehicleOrPedestrianParameter, std::string, std::string, double > > Distribution
Definition: traffic_source.hpp:69
Definition: zmq_multi_client.hpp:33
void closeConnection()
Definition: zmq_multi_client.cpp:33
auto call(const simulation_api_schema::SimulationRequest &) -> simulation_api_schema::SimulationResponse
Definition: zmq_multi_client.cpp:43
#define THROW_SEMANTIC_ERROR(...)
Definition: exception.hpp:59
void toProto(const geometry_msgs::msg::Point &p, geometry_msgs::Point &proto)
Definition: conversions.cpp:22
const TransportProtocol protocol
Definition: constants.hpp:30
Definition: cache.hpp:27
traffic_simulator_msgs::msg::ActionStatus constructActionStatus(double linear_vel=0, double angular_vel=0, double linear_accel=0, double angular_accel=0)
helper function for constructing action status
Definition: helper.cpp:25
LidarType
Definition: helper.hpp:145
TrajectoryShape
Definition: lane_change.hpp:31
Direction
Definition: lane_change.hpp:29
Definition: api.hpp:49
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
Although there were no syntactic errors in the description of the scenario, differences in meaning an...
Definition: exception.hpp:44
A problem occurred that interfered with the continuation of the simulation.
Definition: exception.hpp:47
Definition: configuration.hpp:29
auto lanelet2_map_path() const
Definition: configuration.hpp:133
bool standalone_mode
Definition: configuration.hpp:38
bool verbose
Definition: configuration.hpp:36
static auto autoware() noexcept -> const std::string &
Definition: api.hpp:52
static auto defaultBehavior() noexcept -> const std::string &
Definition: pedestrian_entity.hpp:56
static auto defaultBehavior() -> const std::string &
Definition: vehicle_entity.hpp:59
Definition: lane_change.hpp:44
parameters for behavior plugin
Definition: lane_change.hpp:75
class definition for the traffic controller