Tiny cleanup. (#312)

master
Wolfgang Hess 2017-06-02 16:44:27 +02:00 committed by GitHub
parent 0aa9730518
commit ba4f8ca9ee
3 changed files with 2 additions and 15 deletions

View File

@ -51,14 +51,6 @@ constexpr T Pow2(T a) {
return Power(a, 2); return Power(a, 2);
} }
// Calculates the real part of the square root of 'a'. This is helpful when
// rounding errors generate a small negative argument. Otherwise std::sqrt
// returns NaN if its argument is negative.
template <typename T>
constexpr T RealSqrt(T a) {
return sqrt(std::max(T(0.), a));
}
// Converts from degrees to radians. // Converts from degrees to radians.
constexpr double DegToRad(double deg) { return M_PI * deg / 180.; } constexpr double DegToRad(double deg) { return M_PI * deg / 180.; }

View File

@ -249,9 +249,9 @@ std::vector<DiscreteScan> FastCorrelativeScanMatcher::GenerateDiscreteScans(
// and rotation of the 'initial_pose', so that the rotation is around the // and rotation of the 'initial_pose', so that the rotation is around the
// origin of the range data, and yaw is in map frame. // origin of the range data, and yaw is in map frame.
const transform::Rigid3f pose( const transform::Rigid3f pose(
Eigen::Translation3f(initial_pose.translation()) * initial_pose.translation(),
transform::AngleAxisVectorToRotationQuaternion(angle_axis) * transform::AngleAxisVectorToRotationQuaternion(angle_axis) *
Eigen::Quaternionf(initial_pose.rotation())); initial_pose.rotation());
result.push_back( result.push_back(
DiscretizeScan(search_parameters, coarse_point_cloud, pose)); DiscretizeScan(search_parameters, coarse_point_cloud, pose));
} }

View File

@ -32,7 +32,6 @@ namespace transform {
template <typename FloatType> template <typename FloatType>
class Rigid2 { class Rigid2 {
public: public:
using Affine = Eigen::Transform<FloatType, 2, Eigen::Affine>;
using Vector = Eigen::Matrix<FloatType, 2, 1>; using Vector = Eigen::Matrix<FloatType, 2, 1>;
using Rotation2D = Eigen::Rotation2D<FloatType>; using Rotation2D = Eigen::Rotation2D<FloatType>;
@ -125,16 +124,12 @@ using Rigid2f = Rigid2<float>;
template <typename FloatType> template <typename FloatType>
class Rigid3 { class Rigid3 {
public: public:
using Affine = Eigen::Transform<FloatType, 3, Eigen::Affine>;
using Vector = Eigen::Matrix<FloatType, 3, 1>; using Vector = Eigen::Matrix<FloatType, 3, 1>;
using Quaternion = Eigen::Quaternion<FloatType>; using Quaternion = Eigen::Quaternion<FloatType>;
using AngleAxis = Eigen::AngleAxis<FloatType>; using AngleAxis = Eigen::AngleAxis<FloatType>;
Rigid3() Rigid3()
: translation_(Vector::Identity()), rotation_(Quaternion::Identity()) {} : translation_(Vector::Identity()), rotation_(Quaternion::Identity()) {}
// TODO(damonkohler): Remove
explicit Rigid3(const Affine& affine)
: translation_(affine.translation()), rotation_(affine.rotation()) {}
Rigid3(const Vector& translation, const Quaternion& rotation) Rigid3(const Vector& translation, const Quaternion& rotation)
: translation_(translation), rotation_(rotation) {} : translation_(translation), rotation_(rotation) {}
Rigid3(const Vector& translation, const AngleAxis& rotation) Rigid3(const Vector& translation, const AngleAxis& rotation)