Shared-Reality-Lab / IMAGE-HAPI

This repository contains both the java and JS/TS versions of the HAPI (Haply's API)
0 stars 0 forks source link

Test examples with new 2diy and determine usable values #33

Closed JRegimbal closed 1 year ago

JRegimbal commented 1 year ago

Not all the examples were able to be tested with the new 2diy model. These should all be tested and their parameters should be adjusted to determine usable ranges and levels. This is especially true for the untested examples that are checked in to use the old model (newPantograph = 0).

Updates and conclusions should be posted in response to this issue. A PR may be necessary for changes to defaults to accommodate the new hardware. This issue will be completed when all examples have been tested.

hanzili commented 1 year ago

Below are parameters that can be adjusted for different force performance in the worker files

Hello_ball

var rBall = 0.02; // ball
var mBall = 0.15;  // mass (kg)
var kBall = 800;  // spring constant (N/m)
var bBall = 3.7; // damping coefficient (kg/s)
var bAir = 0.0;  // air damping coefficient (kg/s)

Hello_dot

var kDot = 2500; // spring constant (N/m)
var bDot = 5; // damping coefficient (kg/s)
var rDot = 0.001;
var distBtwnRows = 0.005;
var distBtwnCols = 0.005;
var start = new Vector(-14 * distBtwnCols, 9 * distBtwnRows);
//preferably not above (-0.07, 0.045)
var end = new Vector(14 * distBtwnCols, 26 * distBtwnRows);
// preferably not below (0.07, 0.13)

Hello_guide_dot

// magnitude of the force
var kp = 0.15; // kp += 0.01;
var ki = 1.2; // ki += 0.00001;
var kd = 1.5; // kd += 0.1;
fCalc.x = constrain(kp * error.x + ki * cumError.x + kd * diff.x, -4, 4) * -1;
fCalc.y = constrain(kp * error.y + ki * cumError.y + kd * diff.y, -4, 4);
// may adjust the max and min value of the constrain force
// how randy looks like in js file
randy.x = randGen(-0.07, 0.05);
randy.y = randGen(0.045, 0.1);

hello_guide_path

var kp = 0.06; // kp += 0.01;
var ki = 3.1; // ki += 0.00001;
var kd = 4.5; // kd += 0.1;
const starArray = [
  [0.0, 0.03], [0.01, 0.05], [0.03, 0.06], [0.01, 0.07], [0.0, 0.09],
  [-0.01, 0.07], [-0.03, 0.06], [-0.01, 0.05], [0.0, 0.03]
]

Hello_ice

var bAir = 0;  // air
var bTopLeft = 0; // top left quadrant
var bTopRight = 1.2; // top right quadrant
var bBotLeft = 0; // bottom left quadrant
var bBotRight = 1.2; // bottom right quadrant
var posWallVer = new Vector(0.0, 0.12);
var posWallHor = new Vector(0.07, 0.07);
fCalc.x = constrain(0.4*fEnv.x + 0.3*fEnvLast.x + 0.2*fEnvLastLast.x + 0.1*fEnvLastLastLast.x, -6, 6) * -1;
fCalc.y = constrain(0.4*fEnv.y + 0.3*fEnvLast.y + 0.2*fEnvLastLast.y + 0.1*fEnvLastLastLast.y, -6, 6);

Hello_jelly

var bAir = 0;  // air
var bTopLeft = 1; // top left quadrant
var bTopRight = 4; // top right quadrant
var bBotLeft = 1; // bottom left quadrant
var bBotRight = 4; // bottom right quadrant
var posWallVer = new Vector(0.0, 0.12);
var posWallHor = new Vector(0.07, 0.07);
fCalc.x = constrain(0.4*fEnv.x + 0.3*fEnvLast.x + 0.2*fEnvLastLast.x + 0.1*fEnvLastLastLast.x, -6, 6) * -1;
fCalc.y = constrain(0.4*fEnv.y + 0.3*fEnvLast.y + 0.2*fEnvLastLast.y + 0.1*fEnvLastLastLast.y, -6, 6);

Hello_path_switch

var kp = 0.06; // kp += 0.01;
var ki = 3.1; // ki += 0.00001;
var kd = 4.5; // kd += 0.1;
const pArray1 = [[-0.05, 0.035], [0.05, 0.06]]
const pArray2 = [[0.05, 0.075], [-0.05, 0.1]]
fCalc.x = constrain(kp * error.x + ki * cumError.x + kd * diff.x, -4, 4) * -1;
fCalc.y = constrain(kp * error.y + ki * cumError.y + kd * diff.y, -4, 4);

Hello_section

var kWall = 1500; // spring constant (N/m)
var bWall = 20; // damping coefficient (kg/s)

Hello_stripe

var kWall = 3500; // spring constant (N/m)
var bWall = 5; // damping coefficient (kg/s)
var distBtwnWalls = 0.005;
hanzili commented 1 year ago

Below are files that are not tested with version 3 Haptic. I change some parameters to make them work with version 3 Haptic; some parameters can vary in a range to give a different experience.

Hello_dot

var kDot = 380-1200;
var bDot = 0.5; 

kDot can vary from 380-1200 to experience the different magnitudes of the force.

Hello_ice

var bTopLeft = 0; // top left quadrant
var bTopRight = 0.7-1.1; //bottom left quadrant
var bBotRight = 0.7-1.1; // bottom right quadrant

bTopRight and bBotRight can change from 0.7-0.9 to experience different levels of skidding. Sometimes, the end effect may suddenly accelerate from left to right.

Hello_jelly

var bTopLeft = 0.6-1.8; 
var bTopRight = 0.6-1.8; 
var bBotLeft = 0.6-1.8; 
var bBotRight = 0.6-1.8;

All parameters above can vary in the 0.6-1.8 range to experience a "jelly" feeling; the more significant the difference between the right and left parameters, the more viscosity the user can feel.

Hello_stripe

var kWall = 1000 - 3500;
var bWall = 1;

The value of kWall can vary from 1000 - 3500; the more significant the bumping force the user can feel when passing through the stripes.

JRegimbal commented 1 year ago

@hanzili could you please add some more information about how these effects feel with parameters adjusted within these ranges?

JRegimbal commented 1 year ago

@hanzili would you mind clarifying how distinguishable the values are in these ranges and, if possible, how many discrete values can be felt within them?

hanzili commented 1 year ago

@hanzili would you mind clarifying how distinguishable the values are in these ranges and, if possible, how many discrete values can be felt within them?

Done! I have added different levels of feelings for each example and how much should be changed to produce different feelings. ;)

JRegimbal commented 1 year ago

Excellent, thank you Hanzi!