Skip to content

Commit

Permalink
fix: Range of Motion limit class template bug fix (#967)
Browse files Browse the repository at this point in the history
* Add check that lower limit is less than higher limit

* Fix order of default limits so that lower number is before the higher number.

* Update changelog
  • Loading branch information
divyaksh-chander authored May 22, 2024
1 parent 9fb98d4 commit 2184609
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
## AMMR 3.0.2 (2024-**-**)

### 🩹 Fixed:
* Fixed default limits in [Range of Motion limits](#Utilities.Kinematic-limits.RangeOfMotionLimits_template.any) class template. The default limits for PelvisThoraxExtension, PelvisThoraxLateralBending,
Right/LeftWristFlexion had the upper and lower limits flipped. This is now fixed and a check is added in the class template to catch this kind of error.
* Fixed a penetration warning for the pectoralis muscles when the thoracic segments is scaled very non-uniformly.
The fix involves a small (5 deg) adjustments to the orientation of the pectoralis wrapping surface.
* Fixed an issue where blinking Windows would appear when loading models stored
Expand Down
4 changes: 3 additions & 1 deletion Tools/ModelUtilities/KinematicLimits/KinLimit_template.any
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ float smoothramp(float edge0, float edge1, float x)

#var AnyVar LowerLimit;
#var AnyVar HighLimit;

AnyInt LowerHighCheck = assert(gteqfun(HighLimit, LowerLimit), "HighLimit must be greater than LowLimit: " + CompleteNameOf(ObjGetParent(1)));

#var AnyVar DriverPhaseIn = 0.01*(HighLimit - LowerLimit) ;
#var AnyVar LowerLimitHard= LowerLimit - DriverPhaseIn ;
Expand All @@ -109,7 +111,7 @@ AnyFunInterpol AbscissaFunction =
{
AnyFloat LowPhaseIn = abs(.LowerLimit-.LowerLimitHard);
AnyFloat HighPhaseIn = abs(.HighLimit-.HighLimitHard);
AnyFloat TotalRange = abs(.LowerLimitHard-.HighLimitHard);
AnyFloat TotalRange = abs(.LowerLimitHard-.HighLimitHard) + 0*.LowerHighCheck; // force calculation of LowerHighCheck before error in interpolation function.

#var Type = Bspline;
#var BsplineOrder = 8;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,10 @@ See below for more information on how to use the class.
{
//RangeOfMotionLimits.Limits.Trunk
/// The limits for PelvisThoraxExtension
#var AnyVector PelvisThoraxExtension = DesignVar({ 30, -80});
#var AnyVector PelvisThoraxExtension = DesignVar({ -80, 30});
//RangeOfMotionLimits.Limits.Trunk
/// The limits for PelvisThoraxLateralBending
#var AnyVector PelvisThoraxLateralBending = DesignVar({ 40, -40});
#var AnyVector PelvisThoraxLateralBending = DesignVar({ -40, 40});
//RangeOfMotionLimits.Limits.Trunk
/// The limits for PelvisThoraxRotation
#var AnyVector PelvisThoraxRotation = DesignVar({-90, 90});
Expand Down Expand Up @@ -201,7 +201,7 @@ See below for more information on how to use the class.
#var AnyVector ElbowPronation = DesignVar({-90, 90});
//RangeOfMotionLimits.Limits.Right
/// The limits for WristFlexion
#var AnyVector WristFlexion = DesignVar({90, -90});
#var AnyVector WristFlexion = DesignVar({-90, 90});
//RangeOfMotionLimits.Limits.Right
/// The limits for WristAbduction
#var AnyVector WristAbduction = DesignVar({-30, 30});
Expand Down Expand Up @@ -252,7 +252,7 @@ See below for more information on how to use the class.
#var AnyVector ElbowPronation = DesignVar({-90, 90});
//RangeOfMotionLimits.Limits.Left
/// The limits for WristFlexion
#var AnyVector WristFlexion = DesignVar({90, -90});
#var AnyVector WristFlexion = DesignVar({-90, 90});
//RangeOfMotionLimits.Limits.Left
/// The limits for WristAbduction
#var AnyVector WristAbduction = DesignVar({-30, 30});
Expand Down

0 comments on commit 2184609

Please sign in to comment.