Page 1 of 1

CoordinateCouplerConstraint with multiple independent variables

Posted: Thu Aug 04, 2022 10:13 am
by shayan0373n
Hi!

I would like to create a constraint to make the foot parallel to the ground. For that, I want to force the value of the ankle_flexion + (hip_flexion+knee_flexion) = 0, where the ankle joint is the dependent variable. To achieve this, I have created the following constraint in my model:

Code: Select all

<CoordinateCouplerConstraint name="foot_r_con">
    <!--Flag indicating whether the constraint is enforced or not.Enforced means that the constraint is active in subsequent dynamics realizations. NOTE: Prior to OpenSim 4.0, this behavior was controlled by the 'isDisabled' property, where 'true' meant the constraint was not being enforced. Thus, if 'isDisabled' is'true', then 'isEnforced' is false.-->
    <isEnforced>true</isEnforced>
    <!--Constraint function of generalized coordinates (to be specified) used to evaluate the constraint errors and their derivatives, and must valid to at least 2nd order. Constraint function must evaluate to zero when coordinates satisfy the constraint.-->
    <coupled_coordinates_function>
        <MultivariatePolynomialFunction>
            <coefficients> 0 1 1 </coefficients>
            <dimension>2</dimension>
            <order>1</order>
        </MultivariatePolynomialFunction>
    </coupled_coordinates_function>
    <!--List of names of the right hand side (independent) coordinates. Note the constraint function above, must be able to handle multiple coordinate values if more than one coordinate name is provided.-->
    <independent_coordinate_names>knee_FE_r hip_FE_r</independent_coordinate_names>
    <!--Name of the left-hand side (dependent) coordinate of the constraint coupling function.-->
    <dependent_coordinate_name>ankle_FE_r</dependent_coordinate_name>
    <!--Scale factor for the coupling function.-->
    <scale_factor>1</scale_factor>
</CoordinateCouplerConstraint>
But then this constraint doesn't work as expected, in the way that instead of changing the ankle angle as I change knee flexion, it changes hip flexion. Am I missing something?

Thank you in advance.

Best
Shayan