I'm looking to add a quadratic spring to my model, which can passively suspend a segment in horizontal equilibrium. I came across ExpressionBasedCoordinateForce in the forums, and was wondering if it is possible to set the expression using absolute signs? Otherwise I run into the following issue, assuming arbitrary stiffness of 30 & damping of 3, and a rest angle of 0.2:
Code: Select all
<ExpressionBasedCoordinateForce name="rotational_spring">
<!--Coordinate (name) to apply force to.-->
<coordinate>joint</coordinate>
<!--Expression of the force magnitude as a function of the coordinate value (q)and its time derivative (qdot). Note, expression cannot have any whitespace separating characters-->
<expression>-30*((q-0.2)^2)-3*qdot</expression>
</ExpressionBasedCoordinateForce>
Code: Select all
<expression>-30*(q-0.2)*(|q-0.2|)-3*qdot</expression>
Best wishes,
Pasha