I would like to use Moco to maximize the velocity of a certain body segment using MocoOutputGoal.
I am currently adding this as a goal to a tracking simulation with the following lines of code:
Code: Select all
study = track.initialize()
problem = study.updProblem()
bodySet = model.getBodySet()
hand = bodySet.get('hand_r')
hand_vel = hand.getOutput('velocity')
outputGoal = osim.MocoOutputGoal("hand_vel",1)
outputGoal.setOutputPath(hand_vel.getPathName())
problem.addGoal(outputGoal)
solution = study.solve()
"RuntimeError: std::exception in 'OpenSim::MocoSolution OpenSim::MocoStudy::solve() const': Bad dynamic_cast!"
However, if I do not add the MocoOutputGoal it runs just fine.
Any suggestions for how to fix this?
In addition, is it possible to specify a direction of velocity to maximize (i.e. the x component)?
Thanks!
Ty