mirru-app / mirru-android

This sketch was made to be used in conjunction with the Mirru Arduino Sketch
8 stars 2 forks source link

How did you calculate Thumb angle? #9

Open EigenSpiral opened 2 years ago

EigenSpiral commented 2 years ago

Hi, I'm a researcher studying hand kinematics, and came across your website. This is great work!

I was wondering, how did you calculate the thumb angle because it moves so differently from finger?

violetforest commented 2 years ago

Hey, thanks for your interest!

You can see some more info here about how we calculated the thumb angle. https://developers.googleblog.com/2021/05/control-your-mirru-prosthesis-with-mediapipe-hand-tracking.html The calculations aren't as precise as the rest of the fingers to be quite honest.

MediapipeFragment.java Vector3 thumbNormal = FingerAngles.getThumbNormal(palm0, palm13, palm17, palm5); //0-> 13 and 17-> 5

FingerAngles.java

public static Vector3 getThumbNormal(Vector3 A, Vector3 B, Vector3 C, Vector3 D) {
        B.sub(A);
        Vector3 side1 = B;

        D.sub(C);
        Vector3 side2 = D;

        side1.crossProduct(side2);

        Vector3 normal = new Vector3(side1.toNormal());
        return normal;
}