scenario_simulator_v2 C++ API
vehicle_action_node.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 BEHAVIOR_TREE_PLUGIN__VEHICLE__VEHICLE_ACTION_NODE_HPP_
16 #define BEHAVIOR_TREE_PLUGIN__VEHICLE__VEHICLE_ACTION_NODE_HPP_
17 
18 #include <behaviortree_cpp_v3/action_node.h>
19 
23 #include <memory>
24 #include <optional>
25 #include <string>
27 #include <traffic_simulator_msgs/msg/behavior_parameter.hpp>
28 #include <traffic_simulator_msgs/msg/obstacle.hpp>
29 #include <traffic_simulator_msgs/msg/vehicle_parameters.hpp>
30 #include <traffic_simulator_msgs/msg/waypoints_array.hpp>
31 #include <vector>
32 
33 namespace entity_behavior
34 {
36 {
37 public:
38  VehicleActionNode(const std::string & name, const BT::NodeConfiguration & config);
39  ~VehicleActionNode() override = default;
40  void getBlackBoardValues() override;
41  static BT::PortsList providedPorts()
42  {
43  // clang-format off
44  return BT::PortsList({
45  BT::InputPort<std::shared_ptr<math::geometry::CatmullRomSpline>>("reference_trajectory"),
46  BT::InputPort<traffic_simulator_msgs::msg::BehaviorParameter>("behavior_parameter"),
47  BT::InputPort<traffic_simulator_msgs::msg::VehicleParameters>("vehicle_parameters")}) +
49  // clang-format on
50  }
54  virtual const traffic_simulator_msgs::msg::WaypointsArray calculateWaypoints() = 0;
55  virtual const std::optional<traffic_simulator_msgs::msg::Obstacle> calculateObstacle(
56  const traffic_simulator_msgs::msg::WaypointsArray & waypoints) = 0;
57 
58 protected:
59  traffic_simulator_msgs::msg::BehaviorParameter behavior_parameter;
60  traffic_simulator_msgs::msg::VehicleParameters vehicle_parameters;
61  std::shared_ptr<math::geometry::CatmullRomSpline> reference_trajectory;
62  std::unique_ptr<math::geometry::CatmullRomSubspline> trajectory;
63 };
64 } // namespace entity_behavior
65 
66 #endif // BEHAVIOR_TREE_PLUGIN__VEHICLE__VEHICLE_ACTION_NODE_HPP_
Definition: action_node.hpp:43
static BT::PortsList providedPorts()
Definition: action_node.hpp:77
std::optional< double > target_speed
Definition: action_node.hpp:123
Definition: vehicle_action_node.hpp:36
void getBlackBoardValues() override
Definition: vehicle_action_node.cpp:29
virtual const traffic_simulator_msgs::msg::WaypointsArray calculateWaypoints()=0
static BT::PortsList providedPorts()
Definition: vehicle_action_node.hpp:41
std::shared_ptr< math::geometry::CatmullRomSpline > reference_trajectory
Definition: vehicle_action_node.hpp:61
traffic_simulator_msgs::msg::VehicleParameters vehicle_parameters
Definition: vehicle_action_node.hpp:60
auto calculateUpdatedEntityStatus(double target_speed) const -> traffic_simulator::EntityStatus
Definition: vehicle_action_node.cpp:46
std::unique_ptr< math::geometry::CatmullRomSubspline > trajectory
Definition: vehicle_action_node.hpp:62
VehicleActionNode(const std::string &name, const BT::NodeConfiguration &config)
Definition: vehicle_action_node.cpp:24
auto calculateUpdatedEntityStatusInWorldFrame(double target_speed) const -> traffic_simulator::EntityStatus
Definition: vehicle_action_node.cpp:53
traffic_simulator_msgs::msg::BehaviorParameter behavior_parameter
Definition: vehicle_action_node.hpp:59
virtual const std::optional< traffic_simulator_msgs::msg::Obstacle > calculateObstacle(const traffic_simulator_msgs::msg::WaypointsArray &waypoints)=0
~VehicleActionNode() override=default
Definition: action_node.hpp:39
traffic_simulator_msgs::msg::EntityStatus EntityStatus
Definition: entity_status.hpp:25
std::string string
Definition: junit5.hpp:26