flexion iteration

This commit is contained in:
ethan merchant 2023-04-29 09:58:29 -04:00
parent 3ff09cf907
commit ba19eeb21d
4 changed files with 28 additions and 34 deletions

View file

@ -1,10 +0,0 @@
@REM make console window active
@REM powershell -window normal -command ""
dotnet build
pause
cd bin/Debug
@REM echo "zipping into dofdev site"
@REM 7z u oriels.zip %cd%/netcoreapp3.1
@REM Xcopy "oriels.zip" "C:/dofdev/Web Development/dofdev/res/oriels.zip" /F /Y
cd net6.0
oriels.exe

View file

@ -173,7 +173,7 @@ public class Mono {
}
int dofIndex = 0;
Pose windowPoseButton = new Pose(-0.5f, 1.3f, 0, Quat.FromAngles(0, -90f, 0));
Pose windowPoseButton = new Pose(0, 1f, -0.5f, Quat.FromAngles(0, 0, 0));
TextStyle style = Text.MakeStyle(Font.FromFile("add/fonts/DM-Mono.ttf"), 1f * U.cm, Color.White);
TextStyle style2 = Text.MakeStyle(Font.FromFile("add/fonts/DM-Mono.ttf"), 1f * U.cm, new Color(0.5f, 0.5f, 0.5f));
Vec2 fieldSize = new Vec2(6f * U.cm, 3f * U.cm);

View file

@ -83,22 +83,40 @@ public class Rig {
lWrist = new Pose(lCon.pos + lCon.ori * new Vec3(0, 0, 0.052f), lCon.ori);
}
public float Flexion(Hand hand, FingerId finger, float deadzone = 0.15f) {
float flexion = (Vec3.Dot(
PullRequest.Direction(
hand.Get(finger, JointId.Tip).position,
hand.Get(finger, JointId.KnuckleMinor).position
public float Flexion(Hand hand, FingerId id) {
float fingerFlex = (Vec3.Dot(
Vec3.Direction(
hand.Get(id, JointId.Tip).position,
hand.Get(id, JointId.KnuckleMinor).position
),
PullRequest.Direction(
hand.Get(finger, JointId.KnuckleMid).position,
hand.Get(finger, JointId.KnuckleMajor).position
Vec3.Direction(
hand.Get(id, JointId.KnuckleMid).position,
hand.Get(id, JointId.KnuckleMajor).position
)
) + 1f) / 2;
flexion = Math.Max(flexion - deadzone, 0f) / (1 - deadzone);
float fingerTrim = 0.15f;
fingerFlex = Math.Max(fingerFlex - fingerTrim, 0f) / (1 - fingerTrim);
float knuckleFlex = (Vec3.Dot(
Vec3.Direction(
hand.Get(id, JointId.KnuckleMid).position,
hand.Get(id, JointId.KnuckleMajor).position
),
Vec3.Direction(
hand.Get(id, JointId.KnuckleMajor).position,
hand.Get(id, JointId.Root).position
)
) + 1f) / 2;
float knuckleTrim = 0.666f;
knuckleFlex = Math.Max(knuckleFlex - knuckleTrim, 0f) / (1 - knuckleTrim);
float flexion = knuckleFlex + fingerFlex;
return flexion * flexion;
}
public Vec3 Fullstick(bool chirality) {
Controller con = Con(chirality).device;
Quat rot = Quat.FromAngles(con.stick.y * -90, 0, con.stick.x * 90);

View file

@ -92,18 +92,4 @@ class WaveCursor : dof {
/*
COMMENTS
!uses a naive flexion method
that needs a refactor to
to both track for
finger & knuckle flexion
as they are intertwined at the intersection
in way that can't be ignored and must be derived!
in order to have a principled wave-cursor
(let alone a rolls-cursor)
sidetest: may be useful for interactions!
where you can use the finger flexion for grabbing
and knuckle flexion for cursor extension
*/