ExpressionBasedBushingForce definition

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Ryan Byrne
Posts: 28
Joined: Thu Jan 22, 2015 8:33 am

ExpressionBasedBushingForce definition

Post by Ryan Byrne » Fri Feb 09, 2018 9:15 pm

Hi everyone,

I was hoping someone could shed some light on this. I am trying to implement an ExpressionBasedBushingForce. The API says that the expressions should be in terms of the bushing deflections theta_x, theta_y, etc. The model successfully loads into OpenSim, but when running static optimization on the model I receive an error stating that there is "no value specified for theta_y". I thought that OpenSim would automatically recognize these variables. Do I need to define these variables somewhere in the .osim file? I'm having a hard time finding information on this in the API.

Code: Select all

<ExpressionBasedBushingForce name = "trialbushing">
					<isDisabled>false</isDisabled>
					<!--One of the two bodies connected by the bushing.-->
					<body_1>sacrum</body_1>
					<!--The other of the two bodies connected by the bushing.-->
					<body_2>lumbar5</body_2>
					<!--Location of bushing frame on body 1.-->
					<location_body_1>0 0.009 0</location_body_1>
					<!--Orientation of bushing frame in body 1 as x-y-z, body fixed Euler rotations.-->
					<orientation_body_1>0 0 0</orientation_body_1>
					<!--Location of bushing frame on body 2.-->
					<location_body_2>0 -0.018 0</location_body_2>
					<!--Orientation of bushing frame in body 2 as x-y-z, body fixed Euler rotations.-->
					<orientation_body_2>0 0 0</orientation_body_2>
					<Mx_expression>"1.5*theta_x+2.0*theta_y"</Mx_expression>
					<My_expression>"1.5*theta_x+2.0*theta_y"</My_expression>
					<Mz_expression>"1.5*theta_x+2.0*theta_y"</Mz_expression>
					<Fx_expression>"1.5*theta_x+2.0*theta_y"</Fx_expression>
					<Fy_expression>"1.5*theta_x+2.0*theta_y"</Fy_expression>
					<Fz_expression>"1.5*theta_x+2.0*theta_y"</Fz_expression>
				</ExpressionBasedBushingForce>

User avatar
Thomas Uchida
Posts: 1787
Joined: Wed May 16, 2012 11:40 am

Re: ExpressionBasedBushingForce definition

Post by Thomas Uchida » Sat Feb 10, 2018 1:06 pm

There is a test (testForces.cpp) that generates model files containing ExpressionBasedBushingForce components. I think you just need to remove the quotation marks from the expressions. Here are the relevant lines from the test file (note that this file was generated in OpenSim 4.0):

Code: Select all

<ExpressionBasedBushingForce name="translational_linear_bushing">
    <socket_frame1_connectee_name>base_body_offset</socket_frame1_connectee_name>
    <socket_frame2_connectee_name>ball_offset</socket_frame2_connectee_name>
    <frames>
        <PhysicalOffsetFrame name="base_body_offset">
            <socket_parent_connectee_name>base_body</socket_parent_connectee_name>
            <translation>0 0 0</translation>
            <orientation>0 0 0</orientation>
        </PhysicalOffsetFrame>
        <PhysicalOffsetFrame name="ball_offset">
            <socket_parent_connectee_name>ball</socket_parent_connectee_name>
            <translation>0 0 0</translation>
            <orientation>0 0 0</orientation>
        </PhysicalOffsetFrame>
    </frames>
    <Mx_expression>0.000000*theta_x</Mx_expression>
    <My_expression>0.000000*theta_y</My_expression>
    <Mz_expression>0.000000*theta_z</Mz_expression>
    <Fx_expression>10.000000*delta_x</Fx_expression>
    <Fy_expression>10.000000*delta_y</Fy_expression>
    <Fz_expression>10.000000*delta_z</Fz_expression>
    <rotational_damping>0 0 0</rotational_damping>
    <translational_damping>0 0 0</translational_damping>
</ExpressionBasedBushingForce>

POST REPLY