|
a |
|
b/Tools/GRFPrediction/ConditionalContactDistanceAndVelocityDepClass.any |
|
|
1 |
|
|
|
2 |
|
|
|
3 |
#class_template ConditionalContactDistanceAndVelocityDepClass (AnyRefFrame &BaseObject, AnyRefFrame &TargetObject, DisplayTriggerVolume = 0, DisplayTargetNode=0) |
|
|
4 |
{ |
|
|
5 |
AnyComponentDefinition obj = {}; |
|
|
6 |
AnyRefFrame &StrengthObject=TargetObject; //Node used for strength measurement, occasionally this is different from the target object |
|
|
7 |
|
|
|
8 |
AnyFolder &DrawRef=Main.DrawSettings; //reference to the folder which contains drawsettings |
|
|
9 |
//low limit for the strength measure function, if the distance measured along Direction[0] is below this val. the strength will be zero (negative) |
|
|
10 |
#var AnyVar UserDefinedDistLimitLow; |
|
|
11 |
//high limit for the strength measure function, if the distance measured along Direction[0] is above this val. the strength will be zero |
|
|
12 |
#var AnyVar UserDefinedDistLimitHigh ; |
|
|
13 |
|
|
|
14 |
//high limit for the strength measure function, if the radius measured along the plane with Direction[0] as normal is above this val. the strength will be zero |
|
|
15 |
#var AnyVar UserDefinedRadiusLimit; |
|
|
16 |
|
|
|
17 |
//high limit for the strength measure function, if the velocity measured is above this val. the strength will be zero |
|
|
18 |
#var AnyVar UserDefinedVelLimitHigh; |
|
|
19 |
|
|
|
20 |
#var AnyVec3 UserDefinedGroundVel = {0,0,0}; |
|
|
21 |
|
|
|
22 |
#if (DisplayTriggerVolume) |
|
|
23 |
BaseObject = { |
|
|
24 |
AnyRefNode CylRotNode = { |
|
|
25 |
sRel = {0,0,0}; |
|
|
26 |
ARel = RotMat(..RotCoefY*..GlobalRotCoef*pi/2,y)*RotMat(..RotCoefX*..GlobalRotCoef*pi/2,x); |
|
|
27 |
AnyRefNode CylNode = { |
|
|
28 |
sRel = {0,0,...UserDefinedDistLimitLow}; |
|
|
29 |
AnySurfCylinder TriggerCyl = |
|
|
30 |
{ |
|
|
31 |
Radius = ....UserDefinedRadiusLimit; |
|
|
32 |
Length = - ....UserDefinedDistLimitLow + ....UserDefinedDistLimitHigh; |
|
|
33 |
CapRatio = 0.001; |
|
|
34 |
AnyDrawParamSurf Draw = |
|
|
35 |
{ |
|
|
36 |
Visible = On; |
|
|
37 |
Opacity = 0.5; |
|
|
38 |
}; |
|
|
39 |
}; |
|
|
40 |
}; |
|
|
41 |
}; |
|
|
42 |
}; |
|
|
43 |
#endif |
|
|
44 |
|
|
|
45 |
#if (DisplayTargetNode) |
|
|
46 |
TargetObject = { |
|
|
47 |
AnyDrawNode DrawContactTarget = { |
|
|
48 |
ScaleXYZ = {1,1,1}*0.015; |
|
|
49 |
}; |
|
|
50 |
}; |
|
|
51 |
#endif |
|
|
52 |
|
|
|
53 |
#var AnyVar Strength; //strength of muscles |
|
|
54 |
#var AnyVar StaticFrictionCoefficient; //Friction coefficient |
|
|
55 |
#var AnyVar ScaleFactor =1; //scale factor for draw vectors it can be set differently than by the drawsettings |
|
|
56 |
|
|
|
57 |
#var AnyInt NormalDirection = Z; |
|
|
58 |
#var AnyInt FrictionDirection1 = X; |
|
|
59 |
#var AnyInt FrictionDirection2 = Y; |
|
|
60 |
|
|
|
61 |
AnyInt X = 0; |
|
|
62 |
AnyInt Y = 1; |
|
|
63 |
AnyInt Z = 2; |
|
|
64 |
|
|
|
65 |
AnyVar GlobalRotCoef = iffun(2-NormalDirection,1,0); // 0 if z is normal, if not 1 |
|
|
66 |
AnyVar RotCoefY = iffun(NormalDirection,0,1); |
|
|
67 |
AnyVar RotCoefX = iffun(NormalDirection,-1,0); |
|
|
68 |
|
|
|
69 |
AnyIntArray Direction = {NormalDirection,FrictionDirection1,FrictionDirection2}; //first element gives normal direction |
|
|
70 |
|
|
|
71 |
#include "ContactSurfaceDistanceAndVelocityDepLinPush.any" |
|
|
72 |
}; |