| 45 | namespace roborts_localization { |
| 46 | |
| 47 | class LocalizationNode { |
| 48 | public: |
| 49 | |
| 50 | /** |
| 51 | * @brief Localization Node construct function |
| 52 | * @param name Node name |
| 53 | */ |
| 54 | LocalizationNode(std::string name); |
| 55 | |
| 56 | /** |
| 57 | * @brief Localization initialization |
| 58 | * @return Returns true if initialize success |
| 59 | */ |
| 60 | bool Init(); |
| 61 | |
| 62 | /** |
| 63 | * @brief Laser scan messages callback function (as main loop in localization node) |
| 64 | * @param laser_scan_msg Laser scan data |
| 65 | */ |
| 66 | void LaserScanCallback(const sensor_msgs::LaserScan::ConstPtr &laser_scan_msg); |
| 67 | |
| 68 | /** |
| 69 | * @brief Manually initialize localization init_pose |
| 70 | * @param init_pose_msg Init pose (2D Pose Estimate button in RViz) |
| 71 | */ |
| 72 | void InitialPoseCallback(const geometry_msgs::PoseWithCovarianceStamped::ConstPtr &init_pose_msg); |
| 73 | |
| 74 | /** |
| 75 | * @brief Publish visualize messages |
| 76 | */ |
| 77 | void PublishVisualize(); |
| 78 | |
| 79 | /** |
| 80 | * @brief Publish transform information between odom_frame and global_frame |
| 81 | * @return True if no errors |
| 82 | */ |
| 83 | bool PublishTf(); |
| 84 | |
| 85 | private: |
| 86 | |
| 87 | bool GetPoseFromTf(const std::string &target_frame, |
| 88 | const std::string &source_frame, |
| 89 | const ros::Time ×tamp, |
| 90 | Vec3d &pose); |
| 91 | |
| 92 | bool GetStaticMap(); |
| 93 | |
| 94 | bool GetLaserPose(); |
| 95 | |
| 96 | void TransformLaserscanToBaseFrame(double &angle_min, |
| 97 | double &angle_increment, |
| 98 | const sensor_msgs::LaserScan &laser_scan_msg); |
| 99 | private: |
| 100 | //Mutex |
| 101 | std::mutex mutex_; |
| 102 | |
| 103 | //Algorithm object |
| 104 | std::unique_ptr<Amcl> amcl_ptr_; |
nothing calls this directly
no outgoing calls
no test coverage detected