Skip to content

Commit ff204ce

Browse files
committed
fixed
1 parent ee0736a commit ff204ce

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

include/roport/common.h

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -204,17 +204,19 @@ inline void getCartesianError(const Eigen::Vector3d& current_position,
204204
const Eigen::Quaterniond& goal_orientation,
205205
Eigen::Matrix<double, 6, 1>& error) {
206206
error.head(3) << current_position - goal_position;
207+
208+
Eigen::Affine3d current_affine_transform;
209+
current_affine_transform.translation() = current_position;
210+
current_affine_transform.linear() = current_orientation.toRotationMatrix();
211+
207212
Eigen::Quaterniond regularized_current_orientation;
208213
regularized_current_orientation.coeffs() << current_orientation.coeffs();
209214
if (goal_orientation.coeffs().dot(current_orientation.coeffs()) < 0.) {
210215
regularized_current_orientation.coeffs() << -current_orientation.coeffs();
211216
}
212217
Eigen::Quaterniond error_quaternion(regularized_current_orientation.inverse() * goal_orientation);
213-
Eigen::AngleAxisd error_quaternion_ax(error_quaternion);
214-
auto res_1 = error_quaternion_ax.axis() * error_quaternion_ax.angle();
215218
error.tail(3) << error_quaternion.x(), error_quaternion.y(), error_quaternion.z();
216-
error.tail(3) << -Eigen::Affine3d(regularized_current_orientation).linear() * error.tail(3);
217-
assert(res_1 == error.tail(3)); // TODO test this
219+
error.tail(3) << -current_affine_transform.linear() * error.tail(3);
218220
}
219221

220222
inline void getCartesianError(const Eigen::Affine3d& current_transform,
@@ -237,12 +239,9 @@ inline void getCartesianError(const Eigen::Affine3d& current_transform,
237239
* @param tol Tolerance.
238240
* @return True if close.
239241
*/
240-
template <typename T>
241-
inline auto allClose(std::vector<T> first,
242-
std::vector<T> second,
243-
size_t& violated_i,
244-
T& residual,
245-
T tol = kTolerance) -> bool {
242+
template <typename T>
243+
inline auto allClose(std::vector<T> first, std::vector<T> second, size_t& violated_i, T& residual, T tol = kTolerance)
244+
-> bool {
246245
if (tol <= 0) {
247246
tol = kTolerance;
248247
}

0 commit comments

Comments
 (0)