fix bug in scanid computing

main
feixyz10 2020-11-20 20:07:41 +08:00 committed by feixyz
parent c7cc12fab2
commit 7584eee1f9
3 changed files with 6 additions and 11 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
/.vscode
/.log
*.pcd
/build

View File

@ -1,3 +1,4 @@
#include <pcl/io/pcd_io.h>
#include <pcl_conversions/pcl_conversions.h>
#include <ros/ros.h>
#include <sensor_msgs/PointCloud2.h>
@ -44,6 +45,7 @@ void PointCloudHandler(const sensor_msgs::PointCloud2ConstPtr& msg,
OhMyLoam* const slam) {
PointCloud cloud;
pcl::fromROSMsg(*msg, cloud);
AINFO << "Timestamp = " << LOG_TIMESTAMP(msg->header.stamp.toSec());
slam->Run(cloud, 0.0);
double timestamp = msg->header.stamp.toSec();
AINFO << "Timestamp = " << LOG_TIMESTAMP(timestamp);
slam->Run(cloud, timestamp);
}

View File

@ -3,15 +3,7 @@
namespace oh_my_loam {
int ExtractorVLP16::GetScanID(const Point& pt) const {
double omega = std::atan2(pt.z, Distance(pt)) * 180 * M_1_PI + 15.0;
// static int i = 0;
// if (i++ < 10) {
// ADEBUG << "OMEGA: " << std::atan2(pt.z, Distance(pt)) * 180 * M_1_PI
// + 15.0
// << " id = " << static_cast<int>(std::round(omega / 2.0) + 0.01)
// << " z = " << pt.z << " "
// << " d = " << Distance(pt) << std::endl;
// }
double omega = std::atan2(pt.z, std::hypot(pt.x, pt.y)) * 180 * M_1_PI + 15.0;
return static_cast<int>(std::round(omega / 2.0) + 1.e-5);
};