ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

const Eigen::Affine3d; rotation()

asked 2018-06-14 09:32:12 -0500

JonasG gravatar image

Hey, I have solved the forward kinematics with moveit.

kinemtic_state->setJointGroupPositions(joint_model_group, joint_values);
const Eigen::Affine3d &arm_link_5_state = kinematic_state->getGlobalLinkTransform("arm_link_5");

x = arm_link_5_state.translation().x();
y = arm_link_5_state.translation().y();
z = arm_link_5_state.translation().z();

xx = arm_link_5_state.rotation().??;
xy = arm_link_5_state.rotation().??;
xz = arm_link_5_state.rotation().??;

I don't know how to assign the value of xx, xy, xz of the rotation matrix.

I tried:

   xx = arm_link_5_state.rotation().xx();
   xx = arm_link_5_state.rotation().x().x();
   xx = arm_link_5_state.rotation().nx();
   xx = arm_link_5_state.rotation(0,0);

Error: const LinearMatrixType has no member named xx

I don't find the class where it is declared.

It would be great if someone can help me out.

Best regards, Jonas

edit retag flag offensive close merge delete

Comments

The accessor for the linear part of the affine transform is .linear(), not .rotation(). See docs here.

stevejp gravatar image stevejp  ( 2018-06-14 11:44:48 -0500 )edit

.linear().xx()? I don't find it in the doc.

JonasG gravatar image JonasG  ( 2018-06-14 11:47:18 -0500 )edit

Check out this tutorial and if you still can't figure it out update your question.

stevejp gravatar image stevejp  ( 2018-06-14 11:56:04 -0500 )edit

In my code I print the rotation with

ROS_INFO_STREAM("Rotation: " << arm_link_5_state.rotation());

and that works well.

I want to extract the individual values of the rotation matrix.

Thanks for your help @stevejp

JonasG gravatar image JonasG  ( 2018-06-14 11:57:53 -0500 )edit

Now it works.

Thanks for that @stevejp

JonasG gravatar image JonasG  ( 2018-06-14 12:21:09 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2018-06-14 12:15:45 -0500

stevejp gravatar image

Ah I misspoke earlier, .rotation() is fine for pulling out the rotation matrix. To access individual elements you can do Eigen::Matrix3d rot = arm_link_5_state.rotation(), and then xx = rot(0,0), etc.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2018-06-14 09:32:12 -0500

Seen: 5,782 times

Last updated: Jun 14 '18