Ask Your Question
0

Input arguments for tf::Vector3() tf::Quaternion()

asked 2012-02-06 06:00:55 -0500

alfa_80 gravatar image

I would like to know the kind of input arguments passed both in the tf::Vector3() tf::Quaternion() as in the code below:

tf::Transform xform;
xform.setOrigin(tf::Vector3(pose3D_LDD.pose.position.x, pose3D_LDD.pose.position.y, pose3D_LDD.pose.position.z));
xform.setRotation(tf::Quaternion(pose3D_LDD.pose.orientation.x, pose3D_LDD.pose.orientation.y, pose3D_LDD.pose.orientation.z, pose3D_LDD.pose.orientation.w));

Specifically, I want to know, are they absolute or relative? By the way, those all those lines reside in a callback function. For a more detail version of the code snippet of it, kindly refer to the code snippet here.

I know that tf::Vector3() tf::Quaternion() refer to translation and rotation respectively but, should they be passed as absolute or relative in this regard?

Thanks in advance.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2012-02-06 06:42:31 -0500

DimitriProsser gravatar image

They should be passed in relative to the parent frame.

For example, you have base_link, located at (0, 0, 0) with a roll, pitch, and yaw of (0, 0, 0). Let's say that your sensor is located 1 meter in front of your robot, and it is inverted (upside down). Then, you would set the transform origin to (1, 0, 0) with RPY of (0, M_PI, 0).

tf::Transform xform;
xform.setOrigin(tf::Vector3(1.0, 0, 0));
xform.setRotation(tf::createQuaternionFromRPY(0, M_PI, 0));

If the sensor were located behind the robot, it would be:

tf::Transform xform;
xform.setOrigin(tf::Vector3(-1.0, 0, 0));
xform.setRotation(tf::createQuaternionFromRPY(0, M_PI, 0));
edit flag offensive delete link more

Comments

With respect to the input values in my code snippet(that you once suggested that way), what was your assumption? relative or absolute?
alfa_80 gravatar imagealfa_80 ( 2012-02-06 06:53:04 -0500 )edit
If it is relative, that means, I've to pass in the value, like (previousValueOfX - ValueOfX) for each of them correspondingly. Am i right?
alfa_80 gravatar imagealfa_80 ( 2012-02-06 06:55:24 -0500 )edit
For instance, xform.setOrigin(tf::Vector3(pose3D_LDD.pose.position.x, pose3D_LDD.pose.position.y, pose3D_LDD.pose.position.z)); ]
alfa_80 gravatar imagealfa_80 ( 2012-02-06 06:57:27 -0500 )edit
I don't know what pose3D_LDD represents.
DimitriProsser gravatar imageDimitriProsser ( 2012-02-06 06:58:37 -0500 )edit
cont'd: should have been written as [should have been written as [xform.setOrigin(tf::Vector3(previous_pose3D_LDD.pose.position.x-pose3D_LDD.pose.position.x, previous_pose3D_LDD.pose.position.y-pose3D_LDD.pose.position.y, previous_pose3D_LDD.pose.position.z-pose3D_LDD.pose.position.z));]
alfa_80 gravatar imagealfa_80 ( 2012-02-06 06:59:39 -0500 )edit
pose3D_LDD represents absolute values for x, y and z.
alfa_80 gravatar imagealfa_80 ( 2012-02-06 07:01:12 -0500 )edit
You can do tf::transformPose() to transform the pose from the world frame to the same frame as the cloud.
DimitriProsser gravatar imageDimitriProsser ( 2012-02-06 07:33:24 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2012-02-06 06:00:55 -0500

Seen: 2,597 times

Last updated: Feb 06 '12