You can find the description of the task here.
For task 1:
# approximate rotation
R = np.array([[0.8047, -0.5059, -0.3106],
[0.3106, 0.8047, -0.5059],
[0.5059, 0.3106, 0.8047]])
# less approximate rotation u, s, vh = np.linalg.svd(R) R = u.dot(vh)
# translation t, or OO' in beta o_o_pr_beta = np.array([[-1], [0.5], [1]])
For task 2:
Create a function compute_rot_t(R_1, t_1, R_2, t_2, R_3, t_3) which takes as inputs three transformations as mentioned in the task description and outputs object pose after the motion.
Input/Output specifications for compute_rot_t:
R_1, R_2, R_3 : rotation matrices (3×3 matrix of type np.ndarray)
t_1, t_2, t_3 : translation (3×1 matrix of type np.ndarray)
“r” and “t”, whose values are the rotation (3×3 matrix of type np.ndarray) and the translation (3×1 matrix of type np.ndarray) of the object after the motion expressed in the world frame.
Implement the solution in a single file hw02.py. The file must contain the compute_rot_t function, such that it can be imported (by the automatic evaluation) as
import hw02 res = hw02.compute_rot_t(*args)
Upload a zip archive hw02.zip (via the course ware) containing:
hw02.json - json file containing the solution of Task 1
hw02.py - python script containing the implemented function compute_rot_t
hw02.zip.
Creating hw02.json:
Create an empty dictionary in Python:
solution = {}
The key for this dictionary will be “x_pr_beta”, translation, a list of three float values.
import json
with open("hw02.json", "w") as outfile:
json.dump(solution, outfile)