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>
36 #include <traffic_simulator_msgs/msg/entity_status.hpp>
37 #include <traffic_simulator_msgs/msg/waypoints_array.hpp>
38 #include <vector>
39 
40 namespace entity_behavior
41 {
42 namespace pedestrian
43 {
45 {
46 public:
47  WalkStraightAction(const std::string & name, const BT::NodeConfiguration & config);
48  bool checkPreconditions() override;
49  BT::NodeStatus doAction() override;
50  void getBlackBoardValues() override;
51  static BT::PortsList providedPorts()
52  {
54  }
55 
56 private:
57  bool isObstacleInFront(
58  const bool see_around, const std::vector<geometry_msgs::msg::Point> waypoints) const;
59  bool isEntityColliding(
61  const double & detection_horizon) const;
62  auto calculateWaypoints() const -> traffic_simulator_msgs::msg::WaypointsArray;
63 
64  static constexpr double front_entity_margin = 2.0;
65  bool use_trajectory_based_front_entity_detection_;
66  double trajectory_based_detection_offset_;
67 };
68 } // namespace pedestrian
69 } // namespace entity_behavior
70 
71 #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:45
void getBlackBoardValues() override
Definition: walk_straight_action.cpp:57
static BT::PortsList providedPorts()
Definition: walk_straight_action.hpp:51
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:43
Definition: operators.hpp:25
std::string string
Definition: junit5.hpp:26