Camera Points into the Robot Base Frame
Implement transform_points(T, points) returning an (N, 3) array.
Examples
The identity transform returns the points unchanged
- Input
- transform_points([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]], [[1, 2, 3], [4, 5, 6]])
- Output
- [[1, 2, 3], [4, 5, 6]]
A pure translation shifts every point
- Input
- transform_points([[1, 0, 0, 1], [0, 1, 0, 2], [0, 0, 1, 3], [0, 0, 0, 1]], [[0, 0, 0], [1, 1, 1]])
- Output
- [[1, 2, 3], [2, 3, 4]]
Rotate about z by 90 degrees, then translate by [1, 0, 0]
- Input
- transform_points([[0, -1, 0, 1], [1, 0, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]], [[1, 0, 0]])
- Output
- [[1, 1, 0]]
Hints
Hint 1
Use a matrix product rather than nested loops, and check which operand transposes.
Hint 2
Watch for this: applied the translation before the rotation.
Requirements
: (4, 4) transform from the points' frame to the target frame
points: (N, 3) pointsReturn (N, 3) transformed points
Constraints
Allowed library: NumPy only
Time limit: 200 ms, Memory: 64 MB
Try similar problems(4)
Industrial Robotics: Kinematics and Control · ~12 min
Industrial Robotics: Kinematics and Control · ~12 min
Industrial Robotics: Kinematics and Control · ~10 min
Industrial Robotics: Kinematics and Control · ~14 min
Where this shows up
6 employers weight this skill
4 autonomy companies, 2 defense companies. Top match scores 93.
import numpy as np
def transform_points(T, points):
"""
Apply a homogeneous transform to a stack of 3D points.
Args:
T: (4, 4) transform from the points' frame to the target frame
points: (N, 3) points
Returns:
(N, 3) transformed points
"""
# YOUR CODE HERE
pass