Tool Calibration
For a CAS scene, the location of the tool tip must be known in the coordinate system of the tracking camera. Tool calibration is performed to determine the location of the tool tip relative to its tracked location. In this assignment you will implement two different ways to calibrate a rigid straight tool.
Pivot calibration
Implement the pivot calibration algorithm as discussed in the “Positional Tracking” lecture. While pivoted around its tip, the optically tracked pose of the instrument has been saved. The data can be used to solve for the location of the tool tip relative to the origin of the tracked marker.
Theory
\(p_t\) is constant if looking from the tool local coordinate system (COS)
Pivot point (tool tip) \(p_p\) is constant if looking from the tracking camera COS
At any moment, \(F_i(R_i, p_i)\) can be retrieved from the tracking camera API
\(F_i(R_i, p_i)\) takes \(p_t\) to \(p_p\)
\(R_i \cdot p_t + p_i = p_p\)
Unknowns: \(p_t\) and \(p_p\)
To solve for \(p_t\) and \(p_p\) we need to construct a linear equation system of the form \(Ax = b\):
\(R_i \cdot p_t - p_p = -p_i\)
and in matrix form
which can be solved using a least squares method such as SVD.
Programming assignment
Note
Do not forget to update your repository by running git pull --rebase --autostash.
Implement the pivot calibration algorithm, based on a list of saved tracked tool poses during pivoting (4x4 transformation matrices) in the file assignments/toolcalibration/calibration.py. You can test your implementation by running
the file directly in PyCharm or from the console using `python cas/toolcalibration/pivotcalibration.py.
1 def pivot_calibration(transforms):
2 """
3 Pivot calibration
4
5 Keyword arguments:
6 transforms -- A list of 4x4 transformation matrices from the tracking system (Fi)
7 representing the tracked tool's position and orientation at
8 different instances.
9
10 Returns:
11 T -- The calibration matrix T (in homogeneous coordinates) that defines
12 the offset (p_t) from the tracked part to the pivot point (tool tip).
13 """
14
15 ## TODO: Implement pivot calibration as discussed in the lecture
16
17 T = np.eye(4)
18
19 return T
Calibration device
Implement the code to calibrate an instrument using a calibration device.
Theory
The following transformations are given:
\(^{camera}T_{tool}\) : transformation from the tool to the camera (given by the tracking system)
\(^{camera}T_{reference}\) : transformation from the reference to the camera (given by the tracking system)
\(^{reference}T_{tip}\) : transformation from the tip point to the reference (given by the CAD model)
The following transformation is missing:
\(^{tool}T_{tip}\) : calibration transformation from the tool tip to the tracked marker
To implement these calculations you can use the following definition:
Thus, if you multiply all transformations in the same direction you get an identity.
Note: If you use the * operator Python will perform a element-wise matrix multiplication!
Programming assignment
Note
Do not forget to update your repository by running git pull --rebase --autostash.
You have to implement this algorithm in the file assignments/toolcalibration/calibration.py. You can test your implementation by running
the file directly in PyCharm or from the console using `python cas\toolcalibration\calibrationdevice.py.
1 def calibration_device_calibration(camera_T_reference, camera_T_tool, reference_T_tip):
2 """
3 Tool calibration using calibration device
4
5 Keyword arguments:
6 camera_T_reference -- Transformation matrix from reference (calibration device) to camera.
7 camera_T_tool -- Transformation matrix from tool to camera.
8 reference_T_tip -- Transformation matrix from tip to reference (calibration device).
9
10 Returns:
11 T -- Calibration matrix from tool to tip.
12 """
13
14 ## TODO: Implement a calibration method which uses a calibration device
15
16 T = np.eye(4)
17
18 return T
Code Submission
Submit a ZIP file named lastname_firstname_assignment2.zip on ILIAS containing:
The modified
calibration.pyaslastname_firstname_assignment2_code.py.Console output in a text file named
lastname_firstname_assignment2_output.txt.
Online Questions
Complete the “Assignment 2 - Questions” on ILIAS:
Answer all questions.
Each question has only one correct answer.
All questions are equally weighted. Incorrect answers will not result in point deductions.
You are allowed only one attempt to complete the test.
Assignment Evaluation
This assignment constitutes 25% of your total assignment grade, split equally between:
Code Evaluation (50%): points are awarded as follows:
4 points for a working solution.
3 points for only small errors.
2 points for a substantial effort.
1 point for substantial errors or minimal effort.
0 points for no attempt or plagiarism.
Online questions (50%)