Helper class that will publish results onto the ROS framework. More...
#include <ROS2Visualizer.h>
Public Member Functions | |
void | callback_inertial (const sensor_msgs::msg::Imu::SharedPtr msg) |
Callback for inertial information. More... | |
void | callback_monocular (const sensor_msgs::msg::Image::SharedPtr msg0, int cam_id0) |
Callback for monocular cameras information. More... | |
void | callback_stereo (const sensor_msgs::msg::Image::ConstSharedPtr msg0, const sensor_msgs::msg::Image::ConstSharedPtr msg1, int cam_id0, int cam_id1) |
Callback for synchronized stereo camera information. More... | |
ROS2Visualizer (std::shared_ptr< rclcpp::Node > node, std::shared_ptr< VioManager > app, std::shared_ptr< Simulator > sim=nullptr) | |
Default constructor. More... | |
void | setup_subscribers (std::shared_ptr< ov_core::YamlParser > parser) |
Will setup ROS subscribers and callbacks. More... | |
void | visualize () |
Will visualize the system if we have new things. More... | |
void | visualize_final () |
After the run has ended, print results. More... | |
void | visualize_odometry (double timestamp) |
Will publish our odometry message for the current timestep. This will take the current state estimate and get the propagated pose to the desired time. This can be used to get pose estimates on systems which require high frequency pose estimates. More... | |
Protected Types | |
typedef message_filters::sync_policies::ApproximateTime< sensor_msgs::msg::Image, sensor_msgs::msg::Image > | sync_pol |
Protected Member Functions | |
void | publish_features () |
Publish current features. More... | |
void | publish_groundtruth () |
Publish groundtruth (if we have it) More... | |
void | publish_images () |
Publish the active tracking image. More... | |
void | publish_loopclosure_information () |
Publish loop-closure information of current pose and active track information. More... | |
void | publish_state () |
Publish the current state. More... | |
Protected Attributes | |
std::shared_ptr< VioManager > | _app |
Core application of the filter system. More... | |
std::shared_ptr< rclcpp::Node > | _node |
Global node handler. More... | |
std::shared_ptr< Simulator > | _sim |
Simulator (is nullptr if we are not sim'ing) More... | |
std::map< int, double > | camera_last_timestamp |
std::deque< ov_core::CameraData > | camera_queue |
std::mutex | camera_queue_mtx |
std::map< double, Eigen::Matrix< double, 17, 1 > > | gt_states |
image_transport::Publisher | it_pub_loop_img_depth |
image_transport::Publisher | it_pub_loop_img_depth_color |
image_transport::Publisher | it_pub_tracks |
double | last_visualization_timestamp = 0 |
double | last_visualization_timestamp_image = 0 |
std::shared_ptr< tf2_ros::TransformBroadcaster > | mTfBr |
std::ofstream | of_state_est |
std::ofstream | of_state_gt |
std::ofstream | of_state_std |
std::vector< geometry_msgs::msg::PoseStamped > | poses_gt |
std::vector< geometry_msgs::msg::PoseStamped > | poses_imu |
rclcpp::Publisher< nav_msgs::msg::Odometry >::SharedPtr | pub_loop_extrinsic |
rclcpp::Publisher< sensor_msgs::msg::CameraInfo >::SharedPtr | pub_loop_intrinsics |
rclcpp::Publisher< sensor_msgs::msg::PointCloud >::SharedPtr | pub_loop_point |
rclcpp::Publisher< nav_msgs::msg::Odometry >::SharedPtr | pub_loop_pose |
rclcpp::Publisher< nav_msgs::msg::Odometry >::SharedPtr | pub_odomimu |
rclcpp::Publisher< nav_msgs::msg::Path >::SharedPtr | pub_pathgt |
rclcpp::Publisher< nav_msgs::msg::Path >::SharedPtr | pub_pathimu |
rclcpp::Publisher< sensor_msgs::msg::PointCloud2 >::SharedPtr | pub_points_aruco |
rclcpp::Publisher< sensor_msgs::msg::PointCloud2 >::SharedPtr | pub_points_msckf |
rclcpp::Publisher< sensor_msgs::msg::PointCloud2 >::SharedPtr | pub_points_sim |
rclcpp::Publisher< sensor_msgs::msg::PointCloud2 >::SharedPtr | pub_points_slam |
rclcpp::Publisher< geometry_msgs::msg::PoseStamped >::SharedPtr | pub_posegt |
rclcpp::Publisher< geometry_msgs::msg::PoseWithCovarianceStamped >::SharedPtr | pub_poseimu |
bool | publish_calibration_tf = true |
bool | publish_global2imu_tf = true |
boost::posix_time::ptime | rT1 |
boost::posix_time::ptime | rT2 |
bool | save_total_state = false |
bool | start_time_set = false |
rclcpp::Subscription< sensor_msgs::msg::Imu >::SharedPtr | sub_imu |
std::vector< rclcpp::Subscription< sensor_msgs::msg::Image >::SharedPtr > | subs_cam |
double | summed_mse_ori = 0.0 |
double | summed_mse_pos = 0.0 |
double | summed_nees_ori = 0.0 |
double | summed_nees_pos = 0.0 |
size_t | summed_number = 0 |
std::vector< std::shared_ptr< message_filters::Synchronizer< sync_pol > > > | sync_cam |
std::vector< std::shared_ptr< message_filters::Subscriber< sensor_msgs::msg::Image > > > | sync_subs_cam |
std::atomic< bool > | thread_update_running |
Helper class that will publish results onto the ROS framework.
Also save to file the current total state and covariance along with the groundtruth if we are simulating. We visualize the following things:
Definition at line 78 of file ROS2Visualizer.h.
|
protected |
Definition at line 161 of file ROS2Visualizer.h.
ROS2Visualizer::ROS2Visualizer | ( | std::shared_ptr< rclcpp::Node > | node, |
std::shared_ptr< VioManager > | app, | ||
std::shared_ptr< Simulator > | sim = nullptr |
||
) |
Default constructor.
node | ROS node pointer |
app | Core estimator manager |
sim | Simulator if we are simulating |
Definition at line 38 of file ROS2Visualizer.cpp.
void ROS2Visualizer::callback_inertial | ( | const sensor_msgs::msg::Imu::SharedPtr | msg | ) |
Callback for inertial information.
Definition at line 438 of file ROS2Visualizer.cpp.
void ROS2Visualizer::callback_monocular | ( | const sensor_msgs::msg::Image::SharedPtr | msg0, |
int | cam_id0 | ||
) |
Callback for monocular cameras information.
Definition at line 498 of file ROS2Visualizer.cpp.
void ROS2Visualizer::callback_stereo | ( | const sensor_msgs::msg::Image::ConstSharedPtr | msg0, |
const sensor_msgs::msg::Image::ConstSharedPtr | msg1, | ||
int | cam_id0, | ||
int | cam_id1 | ||
) |
Callback for synchronized stereo camera information.
Definition at line 537 of file ROS2Visualizer.cpp.
|
protected |
Publish current features.
Definition at line 674 of file ROS2Visualizer.cpp.
|
protected |
Publish groundtruth (if we have it)
Definition at line 706 of file ROS2Visualizer.cpp.
|
protected |
Publish the active tracking image.
Definition at line 646 of file ROS2Visualizer.cpp.
|
protected |
Publish loop-closure information of current pose and active track information.
Definition at line 833 of file ROS2Visualizer.cpp.
|
protected |
Publish the current state.
Definition at line 591 of file ROS2Visualizer.cpp.
void ROS2Visualizer::setup_subscribers | ( | std::shared_ptr< ov_core::YamlParser > | parser | ) |
Will setup ROS subscribers and callbacks.
parser | Configuration file parser |
Definition at line 163 of file ROS2Visualizer.cpp.
void ROS2Visualizer::visualize | ( | ) |
Will visualize the system if we have new things.
Definition at line 221 of file ROS2Visualizer.cpp.
void ROS2Visualizer::visualize_final | ( | ) |
After the run has ended, print results.
Definition at line 352 of file ROS2Visualizer.cpp.
void ROS2Visualizer::visualize_odometry | ( | double | timestamp | ) |
Will publish our odometry message for the current timestep. This will take the current state estimate and get the propagated pose to the desired time. This can be used to get pose estimates on systems which require high frequency pose estimates.
Definition at line 269 of file ROS2Visualizer.cpp.
|
protected |
Core application of the filter system.
Definition at line 142 of file ROS2Visualizer.h.
|
protected |
Global node handler.
Definition at line 139 of file ROS2Visualizer.h.
|
protected |
Simulator (is nullptr if we are not sim'ing)
Definition at line 145 of file ROS2Visualizer.h.
|
protected |
Definition at line 192 of file ROS2Visualizer.h.
|
protected |
Queue up camera measurements sorted by time and trigger once we have exactly one IMU measurement with timestamp newer than the camera measurement This also handles out-of-order camera measurements, which is rare, but a nice feature to have for general robustness to bad camera drivers.
Definition at line 188 of file ROS2Visualizer.h.
|
protected |
Definition at line 189 of file ROS2Visualizer.h.
|
protected |
Definition at line 199 of file ROS2Visualizer.h.
|
protected |
Definition at line 148 of file ROS2Visualizer.h.
|
protected |
Definition at line 148 of file ROS2Visualizer.h.
|
protected |
Definition at line 148 of file ROS2Visualizer.h.
|
protected |
Definition at line 195 of file ROS2Visualizer.h.
|
protected |
Definition at line 196 of file ROS2Visualizer.h.
|
protected |
Definition at line 156 of file ROS2Visualizer.h.
|
protected |
Definition at line 208 of file ROS2Visualizer.h.
|
protected |
Definition at line 208 of file ROS2Visualizer.h.
|
protected |
Definition at line 208 of file ROS2Visualizer.h.
|
protected |
Definition at line 202 of file ROS2Visualizer.h.
|
protected |
Definition at line 166 of file ROS2Visualizer.h.
|
protected |
Definition at line 153 of file ROS2Visualizer.h.
|
protected |
Definition at line 155 of file ROS2Visualizer.h.
|
protected |
Definition at line 154 of file ROS2Visualizer.h.
|
protected |
Definition at line 153 of file ROS2Visualizer.h.
|
protected |
Definition at line 150 of file ROS2Visualizer.h.
|
protected |
Definition at line 169 of file ROS2Visualizer.h.
|
protected |
Definition at line 151 of file ROS2Visualizer.h.
|
protected |
Definition at line 152 of file ROS2Visualizer.h.
|
protected |
Definition at line 152 of file ROS2Visualizer.h.
|
protected |
Definition at line 152 of file ROS2Visualizer.h.
|
protected |
Definition at line 152 of file ROS2Visualizer.h.
|
protected |
Definition at line 170 of file ROS2Visualizer.h.
|
protected |
Definition at line 149 of file ROS2Visualizer.h.
|
protected |
Definition at line 204 of file ROS2Visualizer.h.
|
protected |
Definition at line 203 of file ROS2Visualizer.h.
|
protected |
Definition at line 179 of file ROS2Visualizer.h.
|
protected |
Definition at line 179 of file ROS2Visualizer.h.
|
protected |
Definition at line 207 of file ROS2Visualizer.h.
|
protected |
Definition at line 178 of file ROS2Visualizer.h.
|
protected |
Definition at line 159 of file ROS2Visualizer.h.
|
protected |
Definition at line 160 of file ROS2Visualizer.h.
|
protected |
Definition at line 171 of file ROS2Visualizer.h.
|
protected |
Definition at line 172 of file ROS2Visualizer.h.
|
protected |
Definition at line 173 of file ROS2Visualizer.h.
|
protected |
Definition at line 174 of file ROS2Visualizer.h.
|
protected |
Definition at line 175 of file ROS2Visualizer.h.
|
protected |
Definition at line 162 of file ROS2Visualizer.h.
|
protected |
Definition at line 163 of file ROS2Visualizer.h.
|
protected |
Definition at line 182 of file ROS2Visualizer.h.