Skip to content

Commit d10f81f

Browse files
committed
[force mode controller] Fix the task frame orientation
Before, we were using a RPY notation. Chaning that to an angle-axis notation should fix things.
1 parent b8954f4 commit d10f81f

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

ur_controllers/src/force_mode_controller.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -289,9 +289,11 @@ bool ForceModeController::setForceMode(const ur_msgs::srv::SetForceMode::Request
289289

290290
tf2::Quaternion quat_tf;
291291
tf2::convert(task_frame_transformed.pose.orientation, quat_tf);
292-
tf2::Matrix3x3 rot_mat(quat_tf);
293-
rot_mat.getRPY(force_mode_parameters.task_frame[3], force_mode_parameters.task_frame[4],
294-
force_mode_parameters.task_frame[5]);
292+
const double angle = quat_tf.getAngle();
293+
const auto axis = quat_tf.getAxis();
294+
force_mode_parameters.task_frame[3] = axis.x() * angle; // rx
295+
force_mode_parameters.task_frame[4] = axis.y() * angle; // ry
296+
force_mode_parameters.task_frame[5] = axis.z() * angle; // rz
295297
} catch (const tf2::TransformException& ex) {
296298
RCLCPP_ERROR(get_node()->get_logger(), "Could not transform %s to robot base: %s",
297299
req->task_frame.header.frame_id.c_str(), ex.what());

0 commit comments

Comments
 (0)