RotationPenetrationCombiDriver_template

RotationPenetrationCombiDriver_template#

Create a combination driver that drives a rotation to prevent penetration in a box.

Listing 10 Include this file this file to use#
#include "<AMMR_TOOLS>\ModelUtilities/KinematicLimits/RotationPenetrationCombiDriver_template.any"`

#RotationPenetrationCombiDriver#

This class template can be used to set up soft drivers that drive rotational and linear measures to ensure that the rotational measure is normally at zero unless it deviates to prevent penetration of a target frame in a box shaped space.

The driver sets up two soft drivers, therefore overdeterminate analysis is needed. The first driver is a weak driver to drive the neutral angle measure. The second driver is a strong soft driver that prevents penetration in the box space.

The box space is defined specifying 4 points in counter clockwise sense. These points are used to define a boundary where the penetration prevention constraint is active and the plane formed by the four points is used to create the threshold for penetration. The positive direction is identified by the right hand rule through the 4 corner points, and negative direction is prevented. The penetration check is done only on one plane. The box is, therefore, open on the other side.

Use cases of such a combi driver can be flexion of toes in combination with the presence of ground. The driver will ensure that the toes stay normally at their neutral angle and extend only when necessary to prevent penetration with the floor, for e.g, at toe-off phase in gait. The corners can be used to create more complex scenarios like stairs. Another example could be to grab a box in combination with wrist flexion. The driver can be used to ensure that the wrist deviates from the neutral posture only when penetration with the box must be avoided.

HOW TO USE:#

The class template definition is already loaded through the libdef.any file. Simply use the RotationPenetrationCombiDriver class in your model.

In the following example we add a combination driver to MyKinematicMeasure and MyTargetFrame, which ensures neutral angle of the kinematic measure outside the box and prevents penetration of the target frame below the planar surface defined by the 4 corner points by allowing deviation in the kinematic measure.

Note

PLEASE ENSURE THAT THE TARGET FRAME IS ABOVE THE PENETRATION PLANE DEFINED BY THE CORNERS AND THE DEPTH LIMIT AT LOAD-TIME TO ENSURE KINEMATIC STABILITY.

Example

Main = {

  RotationPenetrationCombiDriver combo_driver(
      NEUTRAL_ANGLE_MEASURE = ..path.to.MyKinematicMeasure,
      TARGET_FRAME = ..path.to.MyTargetFrame,
   ) = {
         Corners = {
                     {0.0, 0.0, 0.0},
                     {0.0, 0.0, 0.5},
                     {0.5, 0.0, 0.5},
                     {0.5, 0.0, 0.0},
                    };
       }; 

Full signature

RotationPenetrationCombiDriver <ObjectName>(
  PLANE_BASE_FRAME=Main.EnvironmentModel.GlobalRef,
  NEUTRAL_ANGLE_MEASURE=<required>,
  TARGET_FRAME=<required>,
) = {
  Corners = <Required>; 
};

Arguments

__CLASS__:

AnyFolder

PLANE_BASE_FRAME:

The base frame on which the corners are specified (Default: Main.EnvironmentModel.GlobalRef)

NEUTRAL_ANGLE_MEASURE:

Kinematic measure to be driven to neutral value (Required)

TARGET_FRAME:

Target frame that will be checked for penetration with base frame (Required)

Required initialization members

Corners = <Required>;
class type:

AnyMatrix

Matrix with coordinates of 4 corner points

Optional initialization members

Settings.UsePlaneBordersForBoundsCheck = 1;
class type:

AnyVar

Switch to use the 4 corners for detecting within bounds (=1), or use an infinite plane (=0)

Settings.BoxVisibility = On;
class type:

AnySwitchVar

Switch to visualize lines connecting the 4 corners and the penetration plane

Settings.MeasureNeutralValue = 0.0;
class type:

AnyVar

Neutral value for the NEUTRAL_ANGLE_MEASURE

Settings.WeightNeutralAngleDriver = 1e-5;
class type:

AnyVar

Weak weight to drive the kinematic measure to neutral value

Settings.WeightBoxDriver = 1.0;
class type:

AnyVar

Weight of the driver preventing the penetration of the target frame

Settings.WeightWithinBoundsFun = 1.0;
class type:

AnyVar

Weight of function checking if target frame is within bounds of the 4 corners

Settings.DepthLowerLimit = 0.0;
class type:

AnyVar

Depth limit, measured from the corners, at which the penetration constraint kicks in

Settings.DepthLowerLimitHard = DepthLowerLimit - 0.01;
class type:

AnyVar

Hard depth limit, for ramping up the penetration penalty

Settings.ErrorAtDepthLowerLimitHard = 1.0;
class type:

AnyVar

Error at the hard depth limit