21 #ifndef STATE_ESTIMATION_NODES__STATE_ESTIMATION_NODE_HPP_
22 #define STATE_ESTIMATION_NODES__STATE_ESTIMATION_NODE_HPP_
25 #include <autoware_auto_geometry_msgs/msg/relative_position_with_covariance_stamped.hpp>
27 #include <geometry_msgs/msg/pose_with_covariance_stamped.hpp>
28 #include <geometry_msgs/msg/quaternion_stamped.hpp>
29 #include <geometry_msgs/msg/twist_with_covariance_stamped.hpp>
31 #include <nav_msgs/msg/odometry.hpp>
32 #include <rclcpp/publisher.hpp>
33 #include <rclcpp/rclcpp.hpp>
34 #include <rclcpp/subscription.hpp>
38 #include <tf2/buffer_core.h>
39 #include <tf2_ros/transform_broadcaster.h>
40 #include <tf2_ros/transform_listener.h>
42 #include <Eigen/Geometry>
53 namespace state_estimation
68 const rclcpp::NodeOptions & node_options);
71 tf2::BufferCore &
buffer() {
return m_tf_buffer;}
75 using PoseMsgT = geometry_msgs::msg::PoseWithCovarianceStamped;
76 using TwistMsgT = geometry_msgs::msg::TwistWithCovarianceStamped;
77 using RelativePosMsgT = autoware_auto_geometry_msgs::msg::RelativePositionWithCovarianceStamped;
81 template<std::
int32_t kDim>
82 using VectorT = Eigen::Matrix<autoware::common::types::float32_t, kDim, 1>;
88 void STATE_ESTIMATION_NODES_LOCAL pose_callback(
const PoseMsgT::SharedPtr msg);
94 void STATE_ESTIMATION_NODES_LOCAL relative_pos_callback(
const RelativePosMsgT::SharedPtr msg);
97 void STATE_ESTIMATION_NODES_LOCAL predict_and_publish_current_state();
100 void STATE_ESTIMATION_NODES_LOCAL publish_current_state();
102 template<
typename MessageT>
105 template<
typename MessageT>
106 void create_subscriptions(
107 const std::vector<std::string> & input_topics,
108 std::vector<
typename rclcpp::Subscription<MessageT>::SharedPtr> * subscribers,
109 CallbackFnT<MessageT> callback);
111 std::vector<rclcpp::Subscription<PoseMsgT>::SharedPtr> m_pose_subscribers;
112 std::vector<rclcpp::Subscription<RelativePosMsgT>::SharedPtr> m_relative_pos_subscribers;
114 std::shared_ptr<rclcpp::Publisher<OdomMsgT>> m_publisher{};
115 std::shared_ptr<rclcpp::Publisher<TfMsgT>> m_tf_publisher{};
117 std::chrono::system_clock::time_point m_time_of_last_publish{};
119 rclcpp::TimerBase::SharedPtr m_wall_timer{};
124 std::string m_frame_id{};
125 std::string m_child_frame_id{};
129 std::unique_ptr<FilterWrapperT> m_ekf{};
131 tf2::BufferCore m_tf_buffer;
132 tf2_ros::TransformListener m_tf_listener;
134 double noise_add_to_variance;
141 #endif // STATE_ESTIMATION_NODES__STATE_ESTIMATION_NODE_HPP_