Calculation of joint forces in new coordinate system

Hello,
I want to use joint force data of the hip calculated from a MoCap Gait trial to move a robot. However, the coordinate systems of the robot and the model do not align.
I ceated a custom pelvis node and a custom thigh node that represent the coordinate system of the robot. Example for the pelvis one below:

Main.HumanModel.BodyModel.Trunk.SegmentsLumbar.PelvisSeg = {
AnyRefNode PelvisNodeISB = {
    
    // 1. ORIGIN
    sRel = .Right.HipJoint.sRel;

    // 2. LANDMARKS
    AnyVec3 RASIV = .Right.ASIS.sRel;
    AnyVec3 LASIV = .Left.ASIS.sRel;
    AnyVec3 RPSIV = .Right.PSIS.sRel;
    AnyVec3 LPSIV = .Left.PSIS.sRel;

    AnyVec3 ASIS_mid = (RASIV + LASIV) / 2.0;
    AnyVec3 PSIS_mid = (RPSIV + LPSIV) / 2.0;

    // 3. AXES CALCULATION
    AnyVec3 Z_raw = RASIV - LASIV;
    AnyVec3 Z_axis = Z_raw / vnorm(Z_raw);

    AnyVec3 Ant_raw = ASIS_mid - PSIS_mid;

    AnyVec3 Y_raw = cross(Z_axis, Ant_raw);
    AnyVec3 Y_axis = Y_raw / vnorm(Y_raw);

    AnyVec3 X_raw = cross(Y_axis, Z_axis);
    AnyVec3 X_axis = X_raw / vnorm(X_raw);

    // 4. COORDINATE SYSTEM DEFINITION
    ARel = {X_axis, Y_axis, Z_axis}';

    // 5. VISUALIZATION magenta
    AnyDrawRefFrame DrawISBFrame = {
        ScaleXYZ = {0.15, 0.15, 0.15};
        RGB = {1, 0, 1}; 
    };
};
};

Then I created a custom joint with these two nodes:

 
    AnyFolder CustomHipJoints = {

AnySphericalJoint RightHip = {
AnyRefNode &ThighNode = Main.HumanModel.BodyModel.Right.Leg.Seg.Thigh.ThighNodeISB;
    
    AnyRefNode &PelvisNode = Main.HumanModel.BodyModel.Trunk.SegmentsLumbar.PelvisSeg.PelvisNodeISB;
};


AnySphericalJoint LeftHip = {
    
    
    AnyRefNode &ThighNode = Main.HumanModel.BodyModel.Left.Leg.Seg.Thigh.HipJoint;
    
    AnyRefNode &PelvisNode = Main.HumanModel.BodyModel.Trunk.SegmentsLumbar.PelvisSeg.Left.HipJoint;
};
};

How do I get the joint force caluclations for this custom joint? It’s not automatically calculated during the inverse dynamics study.

Or is there a completely different approach?

Thanks in advance
Christoph

Hi Christoph,

From what I understand, you are trying to create a custom hip joint and replace the existing hip joint in the human body model. You seem to be on the right track. There is just a couple of points to check:

  1. Is the folder for your Custom Hip Joints included in the study?
  2. Is the default hip joint in the body model excluded from the study? Otherwise, you will run into kinematics error.

We have a body model configuration statement to allow users to create custom joint:

#define BM_JOINT_TYPE_HIP_RIGHT _JOINT_TYPE_USERDEFINED_

See the documentation here.

This BM statement will exclude the code related to the hip nodes and hip joints from the body model, and it is expected that the user creates a new hip joint.

I hope that helps.

Best regards,
Dave