14 #ifndef CONTROLLER_COMMON_NODES__CONTROLLER_BASE_NODE_HPP_
15 #define CONTROLLER_COMMON_NODES__CONTROLLER_BASE_NODE_HPP_
18 #include <autoware_auto_system_msgs/msg/control_diagnostic.hpp>
19 #include <autoware_auto_planning_msgs/msg/trajectory.hpp>
20 #include <autoware_auto_vehicle_msgs/msg/vehicle_kinematic_state.hpp>
22 #include <tf2/buffer_core.h>
23 #include <tf2_msgs/msg/tf_message.hpp>
25 #include <rclcpp/rclcpp.hpp>
36 namespace controller_common_nodes
44 using ControllerPtr = std::unique_ptr<controller_common::ControllerBase>;
53 const std::string &
name,
54 const std::string & ns,
55 const std::string & command_topic,
56 const std::string & state_topic,
57 const std::string & tf_topic,
58 const std::string & trajectory_topic,
59 const std::string & diagnostic_topic,
60 const std::string & static_tf_topic =
"static_tf");
69 virtual void on_bad_trajectory(std::exception_ptr eptr);
72 virtual void on_bad_compute(std::exception_ptr eptr);
74 void publish(
const Command & msg);
78 CONTROLLER_COMMON_NODES_LOCAL
void init(
79 const std::string & command_topic,
80 const std::string & state_topic,
81 const std::string & tf_topic,
82 const std::string & static_tf_topic,
83 const std::string & trajectory_topic,
84 const std::string & diagnostic_topic);
89 CONTROLLER_COMMON_NODES_LOCAL
void on_tf(
const TFMessage::SharedPtr & msg);
90 CONTROLLER_COMMON_NODES_LOCAL
void on_static_tf(
const TFMessage::SharedPtr & msg);
91 CONTROLLER_COMMON_NODES_LOCAL
void on_trajectory(
const Trajectory::SharedPtr & msg);
92 CONTROLLER_COMMON_NODES_LOCAL
void on_state(
const State::SharedPtr & msg);
94 CONTROLLER_COMMON_NODES_LOCAL
bool try_compute(
const State & state);
96 CONTROLLER_COMMON_NODES_LOCAL
void retry_compute();
99 rclcpp::Subscription<State>::SharedPtr m_state_sub{};
100 rclcpp::Subscription<TFMessage>::SharedPtr m_tf_sub{};
101 rclcpp::Subscription<TFMessage>::SharedPtr m_static_tf_sub{};
102 rclcpp::Subscription<Trajectory>::SharedPtr m_trajectory_sub{};
103 rclcpp::Publisher<Command>::SharedPtr m_command_pub{};
104 rclcpp::Publisher<Diagnostic>::SharedPtr m_diagnostic_pub{};
105 tf2::BufferCore m_tf_buffer{tf2::BUFFER_CORE_DEFAULT_CACHE_TIME};
108 std::list<State> m_uncomputed_states{};
114 #endif // CONTROLLER_COMMON_NODES__CONTROLLER_BASE_NODE_HPP_