Hello,
I am currently adding a new muscle model to OpenSim. I finished the first version of it and now I want to test my implementation.
Therefore I tried to simulate my muscle instead of the Millard muscle in the simple C++ example of https://github.com/opensim-org/opensim-core, which worked fine.
Now I additionaly added a triceps muscle and want to simulate an alternating movement with the setup.
Therefore, I want to implement a piecewise constant function which alternates between minimum and maximum activation for both muscles.
Unfortunately I was not able to define a PiecewiseConstantFunction.
How can such a function be defined in C++? Is there any example I could use to define this function?
Many thanks in advance for answering my question.
Best
Mike
Piecewise Constant Function in C++
- Mike Spahr
- Posts: 14
- Joined: Mon May 04, 2020 7:59 am
- Thomas Uchida
- Posts: 1787
- Joined: Wed May 16, 2012 11:40 am
Re: Piecewise Constant Function in C++
You can search the GitHub repo for "PiecewiseConstantFunction" (https://github.com/opensim-org/opensim- ... ntfunction). The class is used in PrescribedController.cpp (https://github.com/opensim-org/opensim- ... r.cpp#L217), buildHopperModel.cpp (https://github.com/opensim-org/opensim- ... l.cpp#L171), etc.
- Mike Spahr
- Posts: 14
- Joined: Mon May 04, 2020 7:59 am
Re: Piecewise Constant Function in C++
Thank you a lot this worked out for me!