Page 1 of 1

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

Posted: Mon Jun 03, 2024 9:29 pm
by sivaprasad
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.

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

Posted: Tue Jun 04, 2024 10:42 am
by nbianco
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

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

Posted: Tue Jun 04, 2024 9:23 pm
by sivaprasad
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.

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

Posted: Wed Jun 05, 2024 9:23 am
by nbianco
Glad you found the error!