scenario_simulator_v2 C++ API
walk_straight_action.hpp
Go to the documentation of this file.
1 
12 // Copyright 2015 TIER IV, Inc. All rights reserved.
13 //
14 // Licensed under the Apache License, Version 2.0 (the "License");
15 // you may not use this file except in compliance with the License.
16 // You may obtain a copy of the License at
17 //
18 // http://www.apache.org/licenses/LICENSE-2.0
19 //
20 // Unless required by applicable law or agreed to in writing, software
21 // distributed under the License is distributed on an "AS IS" BASIS,
22 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23 // See the License for the specific language governing permissions and
24 // limitations under the License.
25 
26 #ifndef BEHAVIOR_TREE_PLUGIN__PEDESTRIAN__WALK_STRAIGHT_ACTION_HPP_
27 #define BEHAVIOR_TREE_PLUGIN__PEDESTRIAN__WALK_STRAIGHT_ACTION_HPP_
28 
29 #include <behaviortree_cpp_v3/behavior_tree.h>
30 #include <behaviortree_cpp_v3/bt_factory.h>
31 
33 #include <memory>
34 #include <string>
35 #include <traffic_simulator_msgs/msg/entity_status.hpp>
36 #include <traffic_simulator_msgs/msg/waypoints_array.hpp>
37 #include <vector>
38 
39 namespace entity_behavior
40 {
41 namespace pedestrian
42 {
44 {
45 public:
46  WalkStraightAction(const std::string & name, const BT::NodeConfiguration & config);
47  bool checkPreconditions() override;
48  BT::NodeStatus doAction() override;
49  void getBlackBoardValues() override;
50  static BT::PortsList providedPorts()
51  {
53  }
54 
55 private:
56  bool isObstacleInFront(
57  const bool see_around, const std::vector<geometry_msgs::msg::Point> waypoints) const;
58  bool isEntityColliding(
60  const double & detection_horizon) const;
61  auto calculateWaypoints() const -> traffic_simulator_msgs::msg::WaypointsArray;
62 
63  static constexpr double front_entity_margin = 2.0;
64  bool use_trajectory_based_front_entity_detection_;
65  double trajectory_based_detection_offset_;
66 };
67 } // namespace pedestrian
68 } // namespace entity_behavior
69 
70 #endif // BEHAVIOR_TREE_PLUGIN__PEDESTRIAN__WALK_STRAIGHT_ACTION_HPP_
Definition: pedestrian_action_node.hpp:29
static BT::PortsList providedPorts()
Definition: pedestrian_action_node.hpp:33
Definition: walk_straight_action.hpp:44
void getBlackBoardValues() override
Definition: walk_straight_action.cpp:57
static BT::PortsList providedPorts()
Definition: walk_straight_action.hpp:50
bool checkPreconditions() override
Definition: walk_straight_action.cpp:211
BT::NodeStatus doAction() override
Definition: walk_straight_action.cpp:216
WalkStraightAction(const std::string &name, const BT::NodeConfiguration &config)
Definition: walk_straight_action.cpp:47
Definition: action_node.hpp:41
Definition: operators.hpp:25
std::string string
Definition: junit5.hpp:26