Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve exampleMocoTrack.py using setWeightForControlPattern #3841

Open
mrrezaie opened this issue Jul 7, 2024 · 0 comments
Open

Improve exampleMocoTrack.py using setWeightForControlPattern #3841

mrrezaie opened this issue Jul 7, 2024 · 0 comments
Assignees

Comments

@mrrezaie
Copy link
Contributor

mrrezaie commented Jul 7, 2024

Hi, I think these parts of the exampleMocoTrack.py code which increase the weight of ground-pelvis coordinate actuators can be improved

model = modelProcessor.process()
model.initSystem()
forceSet = model.getForceSet()
for i in range(forceSet.getSize()):
forcePath = forceSet.get(i).getAbsolutePathString()
if 'pelvis' in str(forcePath):
effort.setWeightForControl(forcePath, 10)

controlsWeightSet = osim.MocoWeightSet()
model = modelProcessor.process()
model.initSystem()
forceSet = model.getForceSet()
for i in range(forceSet.getSize()):
forcePath = forceSet.get(i).getAbsolutePathString()
if 'pelvis' in str(forcePath):
controlsWeightSet.cloneAndAppend(osim.MocoWeight(forcePath, 10))

by using MocoControlGoal::setWeightForControlPattern():

effort.setWeightForControlPattern('.*pelvis', 10)

Thank you.

@nickbianco nickbianco self-assigned this Aug 12, 2024
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

No branches or pull requests

2 participants