| 26 | }; |
| 27 | |
| 28 | class InputManager |
| 29 | { |
| 30 | public: |
| 31 | explicit InputManager(ros::NodeHandle nh); |
| 32 | bool Run(); |
| 33 | |
| 34 | private: |
| 35 | void OdomCb_(const nav_msgs::OdometryConstPtr &odom_msg); |
| 36 | int FindPC(const ros::Time stamp, CloudT::Ptr cloud); |
| 37 | void PCCb_(const sensor_msgs::PointCloud2ConstPtr &cloudMsg); |
| 38 | bool callSLOAM(SE3 relativeMotion, ros::Time stamp); |
| 39 | void PublishAccumOdom_(const SE3 &relativeMotion); |
| 40 | void Odom2SlamTf(); |
| 41 | void PublishOdomAsTf(const nav_msgs::Odometry &odom_msg, |
| 42 | const std::string &parent_frame_id, |
| 43 | const std::string &child_frame_id); |
| 44 | |
| 45 | std::queue<sensor_msgs::PointCloud2ConstPtr> pcQueue_; |
| 46 | std::deque<StampedSE3> odomQueue_; |
| 47 | ros::NodeHandle nh_; |
| 48 | ros::Publisher pubPose_; |
| 49 | ros::Subscriber OdomSub_; |
| 50 | ros::Subscriber PCSub_; |
| 51 | tf2_ros::Buffer tf_buffer_; |
| 52 | tf2_ros::TransformListener tf_listener_; |
| 53 | tf2_ros::TransformBroadcaster broadcaster_; |
| 54 | |
| 55 | // params |
| 56 | std::string map_frame_id_; |
| 57 | std::string odom_frame_id_; |
| 58 | std::string robot_frame_id_; |
| 59 | std::string cloud_topic_; |
| 60 | std::string odom_topic_; |
| 61 | float minOdomDistance_; |
| 62 | float minSLOAMAltitude_; |
| 63 | size_t maxQueueSize_; |
| 64 | |
| 65 | // vars |
| 66 | boost::shared_ptr<sloam::SLOAMNode> sloam_ = nullptr; |
| 67 | std::vector<SE3> keyPoses_; |
| 68 | StampedSE3 latestOdom; |
| 69 | bool firstOdom_; |
| 70 | bool publishTf_; |
| 71 | size_t odomCounter_; |
| 72 | size_t odomFreqFilter_; |
| 73 | }; |
| 74 | |
| 75 | InputManager::InputManager(ros::NodeHandle nh) : nh_(nh), tf_listener_{tf_buffer_} |
| 76 | { |
nothing calls this directly
no outgoing calls
no test coverage detected