0
$\begingroup$

Rosanswers logo

I am using the openni_tracker with a Kinect, and I have written a node to receive the transforms from it. Is there a variable that will tell me the distance between the sensor and a joint of a person being tracked?

Update: In openni_tracker.cpp, this code is found:

void publishTransform(XnUserID const& user, XnSkeletonJoint const& joint, string const& frame_id, string const& child_frame_id) {
    static tf::TransformBroadcaster br;

    XnSkeletonJointPosition joint_position;
    g_UserGenerator.GetSkeletonCap().GetSkeletonJointPosition(user, joint, joint_position);
    double x = joint_position.position.X / 1000.0;
    double y = joint_position.position.Y / 1000.0;
    double z = joint_position.position.Z / 1000.0;

    XnSkeletonJointOrientation joint_orientation;
    g_UserGenerator.GetSkeletonCap().GetSkeletonJointOrientation(user, joint, joint_orientation);

    XnFloat* m = joint_orientation.orientation.elements;
    KDL::Rotation rotation(m[0], m[1], m[2],
                                           m[3], m[4], m[5],
                                           m[6], m[7], m[8]);
    double qx, qy, qz, qw;
    rotation.GetQuaternion(qx, qy, qz, qw);

    tf::Transform transform;
    transform.setOrigin(tf::Vector3(x, y, z));
    transform.setRotation(tf::Quaternion(qx, qy, qz, qw));
    br.sendTransform(tf::StampedTransform(transform, ros::Time::now(), frame_id, child_frame_id));
}

It appears that the Vector3 in transform is equal to joint_position.position which is supposed to be the exact position(not how much the joint has moved). Also, the output data seems to show that this is true. Therefore, I believe the problem has been solved.


Originally posted by qdocehf on ROS Answers with karma: 208 on 2011-07-15

Post score: 0


Original comments

Comment by dornhege on 2011-07-18:
Sorry, I had openni_camera in mind. Never worked with tracker, but you can test that quite easily: rosrun tf view_frames while it is running should give you the /tf tree. This should contain the skeleton frames - and maybe? a kinect frame that you can use.

Comment by qdocehf on 2011-07-18:
In what files are those topics created? I need a bit more information about them to be able to subscribe to them.

Comment by dornhege on 2011-07-15:
You just subscribe to the topics in question and yes, they would give you distances.

Comment by qdocehf on 2011-07-15:
How can I access the pointcloud or depth image topics? Would I be able to use them to measure the distance between the sensor and a person that is being tracked?

Comment by dornhege on 2011-07-15:
What do you mean with "distance from the sensor"? Kinect's distance measurements are not in transformations, but in the pointcloud or depth image topics. The distance of the transform would be the norm of its translation (if that has meaning to you).

$\endgroup$

2 Answers 2

0
$\begingroup$

Rosanswers logo

First of all you need to know what you exactly mean by "the distance between the sensor and the person". Is it the distance to the closest person joint? To the person torso?

In any case, if you take the transform between any joint and "openni_depth_frame", you can calculate the distance of that joint to the sensor by getting the norm of the translation vector with sqrt(x²+y²+z²).


Originally posted by Miguel Prada with karma: 1071 on 2011-07-19

This answer was NOT ACCEPTED on the original site

Post score: 1


Original comments

Comment by qdocehf on 2011-07-21:
I posted an answer if you want to mark it.

Comment by tfoote on 2011-07-19:
You should answer your own question then, and an admin will mark it as answered. This way it will be cleared off of the list of "unanswered" questions.

Comment by qdocehf on 2011-07-19:
No, it was actually something else that I found. It is at the bottom of my updated question.

Comment by dornhege on 2011-07-19:
@qdocehf If this answers your question (from the updated title it should) you can click the checkmark to accept the answer.

$\endgroup$
0
$\begingroup$

Rosanswers logo

It appears that the Vector3 in transform is equal to joint_position.position which is supposed to be the exact position(not how much the joint has moved). Also, the output data seems to show that this is true.


Originally posted by qdocehf with karma: 208 on 2011-07-19

This answer was ACCEPTED on the original site

Post score: 0

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.