20 #ifndef LOCALIZATION_RVIZ_PLUGINS_LOCALIZATION_GRAPH_DISPLAY_H_ // NOLINT
21 #define LOCALIZATION_RVIZ_PLUGINS_LOCALIZATION_GRAPH_DISPLAY_H_ // NOLINT
26 #include <ff_msgs/LocalizationGraph.h>
28 #include <graph_localizer/loc_projection_factor.h>
29 #include <gtsam/geometry/Pose3.h>
30 #include <gtsam/navigation/CombinedImuFactor.h>
31 #include <image_transport/image_transport.h>
32 #include <ros/publisher.h>
33 #include <ros/subscriber.h>
34 #include <rviz/message_filter_display.h>
35 #include <rviz/ogre_helpers/arrow.h>
36 #include <rviz/ogre_helpers/axes.h>
37 #include <rviz/ogre_helpers/line.h>
38 #include <rviz/ogre_helpers/shape.h>
39 #include <rviz/properties/float_property.h>
40 #include <opencv2/core/types.hpp>
55 using Camera = gtsam::PinholePose<Calibration>;
70 void addSmartFactorsProjectionVisual();
73 void processMessage(
const ff_msgs::LocalizationGraph::ConstPtr& graph_msg);
74 void imageCallback(
const sensor_msgs::ImageConstPtr& image_msg);
77 const gtsam::CombinedImuFactor*
const imu_factor);
78 void addProjectionVisual(
const gtsam::CameraSet<Camera>& cameras,
const Camera::MeasurementVector& measurements,
79 const gtsam::Point3& world_t_landmark, std::vector<cv::Mat>& images);
81 const graph_localizer::CombinedNavStateGraphValues& graph_values);
82 void addOpticalFlowVisual(
const graph_localizer::FeatureTrackIdMap& feature_tracks,
86 void addSmartFactorProjectionVisual(
const SmartFactor& smart_factor,
87 const graph_localizer::CombinedNavStateGraphValues& graph_values);
88 cv::Scalar textColor(
const double val,
const double green_threshold,
const double yellow_threshold);
90 std::vector<std::unique_ptr<rviz::Axes>> graph_pose_axes_;
91 std::vector<std::unique_ptr<rviz::Arrow>> imu_factor_arrows_;
92 std::unique_ptr<rviz::BoolProperty> show_pose_axes_;
93 std::unique_ptr<rviz::FloatProperty> pose_axes_size_;
94 std::unique_ptr<rviz::BoolProperty> show_imu_factor_arrows_;
95 std::unique_ptr<rviz::FloatProperty> imu_factor_arrows_diameter_;
96 std::unique_ptr<rviz::BoolProperty> publish_optical_flow_images_;
97 std::unique_ptr<rviz::BoolProperty> publish_smart_factor_images_;
98 std::unique_ptr<rviz::BoolProperty> publish_loc_projection_factor_images_;
99 std::unique_ptr<rviz::BoolProperty> publish_projection_factor_images_;
100 std::unique_ptr<rviz::BoolProperty> show_projection_factor_visual_;
101 std::unique_ptr<rviz::SliderProperty> projection_factor_slider_;
102 image_transport::Publisher optical_flow_image_pub_;
103 image_transport::Publisher smart_factor_projection_image_pub_;
104 image_transport::Publisher projection_image_pub_;
105 image_transport::Publisher loc_projection_factor_image_pub_;
106 image_transport::Subscriber image_sub_;
108 std::map<localization_common::Time, sensor_msgs::ImageConstPtr> img_buffer_;
109 std::unique_ptr<camera::CameraParameters> nav_cam_params_;
110 std::vector<std::unique_ptr<rviz::Shape>> landmark_points_;
111 std::vector<std::unique_ptr<rviz::Axes>> camera_pose_axes_;
112 std::vector<std::unique_ptr<rviz::Line>> camera_t_landmark_lines_;
113 std::unique_ptr<graph_localizer::GraphLocalizer> latest_graph_localizer_;
114 std::vector<SmartFactor*> latest_smart_factors_;
117 #endif // LOCALIZATION_RVIZ_PLUGINS_LOCALIZATION_GRAPH_DISPLAY_H_ NOLINT