MoCoInverse: GCVSpline: there should be 6 or more data points, error.

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
Sivaprasad Kunnath
Posts: 11
Joined: Mon Jun 03, 2024 2:13 am

MoCoInverse: GCVSpline: there should be 6 or more data points, error.

Post by Sivaprasad Kunnath » Mon Jun 03, 2024 9:29 pm

I am running mocoInverse in C++ using the OpenSim Moco API. When I attempt to run the study in Microsoft Visual Studio 2017, I encounter an error. I have verified that my input files conform to the standard format, and they work correctly within the OpenSim GUI. Despite this, I receive the following error when running the code in Visual Studio.

[error] GCVSpline: there must be 6 or more data points.
[error] GCVSpline: there must be 6 or more data points.
[error] GCVSpline: there must be 6 or more data points.
[error] GCVSpline: there must be 6 or more data points.
[info] Storage: read data file = C:\Users\ksiva\OneDrive\Desktop\Semester 4\Capstone\Simulation Framework\ID\IK\UpAndStopAndDown0.5s_ConstForceLoad.sto (nr=604 nc=7)
[info] ExternalForce::externalforce Data source being set to UpAndStopAndDown0.5s_ConstForceLoad.sto
Exception: SimTK Exception thrown at GCVSPLUtil.h:81:
Bad call to Simbody API method GCVSPLUtil::gcvspl(): Too few data points
(Required condition 'n >= 2*m' was not met.)

C:\Users\ksiva\OneDrive\Desktop\Semester 4\Capstone\Simulation Framework\ID\build\Release\OSimTrial.exe (process 47188) exited with code 1.

I checked the .sto file and found that there are 6 data points for a single force point which shouldn't give this error. Can anyone guide me on how to troubleshoot the error.
Thanks for the support.
Attachments
GCVSpline error.png
GCVSpline error.png (125.15 KiB) Viewed 923 times

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

Re: MoCoInverse: GCVSpline: there should be 6 or more data points, error.

Post by Nicholas Bianco » Tue Jun 04, 2024 10:42 am

Hi Sivaprasad,

That error is likely because you do not have enough time points in your data file "UpAndStopAndDown0.5s_ConstForceLoad.sto". How many rows does that file have?

Best,
Nick

User avatar
Sivaprasad Kunnath
Posts: 11
Joined: Mon Jun 03, 2024 2:13 am

Re: MoCoInverse: GCVSpline: there should be 6 or more data points, error.

Post by Sivaprasad Kunnath » Tue Jun 04, 2024 9:23 pm

Hey Nicholas,

Thank you for your support. The file had six columns and approximately 1,200 rows. I discovered that the issue was due to a blank line between the labels and the values, causing the program to attempt to fetch data but finding no values due to the empty line.

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

Re: MoCoInverse: GCVSpline: there should be 6 or more data points, error.

Post by Nicholas Bianco » Wed Jun 05, 2024 9:23 am

Glad you found the error!

POST REPLY