i am trying to implement a matlab script where the user can enter quaternions and retrieve the corresponding denavit hartenberg parameters for this link. My approach is to create the homogenous transformation matrix from the entered quaternions and then calculate the DH-Parameters from it.
For now it works for a and d, but it has difficulties with negative alpha angles. I am calculating alpha with 'acosd(Matrix(3,3))', but this always returns positives angles. For example if i have a link with -pi/2 for alpha i retrieve pi/2. I discovered that the transformation matrix has exact the same values for a link with a negative and a link with positive alpha angle. Therefore it is unclear for me how i should identify the sign of alpha with this approach.
Is it even possible what i am trying to do here? And do you have an idea how i can calculate alpha from the transformation matrix with taking into account the sign?