22 #ifndef OV_MSCKF_ROS2VISUALIZER_H 23 #define OV_MSCKF_ROS2VISUALIZER_H 25 #include <geometry_msgs/msg/pose_stamped.hpp> 26 #include <geometry_msgs/msg/pose_with_covariance_stamped.hpp> 27 #include <geometry_msgs/msg/transform_stamped.hpp> 32 #include <nav_msgs/msg/odometry.hpp> 33 #include <nav_msgs/msg/path.hpp> 34 #include <rclcpp/rclcpp.hpp> 35 #include <sensor_msgs/msg/camera_info.hpp> 36 #include <sensor_msgs/msg/image.hpp> 37 #include <sensor_msgs/msg/imu.hpp> 38 #include <sensor_msgs/msg/nav_sat_fix.hpp> 39 #include <sensor_msgs/msg/point_cloud.hpp> 40 #include <sensor_msgs/msg/point_cloud2.hpp> 41 #include <sensor_msgs/point_cloud2_iterator.hpp> 42 #include <std_msgs/msg/float64.hpp> 45 #include <tf2_geometry_msgs/tf2_geometry_msgs.h> 53 #include <Eigen/Eigen> 54 #include <boost/date_time/posix_time/posix_time.hpp> 55 #include <boost/filesystem.hpp> 87 ROS2Visualizer(std::shared_ptr<rclcpp::Node> node, std::shared_ptr<VioManager>
app, std::shared_ptr<Simulator>
sim =
nullptr);
93 void setup_subscribers(std::shared_ptr<ov_core::YamlParser>
parser);
105 void visualize_odometry(
double timestamp);
110 void visualize_final();
113 void callback_inertial(
const sensor_msgs::msg::Imu::SharedPtr msg);
116 void callback_monocular(
const sensor_msgs::msg::Image::SharedPtr msg0,
int cam_id0);
119 void callback_stereo(
const sensor_msgs::msg::Image::ConstSharedPtr msg0,
const sensor_msgs::msg::Image::ConstSharedPtr msg1,
int cam_id0,
124 void publish_state();
127 void publish_images();
130 void publish_features();
133 void publish_groundtruth();
136 void publish_loopclosure_information();
139 std::shared_ptr<rclcpp::Node>
_node;
142 std::shared_ptr<VioManager>
_app;
145 std::shared_ptr<Simulator>
_sim;
149 rclcpp::Publisher<geometry_msgs::msg::PoseWithCovarianceStamped>::SharedPtr
pub_poseimu;
150 rclcpp::Publisher<nav_msgs::msg::Odometry>::SharedPtr
pub_odomimu;
152 rclcpp::Publisher<sensor_msgs::msg::PointCloud2>::SharedPtr pub_points_msckf,
pub_points_slam, pub_points_aruco, pub_points_sim;
153 rclcpp::Publisher<nav_msgs::msg::Odometry>::SharedPtr
pub_loop_pose, pub_loop_extrinsic;
156 std::shared_ptr<tf2_ros::TransformBroadcaster>
mTfBr;
159 rclcpp::Subscription<sensor_msgs::msg::Imu>::SharedPtr
sub_imu;
160 std::vector<rclcpp::Subscription<sensor_msgs::msg::Image>::SharedPtr>
subs_cam;
162 std::vector<std::shared_ptr<message_filters::Synchronizer<sync_pol>>>
sync_cam;
163 std::vector<std::shared_ptr<message_filters::Subscriber<sensor_msgs::msg::Image>>>
sync_subs_cam;
169 rclcpp::Publisher<nav_msgs::msg::Path>::SharedPtr
pub_pathgt;
170 rclcpp::Publisher<geometry_msgs::msg::PoseStamped>::SharedPtr
pub_posegt;
171 double summed_mse_ori = 0.0;
172 double summed_mse_pos = 0.0;
173 double summed_nees_ori = 0.0;
174 double summed_nees_pos = 0.0;
175 size_t summed_number = 0;
178 bool start_time_set =
false;
179 boost::posix_time::ptime rT1,
rT2;
195 double last_visualization_timestamp = 0;
196 double last_visualization_timestamp_image = 0;
199 std::map<double, Eigen::Matrix<double, 17, 1>>
gt_states;
202 std::vector<geometry_msgs::msg::PoseStamped>
poses_gt;
203 bool publish_global2imu_tf =
true;
204 bool publish_calibration_tf =
true;
207 bool save_total_state =
false;
213 #endif // OV_MSCKF_ROS2VISUALIZER_H
rclcpp::Publisher< nav_msgs::msg::Odometry >::SharedPtr pub_odomimu
rclcpp::Publisher< sensor_msgs::msg::CameraInfo >::SharedPtr pub_loop_intrinsics
rclcpp::Publisher< nav_msgs::msg::Path >::SharedPtr pub_pathimu
Extended Kalman Filter estimator.
std::deque< ov_core::CameraData > camera_queue
std::shared_ptr< tf2_ros::TransformBroadcaster > mTfBr
rclcpp::Publisher< sensor_msgs::msg::PointCloud >::SharedPtr pub_loop_point
rclcpp::Publisher< sensor_msgs::msg::PointCloud2 >::SharedPtr pub_points_slam
message_filters::sync_policies::ApproximateTime< sensor_msgs::msg::Image, sensor_msgs::msg::Image > sync_pol
std::vector< std::shared_ptr< message_filters::Synchronizer< sync_pol > > > sync_cam
rclcpp::Publisher< geometry_msgs::msg::PoseStamped >::SharedPtr pub_posegt
std::vector< geometry_msgs::msg::PoseStamped > poses_imu
std::ofstream of_state_std
std::vector< geometry_msgs::msg::PoseStamped > poses_gt
std::shared_ptr< rclcpp::Node > _node
Global node handler.
std::shared_ptr< Simulator > sim
rclcpp::Publisher< nav_msgs::msg::Odometry >::SharedPtr pub_loop_pose
std::mutex camera_queue_mtx
image_transport::Publisher it_pub_tracks
std::shared_ptr< Simulator > _sim
Simulator (is nullptr if we are not sim'ing)
std::atomic< bool > thread_update_running
std::vector< std::shared_ptr< message_filters::Subscriber< sensor_msgs::msg::Image > > > sync_subs_cam
rclcpp::Subscription< sensor_msgs::msg::Imu >::SharedPtr sub_imu
Helper class that will publish results onto the ROS framework.
boost::posix_time::ptime rT2
rclcpp::Publisher< nav_msgs::msg::Path >::SharedPtr pub_pathgt
std::shared_ptr< VioManager > _app
Core application of the filter system.
std::vector< rclcpp::Subscription< sensor_msgs::msg::Image >::SharedPtr > subs_cam
std::map< int, double > camera_last_timestamp
rclcpp::Publisher< geometry_msgs::msg::PoseWithCovarianceStamped >::SharedPtr pub_poseimu
std::map< double, Eigen::Matrix< double, 17, 1 > > gt_states