How to add additional forces to existing MomentMeasure

Hi everyone,

I have substituted in my models the default knee joint with a 3-DOF custom joint (with the help of Michael Skipper Andersen at last year's advanced course, thanks again :slight_smile: ).
Now I'm trying to adapt all existing moment measure to account for the newly defined reaction forces, without creating new moment measures and without modifying the AMMR files (I'd like to avoid making a local copy of the AMMR, and rather keep using the locked installation directory).

If I add the forces to the AnyForceMomentMeasure2 directly

       Leg.MomentMeasure.KneeNetMoment = {
         AnyReacForce &jnt1a = ..Jnt.New3DOFKnee.Constraints.Reaction;
         AnyReacForce &jnt1b = ..Jnt.New3DOFKnee.RevoluteReacforces;

it tells me

ERROR(OBJ3) :   LegMoments.any(210)  :   KneeNetMoment  :  Member expectations are not satisfied :  IncludeForces AnyObjectPtr defined by script while AnyForceBase also found in AnyForceMomentMeasure2 Please use only one of these options

and similarly I cannot add them to the existing IncludeForces nor to the pointer pArrJntReactions, as they are already assigned in LegMoments.any and I get an illegal assignment error otherwise.

Any suggestion? Or should I just create new moment measures from scratch when using the new knee joint?


Hi @depierie

Is it possible for you to do something like:

AnyObjectPtrArray pArrJntReactions = {

In the LegMoments.any file?
That should add the two objects to the pointer array - you might need to tweak the path to the objects of course.

It probably depends a little on how tightly you want the new knee to be coupled with the ammr.

A note on using the installDir ammr:
That is normally not advised as it is typically read-only so you can run into trouble at a later instance.
Secondly, if you modify the installDir ammr, you will not be able to copy out a fresh version to work on. This can be a pain if you now alter the ammr to expect you new knee but later want to run models that does not need it.
The typical approach is to copy out the ammr to somewhere and then you can modify all you want - even cut out alle the files you don't need for a particular model/project if size is a issue.

Best regards,

Hi Bjorn,

thank you for your answer.

I think I will then just define some new MomentMeasures to mimic the default ones but with the new joint constraints included in the pointer.

I actually prefer to work with the read-only AMMR from the installation folder, so I cannot accidentally modify it. Instead I create custom applications that are pointing to the read-only AMMR version, whenever possible. So I don't have to worry about tracking custom (and accidental) modifications of AMMR, which would then have to be duplicated when an updated version is released, and we can more easily share the models across users.
Even though this requires a lot of #if and #include statements :slight_smile:

Thanks again and have a good day!

This topic was automatically closed 125 days after the last reply. New replies are no longer allowed.