Matlab Motion Capture System
In this section, we explain how we access and use data from the tracking system from Matlab.
Calls to API
From Matlab, we are able to load the Tracking Tools API and make calls to it to request marker positions as well as trackable positions/orientations. This part is fairly straightforward, and is done in the Matlab code in the following files: initTrackingSystem.m, getTrackingFrame.m, getTrackingMarkers.m, and getTrackingTrackables.m. The only thing that may not be intuitive is the fact that the tracking system uses all left-handed coordinate frames internally. After making calls to the API, we receive the data in terms of the left-handed camera coordinate frame. To fix this, we first transform all of the data into a right-handed frame and then use the transformation matrix from the calibration procedure to transform the data into the base frame of the WAM. More details about this are available in John's thesis.
To start playing around with the tracking system, you can run testFramerate.m. This function has nothing to do with the arm and hand. It just initializes the tracking system and makes calls to it. If you want, you can modify it to return the tracking data that was received on each frame and then animate the data to see what was happening. This would be a good way to get familiar with the tracking system code.
Calibration Procedure
Before running any experiment, the arm must be calibrated with the tracking system. The reason for doing this is to find the transformation matrix between the camera frame and the WAM base frame. We can then use this transformation to find out where objects and markers are in the workspace relative to the arm. The calibration procedure itself is performed by rotating the joints of the WAM through known trajectories while recording the marker positions in the camera frame. We can then use our knowledge of the forward kinematics of the arm to approximate the transformation matrix using a non-linear least squares.
Transforming Handedness of Coordinate Frames
To transform the data from a left to right handed coordinate frame, we must simply reverse any one axis (we choose the z-axis). It turns out that this is fairly simple to do. For marker and trackable positions, we simply negate the z-component of the position. For trackable orientations, we essentially reverse the axis (if the orientation is represented using axis angle). This is equivalent to negating the 3rd parameter of the quaternion that we receive from the tracking system. Note that -- if we think about this as axis angle -- we do not need to change theta because: using right handed rule about a positive axis is equivalent to using left handed rule about a negative axis.
Topic revision: r2 - 2011-05-10 - 03:31:44 -
JohnBehmer