scenario_simulator_v2 C++ API
misc_object_entity.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__MISC_OBJECT_ENTITY_HPP_
16 #define TRAFFIC_SIMULATOR__ENTITY__MISC_OBJECT_ENTITY_HPP_
17 
18 #include <optional>
20 #include <traffic_simulator_msgs/msg/misc_object_parameters.hpp>
21 
22 namespace traffic_simulator
23 {
24 namespace entity
25 {
27 {
28 public:
29  explicit MiscObjectEntity(
31  const std::shared_ptr<hdmap_utils::HdMapUtils> &,
32  const traffic_simulator_msgs::msg::MiscObjectParameters &);
33 
34  void onUpdate(double, double) override;
35 
36  auto getCurrentAction() const -> std::string override;
37 
38  auto getDefaultDynamicConstraints() const
39  -> const traffic_simulator_msgs::msg::DynamicConstraints & override;
40 
41  auto getEntityTypename() const -> const std::string & override
42  {
43  static const std::string result = "MiscObjectEntity";
44  return result;
45  }
46 
47  ~MiscObjectEntity() override = default;
48 
49  auto getGoalPoses() -> std::vector<CanonicalizedLaneletPose> override { return {}; }
50 
51  std::optional<traffic_simulator_msgs::msg::Obstacle> getObstacle() override
52  {
53  return std::nullopt;
54  }
55 
56  auto getRouteLanelets(double) -> lanelet::Ids override
57  {
58  THROW_SEMANTIC_ERROR("getRouteLanelets function cannot not use in MiscObjectEntity");
59  }
60 
61  auto getWaypoints() -> const traffic_simulator_msgs::msg::WaypointsArray override
62  {
63  return traffic_simulator_msgs::msg::WaypointsArray();
64  }
65 
66  void requestSpeedChange(double, bool) override;
67 
68  void requestSpeedChange(const speed_change::RelativeTargetSpeed &, bool) override;
69 
70  void requestAssignRoute(const std::vector<CanonicalizedLaneletPose> &) override
71  {
72  THROW_SEMANTIC_ERROR("requestAssignRoute function cannot not use in MiscObjectEntity");
73  }
74 
75  void requestAssignRoute(const std::vector<geometry_msgs::msg::Pose> &) override
76  {
77  THROW_SEMANTIC_ERROR("requestAssignRoute function cannot not use in MiscObjectEntity");
78  }
79 
81  {
82  THROW_SEMANTIC_ERROR("requestAcquirePosition function cannot not use in MiscObjectEntity");
83  }
84 
85  void requestAcquirePosition(const geometry_msgs::msg::Pose &) override
86  {
87  THROW_SEMANTIC_ERROR("requestAcquirePosition function cannot not use in MiscObjectEntity");
88  }
89 
90  void requestSpeedChange(
91  const double, const speed_change::Transition, const speed_change::Constraint,
92  const bool) override;
93 
94  auto getBehaviorParameter() const -> traffic_simulator_msgs::msg::BehaviorParameter override;
95 
96  void setBehaviorParameter(const traffic_simulator_msgs::msg::BehaviorParameter &) override;
97 
98  void setVelocityLimit(double) override
99  {
101  }
102 
103  void setAccelerationLimit(double) override
104  {
106  }
107 
108  void setAccelerationRateLimit(double) override
109  {
111  }
112 
113  void setDecelerationLimit(double) override
114  {
116  }
117 
118  void setDecelerationRateLimit(double) override
119  {
121  }
122 
123  auto getMaxAcceleration() const -> double override
124  {
125  THROW_SEMANTIC_ERROR("getMaxAcceleration function cannot not use in MiscObjectEntity");
126  }
127 
128  auto getMaxDeceleration() const -> double override
129  {
130  THROW_SEMANTIC_ERROR("getMaxDeceleration function cannot not use in MiscObjectEntity");
131  }
132 };
133 } // namespace entity
134 } // namespace traffic_simulator
135 
136 #endif // TRAFFIC_SIMULATOR__ENTITY__MISC_OBJECT_ENTITY_HPP_
Definition: entity_base.hpp:51
const std::string name
Definition: entity_base.hpp:255
Definition: misc_object_entity.hpp:27
void setAccelerationRateLimit(double) override
Definition: misc_object_entity.hpp:108
void requestAcquirePosition(const geometry_msgs::msg::Pose &) override
Definition: misc_object_entity.hpp:85
void setBehaviorParameter(const traffic_simulator_msgs::msg::BehaviorParameter &) override
Definition: misc_object_entity.cpp:49
void requestAcquirePosition(const CanonicalizedLaneletPose &) override
Definition: misc_object_entity.hpp:80
void requestSpeedChange(double, bool) override
Definition: misc_object_entity.cpp:70
void onUpdate(double, double) override
Definition: misc_object_entity.cpp:29
auto getMaxAcceleration() const -> double override
Definition: misc_object_entity.hpp:123
void setAccelerationLimit(double) override
Definition: misc_object_entity.hpp:103
void setVelocityLimit(double) override
Definition: misc_object_entity.hpp:98
std::optional< traffic_simulator_msgs::msg::Obstacle > getObstacle() override
Definition: misc_object_entity.hpp:51
void setDecelerationLimit(double) override
Definition: misc_object_entity.hpp:113
MiscObjectEntity(const std::string &name, const CanonicalizedEntityStatus &, const std::shared_ptr< hdmap_utils::HdMapUtils > &, const traffic_simulator_msgs::msg::MiscObjectParameters &)
Definition: misc_object_entity.cpp:21
auto getCurrentAction() const -> std::string override
Definition: misc_object_entity.cpp:38
void requestAssignRoute(const std::vector< CanonicalizedLaneletPose > &) override
Definition: misc_object_entity.hpp:70
auto getEntityTypename() const -> const std::string &override
Definition: misc_object_entity.hpp:41
void requestAssignRoute(const std::vector< geometry_msgs::msg::Pose > &) override
Definition: misc_object_entity.hpp:75
auto getBehaviorParameter() const -> traffic_simulator_msgs::msg::BehaviorParameter override
Definition: misc_object_entity.cpp:43
auto getMaxDeceleration() const -> double override
Definition: misc_object_entity.hpp:128
auto getRouteLanelets(double) -> lanelet::Ids override
Definition: misc_object_entity.hpp:56
void setDecelerationRateLimit(double) override
Definition: misc_object_entity.hpp:118
auto getWaypoints() -> const traffic_simulator_msgs::msg::WaypointsArray override
Definition: misc_object_entity.hpp:61
auto getDefaultDynamicConstraints() const -> const traffic_simulator_msgs::msg::DynamicConstraints &override
Definition: misc_object_entity.cpp:54
auto getGoalPoses() -> std::vector< CanonicalizedLaneletPose > override
Definition: misc_object_entity.hpp:49
Definition: entity_status.hpp:32
Definition: lanelet_pose.hpp:27
#define THROW_SEMANTIC_ERROR(...)
Definition: exception.hpp:59
Definition: cache.hpp:27
Transition
Definition: speed_change.hpp:26
Definition: api.hpp:49
std::string string
Definition: junit5.hpp:26
Definition: speed_change.hpp:35