Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed log operator (and added ==) for Sim3 #54

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#ifndef KINDR_MINIMAL_IMPLEMENTATION_QUAT_SIM_TRANSFORM_INL_H_
#define KINDR_MINIMAL_IMPLEMENTATION_QUAT_SIM_TRANSFORM_INL_H_

#include <cmath>

#include <glog/logging.h>

namespace kindr {
Expand All @@ -20,10 +22,16 @@ template <typename Scalar>
QuatSimTransformTemplate<Scalar>::QuatSimTransformTemplate(
const Vector7& log_vector)
: T_A_B_(Eigen::Matrix<Scalar, 6, 1>(log_vector.template head<6>())),
scale_A_B_(log_vector(6)) {
scale_A_B_(::exp(log_vector(6))) {
CHECK_GT(scale_A_B_, 0.);
}

template <typename Scalar>
bool QuatSimTransformTemplate<Scalar>::operator==(
const QuatSimTransformTemplate<Scalar>& other) const {
return T_A_B_ == other.T_A_B_ && scale_A_B_ == other.scale_A_B_;
}

template <typename Scalar>
typename QuatSimTransformTemplate<Scalar>::Vector3
QuatSimTransformTemplate<Scalar>::operator*(const Vector3& rhs) const {
Expand Down Expand Up @@ -69,7 +77,7 @@ template <typename Scalar>
inline Eigen::Matrix<Scalar, 7, 1>
QuatSimTransformTemplate<Scalar>::log() const {
Eigen::Matrix<Scalar, 7, 1> result;
result << T_A_B_.log(), scale_A_B_;
result << T_A_B_.log(), ::log(scale_A_B_);
return result;
}

Expand Down
2 changes: 2 additions & 0 deletions minkindr/include/kindr/minimal/quat-sim-transform.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ class QuatSimTransformTemplate {

QuatSimTransformTemplate(const Vector7& log_vector);

inline bool operator==(const QuatSimTransformTemplate<Scalar>& other) const;

inline Vector3 operator*(const Vector3& rhs) const;

// Vectorized, applies operator * to each column vector.
Expand Down