In my class, we are learning how to use Python to code robot poses. Specifically, creating a rotation matrix and translation matrix with numpy to represent these relative poses.
The one thing I don't understand is how our lab assistant demonstrated how to create the rotation matrix. I was able to create it a similar way on my own but I'd like to understand what he did. Here is the example he provided:
Rot = lambda theta: [[np.cos(theta), -np.sin(theta)],
[np.sin(theta), np.cos(theta)]]
R = Rot(np.pi/3)
R
Can someone explain what is the Rot = lambda theta:
code means? When I did it on my own I just created a variable theta
and the equation for Rot
with the variable theta
inside of it in the appropriate places. I do not understand what this lambda
means.