I have a golf club that has four markers on its face and a device which outputs their fiducials data (xyz locations with the ball being the center) through out a swing until the impact. The device automatically calibrates the markers in terms of the ball instead of the camera device.
I have constructed a coordinate system using the markers data to calculate yaw, pitch, roll, and I'm applying (R.from_matrix(frame_orientation[i])) where R is (from scipy.spatial.transform import Rotation as R), and the variable frame orientation[i] represents the vectors of the CS at time i.
At this point, I'm missing a huge step or making a mistake somewhere because the output euler angles do not make sense.
Just to summarize what I have done,
The four markers consist of (TopToe, MidToe, BotToe, Midheel) and I get a midpoint by doing ((MidToe + Midheel) / 2) and construct the coordinate system with the origin being the center point.
Then I have vectors that represent the CS at frame t and I use them as the input for outputting euler angles.....
Do I need to transform the cs vectors further? Thank you for any advices or help. enter image description here
Where I'm constructing the CS:
xyz_frames = []
for i in range(len(mtoe_txyz[:,0]))[:37]: y_axis = x1[i] / np.linalg.norm(x1[i], ord=2)
x_axis = np.cross(x1[i], x2[i])
z_axis = np.cross(x_axis, x1[i])
x_axis = x_axis / np.linalg.norm(x_axis, ord=2)
z_axis = z_axis / np.linalg.norm(z_axis, ord=2)
xyz_frames.append(np.array([x_axis, y_axis, z_axis, center_point[i, 1:4]]))
Setting up the frames and applying the vectors to Euler angles function:
frame_orientation = []
for i in range(len(xyz_frames)): xyz_frame = xyz_frames[i][0:3:] frame_orientation.append(np.transpose(xyz_frame))
ypr = []
for i in range(len(frame_orientation)): r = R.from_matrix(frame_orientation[i])
ypr.append(r.as_euler('zyx', degrees=True))