Rigid Body to world coordinates

Post Reply
Yan Zhang
Posts: 19
Joined: Fri May 15, 2015 8:26 am

Rigid Body to world coordinates

Post by Yan Zhang »

This may be a silly question to ask but I didn't find answers searching the forum.How do I get the transformation matrix from rigid body coordinates to world (opti-track) coordinates?

We are using the Motive:track. As far as I know, when I define a rigid body, then every time I rotate the rigid body, the Motive returns the rotation angles with respect to the initial rigid body position, not to the world coordinates.
steven.andrews
NaturalPoint Employee
NaturalPoint Employee
Posts: 720
Joined: Mon Jan 19, 2015 11:52 am

Re: Rigid Body to world coordinates

Post by steven.andrews »

Hello Yan Zhang,

Thank you for submitting your question with us. I would be happy to help with your question.

Could you please let me know which of our software or SDK's you are working with?
If you could share any details about the work you have done, or methods you have tried for accessing the data you are asking for, this might help us to better address your questions.

Best regards,
Steven
--
Steven Andrews
OptiTrack | Customer Support Engineer
Yan Zhang
Posts: 19
Joined: Fri May 15, 2015 8:26 am

Re: Rigid Body to world coordinates

Post by Yan Zhang »

Hi Steven,

Your help is greatly appreciated!

Our Flex3 Cameras are linked with OptiHub2 connected to Windows PC through USB. We are running the Motive:Track on PC. The rigid body position and orientation is broadcast via VRPN server.

Then we use a ROS(groovy) on Ubuntu to listen to the VRPN server, using the pacakge "ros_vrpn_client" (http://wiki.ros.org/ros_vrpn_client). This package is developed by a lab in Georgia Tech.

I'll specify my problem like this:
We set the optitrack coordinates using the calibration square. And then we define a trackable rigid body named "Brain1". See Motive GUI in figure 1.

At this time, clearly the rigid body coordinate is not aligned with the optitrack coordinates. The translation in GUI is measured in opt-track coordinates, while the orientation is all zero, meaning these orientation angles are measured relative to the initial position where we define the rigid body.

Our VRPN tracking results on ROS is in figure 2. The VRPN optitrack coordinates y and z are flipped relative to Motive GUI optitrack coordinates. But that's OK. From the quaternions streamed, we can see the rotation angles are all zero, the same as GUI. But what we want from the VRPN is the transformation from the initial position of "Brain1" to the opti-track system.

This should be feasible because in the figure 1, the rigid body frame has already been drawn in the opti-track frame. So I guess maybe the reason is the "ros_vrpn_client" didn't draw the full message from the VRPN server in the Motive:Track.

Any solutions about this? Do we need to modify the codes in the "rose_vrpn_client" or should we use some other vrpn client package on ROS?

Thanks!
Yan
Attachments
figure 2.png
figure 2.png (27.17 KiB) Viewed 8571 times
figure 1.png
figure 1.png (119.77 KiB) Viewed 8571 times
steven.andrews
NaturalPoint Employee
NaturalPoint Employee
Posts: 720
Joined: Mon Jan 19, 2015 11:52 am

Re: Rigid Body to world coordinates

Post by steven.andrews »

Hello Yan Zhang,

Thank you for this information and your explanation of the issue.
Please correct me if I have misunderstood, but it looks like things are streaming as expected.

The translation being reported in the GUI, as per the image you provided, is being reported in millimeters.
The coordinates seem to match the screenshot of the ros_vrpn_client output, although the coordinates appear to be reported in meters.
The -109mm in Motive matches the -.109m in the output, meaning you should have the correct translation of the rigid body relative to Motive's origin.
You are correct that Y and Z seem to be flipped. I'm not sure why this is, unless there's some conversion being done to a different coordinate space.

The orientation of the rigid body is determined at the time of creation, unless adjusted. So if you select the markers and create a rigid body, the orientation will be 0 as it is currently aligned with the world coordinates. Any movement after this should report the orientation in relation to the world coordinate system.

I believe what you are looking for is already there. Please let me know if I have missed the issue here, or have completely misunderstood.

Cheers,
Steven
--
Steven Andrews
OptiTrack | Customer Support Engineer
Yan Zhang
Posts: 19
Joined: Fri May 15, 2015 8:26 am

Re: Rigid Body to world coordinates

Post by Yan Zhang »

Hi Steven,

Thanks for the answer!

I guess I have been misunderstanding how optitrack defines a rigid body for a long time. In our case, we mounted three markers on a robot gripper to define a rigid body. Do you mean every time when this rigid body is created, the origin of this rigid body is selected as the center of these three markers, and the x, y, z axises are aligned with the opti-track system coordinates?

Could I find these information on any user manuals?

Appreciate the help!
Yan
steven.andrews
NaturalPoint Employee
NaturalPoint Employee
Posts: 720
Joined: Mon Jan 19, 2015 11:52 am

Re: Rigid Body to world coordinates

Post by steven.andrews »

Hello Yan,

Your understanding of how the rigid body is created seems to be correct. The origin of the rigid body is the average center for all of the markers that are part of the rigid body and the default orientation is aligned with the world space. The position and orientation of the rigid body's origin can be adjusted using the Orientation tab in the Rigid Bodies pane.

Unfortunately, documentation is one of our weak points at this time. We work to create and update our documentation where possible, but there is still quite a deficit.

I hope this information helps with your questions. If you require any further assistance, please feel free to open a ticket with us at help.naturalpoint.com

Cheers,
Steven
--
Steven Andrews
OptiTrack | Customer Support Engineer
Awais Ahmad
Posts: 1
Joined: Sun Mar 13, 2016 4:50 pm

Re: Rigid Body to world coordinates

Post by Awais Ahmad »

Hello Yan and anybody who needs help in this regard,

I know its quite late answer and you might have solved it already. I had the same problem about the origin of rigid body and the initial orientation so i will just post my solution here to help others.

The position of the origin of a rigid body can be very critical for some applications such as tracking motion of robotic links accurately in a coordinate frame. And its is impossible to manually align the markers with the base frame before making a rigid body. This causes some offsets in orientation.

The solution is to assign a local frame to your rigid body. You can place the origin of this local frame at any location and at any orientation. Once you have your desired local rigid body frame (this would be the initial position), find the coordinates of each marker in this frame of reference. Now open the 'Rigid Body' pane and highlight your markers. 'Create from Selection'. There is a property name showing the 'Marker Locations'. Edit all the marker locations and write the values you found in your desired local frame of reference. This should do the trick.

Best of luck,

Awais Ahmad
Graduate Student @ Ozyegin University
Post Reply