Analyze Moco Trajectory in C++

OpenSim Moco is a software toolkit to solve optimal control problems with musculoskeletal models defined in OpenSim using the direct collocation method.
POST REPLY
User avatar
Aaron Fox
Posts: 289
Joined: Sun Aug 06, 2017 10:54 pm

Analyze Moco Trajectory in C++

Post by Aaron Fox » Thu Aug 22, 2024 9:10 pm

Hi Moco Team,

I'm trying to apply the analyze() command to a Moco trajectory in C++ to get a model component output which is a SimTK Vector type. I get an error ('SimTK::VectorBase<ELT>::TNeg': cannot access private typedef declared in class 'SimTK::VectorBase<ELT>') with the following code:

Code: Select all

analyze<SimTK::Vector>(trackingModel, statesTable, controlsTable, outputsToGet).flatten()
I don't get the same error when I replace the SimTK::Vector type with others like SimTK::Vec3 or SimTK::SpatialVec - but then I obviously don't get any model outputs from the analysis. Is there any reason for why this is happening and how I might get the Vector out?

Aaron

User avatar
Nicholas Bianco
Posts: 1045
Joined: Thu Oct 04, 2012 8:09 pm

Re: Analyze Moco Trajectory in C++

Post by Nicholas Bianco » Tue Aug 27, 2024 2:39 pm

Hi Aaron,

I think the issue is that we currently don't support a TimeSeriesTable_<SimTK::Vector> in OpenSim, so it's not able to to construct the table of outputs.

What Output are you trying to compute?

-Nick

User avatar
Aaron Fox
Posts: 289
Joined: Sun Aug 06, 2017 10:54 pm

Re: Analyze Moco Trajectory in C++

Post by Aaron Fox » Tue Aug 27, 2024 4:33 pm

Hi Nick,

That makes sense given I could get various other types to work but not the Vector. I was trying to compute a new output from a custom class I've created - but have since realised that maybe a Vector isn't the best data type for an output in the end - or I might not end up using an output anymore for the class I was working on (I've been changing my mind a lot about it in the last few days!).

Thanks,

Aaron

POST REPLY