Skip to content

Commit

Permalink
solve div by zero error
Browse files Browse the repository at this point in the history
  • Loading branch information
ZacharyTaylor committed Nov 19, 2018
1 parent cc28da3 commit da8744b
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions include/lidar_align/transform.h
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,15 @@ class Transform {
}

static Transform exp(const Vector6& vector) {
return Transform(vector.head<3>(), Rotation(Eigen::AngleAxisf(
vector.tail<3>().norm(),
vector.tail<3>().normalized())));
Rotation rotation;
constexpr float kEpsilon = 1e-8;
const float norm = vector.tail<3>().norm();
if (norm < kEpsilon) {
return Transform(vector.head<3>(), Rotation::Identity());
} else {
return Transform(vector.head<3>(), Rotation(Eigen::AngleAxisf(
norm, vector.tail<3>() / norm)));
}
}

Vector6 log() const {
Expand Down

0 comments on commit da8744b

Please sign in to comment.