| 34 | }; |
| 35 | |
| 36 | SegNode::SegNode(const ros::NodeHandle &nh) : nh_(nh) |
| 37 | { |
| 38 | |
| 39 | std::string cloud_topic; |
| 40 | nh_.param<std::string>("cloud_topic", cloud_topic, "/os_cloud_node/cloud_undistort"); |
| 41 | cloudSub_ = nh_.subscribe(cloud_topic, 10, &SegNode::SegCb_, this); |
| 42 | |
| 43 | treePub_ = nh_.advertise<CloudT>("segmentation/tree", 1); |
| 44 | groundPub_ = nh_.advertise<CloudT>("segmentation/ground", 1); |
| 45 | trellisPub_ = nh_.advertise<CloudT>("segmentation/trellis", 1); |
| 46 | |
| 47 | std::string modelFilepath; |
| 48 | nh_.getParam("seg_model_path", modelFilepath); |
| 49 | std::cout << "model: " << modelFilepath << std::endl; |
| 50 | float fov = nh_.param("seg_lidar_fov", 22.5); |
| 51 | int lidar_w = nh_.param("seg_lidar_w", 2048); |
| 52 | int lidar_h = nh_.param("seg_lidar_h", 64); |
| 53 | bool do_destagger = nh_.param("do_destagger", true); |
| 54 | |
| 55 | auto temp_seg = boost::make_shared<seg::Segmentation>(modelFilepath, fov, -fov, lidar_w, lidar_h, 1, do_destagger); |
| 56 | segmentator_ = std::move(temp_seg); |
| 57 | prevStamp = ros::Time::now(); |
| 58 | |
| 59 | float beam_cluster_threshold = nh_.param("beam_cluster_threshold", 0.1); |
| 60 | int min_vertex_size = nh_.param("min_vertex_size", 2); |
| 61 | float max_dist_to_centroid = nh_.param("max_dist_to_centroid", 0.2); |
| 62 | int min_landmark_size = nh_.param("min_landmark_size", 4); |
| 63 | float min_landmark_height = nh_.param("min_landmark_height", 1); |
| 64 | |
| 65 | Instance::Params params; |
| 66 | params.beam_cluster_threshold = beam_cluster_threshold; |
| 67 | params.min_vertex_size = min_vertex_size; |
| 68 | params.max_dist_to_centroid = max_dist_to_centroid; |
| 69 | params.min_landmark_size = min_landmark_size; |
| 70 | params.min_landmark_height = min_landmark_height; |
| 71 | |
| 72 | graphDetector_ = Instance(); |
| 73 | graphDetector_.set_params(params); |
| 74 | graphDetector_.reset_tree_id(); |
| 75 | } |
| 76 | |
| 77 | Cloud::Ptr SegNode::trellisCloud(const std::vector<std::vector<TreeVertex>> &landmarks) |
| 78 | { |
nothing calls this directly
no test coverage detected