MCPcopy Create free account
hub / github.com/KumarRobotics/sloam / SegCb_

Method SegCb_

sloam/src/segmentation/inferenceNode.cpp:104–146  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

102}
103
104void SegNode::SegCb_(const sensor_msgs::PointCloud2ConstPtr &cloudMsg)
105{
106
107 if ((prevStamp - cloudMsg->header.stamp).toSec() < 1.0)
108 return;
109
110 CloudT::Ptr cloud(new CloudT);
111 pcl::fromROSMsg(*cloudMsg, *cloud);
112 pcl_conversions::toPCL(ros::Time::now(), cloud->header.stamp);
113
114 // RUN SEGMENTATION
115 cv::Mat rMask = cv::Mat::zeros(cloudMsg->height, cloudMsg->width, CV_8U);
116 segmentator_->run(cloud, rMask);
117 // cv::imwrite("mask.jpg", rMask);
118
119 CloudT::Ptr groundCloud(new CloudT());
120 segmentator_->maskCloud(cloud, rMask, groundCloud, 1);
121
122 CloudT::Ptr treeCloud(new CloudT);
123 segmentator_->maskCloud(cloud, rMask, treeCloud, 255, true);
124
125 std::vector<std::vector<TreeVertex>> landmarks;
126 graphDetector_.computeGraph(cloud, treeCloud, landmarks);
127
128 // std::cout << "SAVING DATA" << std::endl;
129 // // write class instance to archive
130 // std::ofstream ofs("landmarks");
131 // boost::archive::text_oarchive oa(ofs);
132 // oa << landmarks;
133 // // write ground cloud to archive
134 // pcl::io::savePCDFileASCII("ground.pcd", *groundCloud);
135 // pcl::io::savePCDFileASCII("tree.pcd", *treeCloud);
136
137 auto trellis = trellisCloud(landmarks);
138
139 trellis->header = cloud->header;
140 treeCloud->header = cloud->header;
141 groundCloud->header = cloud->header;
142
143 trellisPub_.publish(trellis);
144 treePub_.publish(treeCloud);
145 groundPub_.publish(groundCloud);
146}
147
148int main(int argc, char **argv)
149{

Callers

nothing calls this directly

Calls 3

maskCloudMethod · 0.80
computeGraphMethod · 0.80
runMethod · 0.45

Tested by

no test coverage detected