opensim-core
opensim-core copied to clipboard
added MocoImpulseTrackingGoal .cpp/.h
First attempt doing this, so apologies if it isn't correct!
Brief summary of changes
Created a MocoImpulseTrackingGoal (capable of tracking a single axis' impulse at a time; user must add multiple instances of the goal to track separate axes/separate contact groups. This goal is based on the MocoContactTrackingGoal, but instead of first squaring the error term and then summing, in this new goal we sum the errors and then square.
Testing I've completed
I have used the goal to perform tracking simulations with the 2Dwalking example - it seems to be working as anticipated.
CHANGELOG.md (choose one)
- Uncertain as to what to include here.
@nickbianco Hey, please review! :-)
I think my changes should now have been pushed back remotely with message "applied changes from review 1"
After addressing the comments above, there's a few more things we need to do to add this new goal to OpenSim:
- In
RegisterTypes_osimMoco.cpp
, you need to add theObject::registerType()
calls for bothMocoContactImpulseTrackingGoal
andMocoContactImpulseTrackingGoalGroup
. (Can you also add a call forMocoContactTrackingGoalGroup
underMocoContactTrackingGoal
here for me? This will fix the error you were seeing in Matlab for anyone loading aMocoContactTrackingGoal
from XML.) - Add an include statement in osimMoco.h :
#include "MocoGoal/MocoContactImpulseTrackingGoal.h"
- In this CMakeLists.txt file, add the .h/.cpp file for the new goal like the other goals listed.
- Add an include statement for the new goal in this file to add support for the goal in the bindings (Matlab and Python).
- Also for the bindings, add an include statement for the new goal in this file . Note the slightly different format for the include statements here.
Hey Nick,
Thanks for the input! It has been super helpful!!! I think I have made the changes you requested!
Great job @nicos1993! I'm happy with all of the code changes.
The last thing we need to do is some sort of testing to make sure everything works. For this goal, I think it's sufficient to perform some local tests. When CI builds pass, you can download a Windows artifact from GitHub actions that you install locally. Then you can run a test problem to make sure that the goal works though Matlab and/or Python.
Once that's done, we'll be good to merge.
Hi,
I can confirm I have locally tested on Windows. Modified the 2D walking example in Matlab to track vertical contact impulse from right and left feet - successfully converged.
Great job @nicos1993!
Great job @nicos1993!
Thanks for the help Nick!