format all .h .cc files
parent
76dfa7f447
commit
12054bf10f
|
@ -21,9 +21,7 @@ class Pose3d {
|
||||||
Pose3d(const double *const r_quat, const double *const t_vec)
|
Pose3d(const double *const r_quat, const double *const t_vec)
|
||||||
: r_quat_(r_quat), t_vec_(t_vec) {}
|
: r_quat_(r_quat), t_vec_(t_vec) {}
|
||||||
|
|
||||||
static Pose3d Identity() { return {}; }
|
void SetIdentity() {
|
||||||
|
|
||||||
void setIdentity() {
|
|
||||||
r_quat_.setIdentity();
|
r_quat_.setIdentity();
|
||||||
t_vec_.setZero();
|
t_vec_.setZero();
|
||||||
}
|
}
|
||||||
|
@ -79,11 +77,15 @@ class Pose3d {
|
||||||
|
|
||||||
// const Eigen::Quaterniond& r_quat() const { return r_quat_; }
|
// const Eigen::Quaterniond& r_quat() const { return r_quat_; }
|
||||||
|
|
||||||
Eigen::Quaterniond r_quat() const { return r_quat_; }
|
Eigen::Quaterniond r_quat() const {
|
||||||
|
return r_quat_;
|
||||||
|
}
|
||||||
|
|
||||||
// const Eigen::Vector3d& t_vec() const { return t_vec_; }
|
// const Eigen::Vector3d& t_vec() const { return t_vec_; }
|
||||||
|
|
||||||
Eigen::Vector3d t_vec() const { return t_vec_; }
|
Eigen::Vector3d t_vec() const {
|
||||||
|
return t_vec_;
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Eigen::Quaterniond r_quat_; // orientation/rotation
|
Eigen::Quaterniond r_quat_; // orientation/rotation
|
||||||
|
|
|
@ -9,9 +9,13 @@ double NormalizeAngle(double ang) {
|
||||||
return ang - two_pi * std::floor((ang + M_PI) / two_pi);
|
return ang - two_pi * std::floor((ang + M_PI) / two_pi);
|
||||||
}
|
}
|
||||||
|
|
||||||
double Degree2Rad(double degree) { return degree * M_PI / 180.0; }
|
double Degree2Rad(double degree) {
|
||||||
|
return degree * M_PI / 180.0;
|
||||||
|
}
|
||||||
|
|
||||||
double Rad2Degree(double rad) { return rad * 180.0 / M_PI; }
|
double Rad2Degree(double rad) {
|
||||||
|
return rad * 180.0 / M_PI;
|
||||||
|
}
|
||||||
|
|
||||||
const std::vector<int> Range(int begin, int end, int step) {
|
const std::vector<int> Range(int begin, int end, int step) {
|
||||||
ACHECK(step != 0) << "Step must non-zero";
|
ACHECK(step != 0) << "Step must non-zero";
|
||||||
|
@ -23,6 +27,8 @@ const std::vector<int> Range(int begin, int end, int step) {
|
||||||
return seq;
|
return seq;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::vector<int> Range(int end) { return Range(0, end, 1); }
|
const std::vector<int> Range(int end) {
|
||||||
|
return Range(0, end, 1);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace common
|
} // namespace common
|
|
@ -9,9 +9,13 @@ namespace common {
|
||||||
|
|
||||||
class Timer {
|
class Timer {
|
||||||
public:
|
public:
|
||||||
Timer() { Tic(); }
|
Timer() {
|
||||||
|
Tic();
|
||||||
|
}
|
||||||
|
|
||||||
void Tic() { start_ = std::chrono::system_clock::now(); }
|
void Tic() {
|
||||||
|
start_ = std::chrono::system_clock::now();
|
||||||
|
}
|
||||||
|
|
||||||
// unit: 's' = second, 'm' = millisecond, 'u' = microsecond
|
// unit: 's' = second, 'm' = millisecond, 'u' = microsecond
|
||||||
double Toc(char unit = 'm');
|
double Toc(char unit = 'm');
|
||||||
|
|
|
@ -55,7 +55,9 @@ class LidarVisualizer {
|
||||||
is_updated_ = true;
|
is_updated_ = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string name() const { return name_; }
|
std::string name() const {
|
||||||
|
return name_;
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void Run() {
|
void Run() {
|
||||||
|
|
|
@ -12,7 +12,7 @@ extractor_config:
|
||||||
sharp_corner_point_num: 2
|
sharp_corner_point_num: 2
|
||||||
corner_point_num: 20
|
corner_point_num: 20
|
||||||
flat_surf_point_num: 4
|
flat_surf_point_num: 4
|
||||||
surf_point_num: 20
|
surf_point_num: 50
|
||||||
corner_point_curvature_th: 0.5
|
corner_point_curvature_th: 0.5
|
||||||
surf_point_curvature_th: 0.5
|
surf_point_curvature_th: 0.5
|
||||||
neighbor_point_dist_th: 0.1
|
neighbor_point_dist_th: 0.1
|
||||||
|
|
|
@ -18,7 +18,9 @@ class Extractor {
|
||||||
void Process(double timestamp, const common::PointCloudConstPtr &cloud,
|
void Process(double timestamp, const common::PointCloudConstPtr &cloud,
|
||||||
std::vector<Feature> *const features);
|
std::vector<Feature> *const features);
|
||||||
|
|
||||||
int num_scans() const { return num_scans_; }
|
int num_scans() const {
|
||||||
|
return num_scans_;
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual int GetScanID(const common::Point &pt) const = 0;
|
virtual int GetScanID(const common::Point &pt) const = 0;
|
||||||
|
|
|
@ -7,7 +7,9 @@ namespace oh_my_loam {
|
||||||
// for VLP-16
|
// for VLP-16
|
||||||
class ExtractorVLP16 : public Extractor {
|
class ExtractorVLP16 : public Extractor {
|
||||||
public:
|
public:
|
||||||
ExtractorVLP16() { num_scans_ = 16; }
|
ExtractorVLP16() {
|
||||||
|
num_scans_ = 16;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int GetScanID(const common::Point &pt) const override;
|
int GetScanID(const common::Point &pt) const override;
|
||||||
|
|
|
@ -22,14 +22,14 @@ bool Odometer::Init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Odometer::Process(double timestamp, const std::vector<Feature> &features,
|
void Odometer::Process(double timestamp, const std::vector<Feature> &features,
|
||||||
Pose3d *const pose) {
|
Pose3d *const pose_out) {
|
||||||
BLOCK_TIMER_START;
|
BLOCK_TIMER_START;
|
||||||
if (!is_initialized_) {
|
if (!is_initialized_) {
|
||||||
UpdatePre(features);
|
UpdatePre(features);
|
||||||
is_initialized_ = true;
|
is_initialized_ = true;
|
||||||
pose_curr2last_ = Pose3d::Identity();
|
pose_curr2last_.SetIdentity();
|
||||||
pose_curr2world_ = Pose3d::Identity();
|
pose_curr2world_.SetIdentity();
|
||||||
*pose = Pose3d::Identity();
|
pose_out->SetIdentity();
|
||||||
AWARN << "Odometer initialized....";
|
AWARN << "Odometer initialized....";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,7 @@ void Odometer::Process(double timestamp, const std::vector<Feature> &features,
|
||||||
solver.Solve(5, verbose_, &pose_curr2last_);
|
solver.Solve(5, verbose_, &pose_curr2last_);
|
||||||
}
|
}
|
||||||
pose_curr2world_ = pose_curr2world_ * pose_curr2last_;
|
pose_curr2world_ = pose_curr2world_ * pose_curr2last_;
|
||||||
*pose = pose_curr2world_;
|
*pose_out = pose_curr2world_;
|
||||||
AINFO_IF(verbose_) << "Pose increase: " << pose_curr2last_.ToString();
|
AINFO_IF(verbose_) << "Pose increase: " << pose_curr2last_.ToString();
|
||||||
AINFO_IF(verbose_) << "Pose after: " << pose_curr2world_.ToString();
|
AINFO_IF(verbose_) << "Pose after: " << pose_curr2world_.ToString();
|
||||||
UpdatePre(features);
|
UpdatePre(features);
|
||||||
|
|
|
@ -16,7 +16,7 @@ class Odometer {
|
||||||
bool Init();
|
bool Init();
|
||||||
|
|
||||||
void Process(double timestamp, const std::vector<Feature> &features,
|
void Process(double timestamp, const std::vector<Feature> &features,
|
||||||
common::Pose3d *const pose);
|
common::Pose3d *const pose_out);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void UpdatePre(const std::vector<Feature> &features);
|
void UpdatePre(const std::vector<Feature> &features);
|
||||||
|
@ -41,6 +41,8 @@ class Odometer {
|
||||||
|
|
||||||
std::vector<TPointCloudPtr> clouds_corn_pre_;
|
std::vector<TPointCloudPtr> clouds_corn_pre_;
|
||||||
std::vector<TPointCloudPtr> clouds_surf_pre_;
|
std::vector<TPointCloudPtr> clouds_surf_pre_;
|
||||||
|
TPointCloudPtr corn_pre_;
|
||||||
|
TPointCloudPtr surf_pre_;
|
||||||
|
|
||||||
std::vector<pcl::KdTreeFLANN<TPoint>> kdtrees_surf_;
|
std::vector<pcl::KdTreeFLANN<TPoint>> kdtrees_surf_;
|
||||||
std::vector<pcl::KdTreeFLANN<TPoint>> kdtrees_corn_;
|
std::vector<pcl::KdTreeFLANN<TPoint>> kdtrees_corn_;
|
||||||
|
|
Loading…
Reference in New Issue