Skip to content

Conversation

@nicos1993
Copy link

@nicos1993 nicos1993 commented Apr 3, 2025

Fixes issue #4042

Brief summary of changes

@stingjp and myself have created a new class, MocoBushingForce. This class is based on the implementations of ExpressionBasedBushingForce (which works in Moco simulations) and BushingForce. It is essentially an implementation of a simple linear bushing, but to get around the issues we’ve found in the regular BushingForce class. MocoBushingForce calculates bushing stiffness and damping forces as per ExpressionBasedBushingForce, but without expressions. In addition, this new class permits stiffness and damping properties to be optimized as MocoParameters.

Testing I've completed

We have added a MocoBushingForce to the sliding mass example, the code compiles and the solution converges. We have compared the bushing force outputs when performing the same sliding mass example but using a MocoBushingForce or an ExpressionBasedBushingForce (constructed with the same parameters) and, as anticipated, the forces matched. Additionally, we have set up a MocoBushingForce parameter optimization and the solution converges. Lastly, we tested the bushing in the example2DWalking problem, and it leads to expected changes, and the problem converges well.

Looking for feedback on...

Is the class name okay? And the location we have currently included the class? We wanted to get something working in Moco, and this was the fastest way to do so, but there is a discussion for incorporating this into one of the existing classes rather than a stand-alone.

CHANGELOG.md

Should probably update the log to reflect that this class has been added, but we can do this right at the end.


This change is Reviewable

nicos1993 and others added 21 commits March 28, 2025 13:10
…rrors do to the joint calls, not getting the right types or something.
… that actuator must be activated longer in order to achieve the task of sliding the mass.

Co-authored-by: Nicos Haralabidis <[email protected]>
…mping component of the bushing. This allows the optimizer to change the damping coefficient - which effectively reduces it to zero, as one might expect.

Co-authored-by: Jon Stingel <[email protected]>
Co-authored-by: Nicos Haralabidis <[email protected]>
…ce. They are in agreement with both a spring and damper.

Co-authored-by: Jon Stingel <[email protected]>
Co-authored-by: Nicos Haralabidis <[email protected]>
Co-authored-by: Nicos Haralabidis <[email protected]
Co-authored-by: Jon Stingel <[email protected]>
Co-authored-by: Jon Stingel <[email protected]>

Co-authored-by: Nicos Haralabidis <[email protected]>
Co-authored-by: Jon Stingel <[email protected]>

Co-authored-by: Nicos Haralabidis <[email protected]>
Co-authored-by: Jon Stingel <[email protected]>

Co-authored-by: Nicos Haralabidis <[email protected]>
Co-authored-by: Jon Stingel <[email protected]>

Co-authored-by: Nicos Haralabidis <[email protected]>
Co-authored-by: Jon Stingel <[email protected]>

Co-authored-by: Nicos Haralabidis <[email protected]>
@nickbianco
Copy link
Member

@nicos1993, @stingjp, great work putting this together! I like starting from scratch to make sure that, when implemented correctly, a normal bushing force should work as expected.

Unfortunately, it doesn't make too much sense to have two bushing force classes in OpenSim essentially performing the same job. It would be ideal to track down the real issue with BushingForce. Based on this PR, it seems like the issue might actually have to do with TwoFrameLinker.

Now that you have a working environment, it would be interesting to run a debugger through your exampleSlidingMassWithBushing, except using the original BushingForce class to get a stack trace and pinpoint the exact moment of failure. Happy to take a look at it together.

@nickbianco
Copy link
Member

Closing, as this is now redundant with the already merged #4054.

@nickbianco nickbianco closed this Apr 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants