@@ -204,17 +204,19 @@ inline void getCartesianError(const Eigen::Vector3d& current_position,
204
204
const Eigen::Quaterniond& goal_orientation,
205
205
Eigen::Matrix<double , 6 , 1 >& error) {
206
206
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
+
207
212
Eigen::Quaterniond regularized_current_orientation;
208
213
regularized_current_orientation.coeffs () << current_orientation.coeffs ();
209
214
if (goal_orientation.coeffs ().dot (current_orientation.coeffs ()) < 0 .) {
210
215
regularized_current_orientation.coeffs () << -current_orientation.coeffs ();
211
216
}
212
217
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 ();
215
218
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 );
218
220
}
219
221
220
222
inline void getCartesianError (const Eigen::Affine3d& current_transform,
@@ -237,12 +239,9 @@ inline void getCartesianError(const Eigen::Affine3d& current_transform,
237
239
* @param tol Tolerance.
238
240
* @return True if close.
239
241
*/
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 {
246
245
if (tol <= 0 ) {
247
246
tol = kTolerance ;
248
247
}
0 commit comments