提交 2873e308 编写于 作者: F FangzhenLi-hust 提交者: weidezhang

perception/lidar/common bug fix (#1590)

* perception/lidar/common bug fix

* fix coding style
上级 996cbe4d
......@@ -87,6 +87,12 @@ class ConvexHull2DXY : public pcl::ConvexHull<PointInT> {
// Array of coordinates for each point
coordT *points = reinterpret_cast<coordT *>(
calloc(indices_->size() * dimension, sizeof(coordT)));
if (points == NULL) {
hull->points.resize(0);
hull->width = hull->height = 0;
polygons->resize(0);
return;
}
// Build input data, using appropriate projection
int j = 0;
......@@ -121,7 +127,6 @@ class ConvexHull2DXY : public pcl::ConvexHull<PointInT> {
qh_freeqhull(!qh_ALL);
int curlong, totlong;
qh_memfreeshort(&curlong, &totlong);
return;
}
......
......@@ -35,11 +35,11 @@ class DisjointSetTest : public testing::Test {
_node1 = nullptr;
}
if (_node2 != nullptr) {
delete _node1;
delete _node2;
_node2 = nullptr;
}
if (_node3 != nullptr) {
delete _node1;
delete _node3;
_node3 = nullptr;
}
}
......
......@@ -15,17 +15,16 @@
*****************************************************************************/
#include "modules/perception/obstacle/common/pose_util.h"
#include "modules/common/log.h"
namespace apollo {
namespace perception {
bool ReadPoseFile(const std::string& filename,
Eigen::Matrix4d* pose,
int* frame_id,
double* time_stamp) {
bool ReadPoseFile(const std::string &filename, Eigen::Matrix4d *pose,
int *frame_id, double *time_stamp) {
std::ifstream ifs(filename.c_str());
if (!ifs.is_open()) {
std::cerr << "Failed to open file " << filename << std::endl;
AERROR << "Failed to open file " << filename;
return false;
}
char buffer[1024];
......@@ -34,12 +33,16 @@ bool ReadPoseFile(const std::string& filename,
double time_samp = 0;
double quat[4];
double matrix3x3[9];
double& pose03 = (*pose)(0, 3);
double& pose13 = (*pose)(1, 3);
double& pose23 = (*pose)(2, 3);
sscanf(buffer, "%d %lf %lf %lf %lf %lf %lf %lf %lf", &id, &(time_samp),
&pose03, &pose13, &pose23,
&(quat[0]), &(quat[1]), &(quat[2]), &(quat[3]));
double &pose03 = (*pose)(0, 3);
double &pose13 = (*pose)(1, 3);
double &pose23 = (*pose)(2, 3);
int ret = sscanf(buffer, "%d %lf %lf %lf %lf %lf %lf %lf %lf", &id,
&(time_samp), &pose03, &pose13, &pose23, &(quat[0]),
&(quat[1]), &(quat[2]), &(quat[3]));
if (ret != 9) {
AERROR << "Failed to scan parameters.";
return false;
}
QuaternionToRotationMatrix<double>(quat, matrix3x3);
for (int i = 0; i < 3; ++i) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册