14 #ifndef CONTROLLER_COMMON_NODES__CONTROLLER_BASE_NODE_HPP_ 15 #define CONTROLLER_COMMON_NODES__CONTROLLER_BASE_NODE_HPP_ 18 #include <autoware_auto_msgs/msg/control_diagnostic.hpp> 19 #include <autoware_auto_msgs/msg/trajectory.hpp> 20 #include <autoware_auto_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_ geometry_msgs::msg::TransformStamped TransformStamped
Definition: motion_testing_publisher.hpp:37
autoware_auto_msgs::msg::ControlDiagnostic Diagnostic
Definition: motion_common.hpp:35
Definition: controller_base_node.hpp:46
autoware_auto_msgs::msg::Trajectory Trajectory
Definition: motion_common.hpp:37
std::unique_ptr< controller_common::ControllerBase > ControllerPtr
Definition: controller_base_node.hpp:44
tf2_msgs::msg::TFMessage TFMessage
Definition: motion_testing_publisher.hpp:34
Definition: controller_base.hpp:30
autoware_auto_msgs::msg::VehicleKinematicState State
Definition: motion_common.hpp:36
autoware_auto_msgs::msg::VehicleControlCommand Command
Definition: motion_common.hpp:34