License: CC-BY-NC-SA 4.0
I found an issue¶
Thank you! Please report it at https://
Latex Macros¶
\providecommand{\myvec}[1]{{\mathbf{\boldsymbol{{#1}}}}}
\providecommand{\mymatrix}[1]{{\mathbf{\boldsymbol{{#1}}}}}Valid imports¶
from math import pi, sin, cos
import numpy as npθ_a = pi/4.0
R_a = np.array([[cos(θ_a),-sin(θ_a)],
[sin(θ_a), cos(θ_a)]])
# Printing the result is NOT a mandatory part of the answer.
print(f'R_a = {R_a}')R_a = [[ 0.70710678 -0.70710678]
[ 0.70710678 0.70710678]]
Exercise b¶
Exercise c¶
θ_c = pi/3.0
x_c = 2.0
y_c = 5.0
H_c1 = np.array([[cos(θ_c),-sin(θ_c), 0],
[sin(θ_c), cos(θ_c), 0],
[0, 0, 1]])
H_c2 = np.array([[1,0,x_c],
[0,1,y_c],
[0,0,1]])
H_c = H_c1 @ H_c2
print(f'H_c = {H_c}')H_c = [[ 0.5 -0.8660254 -3.33012702]
[ 0.8660254 0.5 4.23205081]
[ 0. 0. 1. ]]
Exercise d¶
θ_d = pi/3.0
x_d = 2.0
y_d = 5.0
H_d1 = np.array([[1,0,x_d],
[0,1,y_d],
[0,0,1]])
H_d2 = np.array([[cos(θ_d),-sin(θ_d), 0],
[sin(θ_d), cos(θ_d), 0],
[0, 0, 1]])
H_d = H_d1 @ H_d2
print(f'H_d = {H_d}')H_d = [[ 0.5 -0.8660254 2. ]
[ 0.8660254 0.5 5. ]
[ 0. 0. 1. ]]
H_c is not the same as H_d. This indicates that the order of operations matter. That is, sequential pose transformations are not commutative.
t = 10.0
θ = sin(t) + 2 * cos(t)
R = np.array([[cos(θ),-sin(θ)],
[sin(θ), cos(θ)]])Extra challenge 2¶
See DH parameters in lesson 3.
θ = pi/10.0
d = 0.3
a = 0.5
α = -pi/2.0
H1 = np.array(
[[cos(θ), -sin(θ), 0, 0],
[ sin(θ), cos(θ), 0, 0],
[ 0, 0, 1, 0],
[ 0, 0, 0, 1]]
)
H2 = np.array(
[[1, 0, 0, 0],
[0, 1, 0, 0],
[0, 0, 1, d],
[0, 0, 0, 1]]
)
H3 = np.array(
[[1, 0, 0, a],
[0, 1, 0, 0],
[0, 0, 1, 0],
[0, 0, 0, 1]]
)
H4 = np.array(
[[1, 0, 0, 0],
[0, cos(α), -sin(α), 0],
[0, sin(α), cos(α), 0],
[0, 0, 0, 1]]
)
H = H1 @ H2 @ H3 @ H4