IK Error: Incorrect number of keys

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Joseph Marsh
Posts: 11
Joined: Sun Jun 10, 2018 1:45 pm

IK Error: Incorrect number of keys

Post by Joseph Marsh » Wed Sep 12, 2018 10:30 am

I recently switched over to V4.0 of OpenSim, but have run into an error when running IK on a model that previously worked in OpenSim 3.3. I have gotten other models to work in V4.0 no problem, but something is up with this one.

The full error message is: "Incorrect number of keys. Expected =8. Received =7. Thrown at trcfileadapter.cpp:76 in extendRead()."

Curious if this is a problem with my files, or if it's a beat problem, or whatever it may be. Any help or advice is greatly appreciated!

- Joe

Tags:

User avatar
Colin Smith
Posts: 53
Joined: Fri Feb 24, 2012 11:50 am

Re: IK Error: Incorrect number of keys

Post by Colin Smith » Thu Sep 13, 2018 6:45 am

Check that the line in the .trc file that gives the meta data values (line 3 in example below) is separated by tabs and not spaces. I'm guessing you have one pair that has a space in between the values instead of a tab.

Most text editors have an option "View Whitespace" etc that will show you tabs vs spaces.

User avatar
Colin Smith
Posts: 53
Joined: Fri Feb 24, 2012 11:50 am

Re: IK Error: Incorrect number of keys

Post by Colin Smith » Thu Sep 13, 2018 6:48 am

Sorry forgot to post the file example:
Capture.JPG
Capture.JPG (56.26 KiB) Viewed 1223 times

User avatar
Joseph Marsh
Posts: 11
Joined: Sun Jun 10, 2018 1:45 pm

Re: IK Error: Incorrect number of keys

Post by Joseph Marsh » Thu Sep 13, 2018 6:08 pm

I gave that a shot, but it looks like I have everything tabbed out correctly. I compared it to a .trc file that I've gotten to work and format wise they were identical as far as I could tell. It is an error reading meta data from that .trc file so it's gotta be something in there somewhere. But that line 3 that you referenced looks good as far as I can tell.

I've been using Mokka as a reference tool quite a lot, and I can't open the file there either. It says that an error occurred during file reading, and the logger says "Unexpected exception occurred: Error during type conversion from a string." Don't know if that gives you a bit more context.
trc meta data.PNG
trc meta data.PNG (21.84 KiB) Viewed 1203 times

User avatar
Dimitar Stanev
Posts: 1096
Joined: Fri Jan 31, 2014 5:14 am

Re: IK Error: Incorrect number of keys

Post by Dimitar Stanev » Fri Sep 14, 2018 2:28 am

Maybe you should remove the path (C:\ ...) after (X/Y/Z) on the first line.

User avatar
Joseph Marsh
Posts: 11
Joined: Sun Jun 10, 2018 1:45 pm

Re: IK Error: Incorrect number of keys

Post by Joseph Marsh » Fri Sep 14, 2018 12:57 pm

Tried deleting the path, but I think I found the issue! I had to have somehow had the meta data inputs wrong somehow, but I got it working.

It looks like it was an old type of .trc file that only has 7 inputs to begin with, so I had to add the 8th by hand. For reference:

Old: DataRate->CameraRate->NumFrames->NumMarkers->Units->OrigDataRate->DataStartFrame
New: DataRate->CameraRate->NumFrames->NumMarkers->Units->OrigDataRate->OrigDataStartFrame->OrigNumFrames

The file still won't open in Mokka, but hey! It's working in opensim now. Thanks for all the help guys!

User avatar
Israel Luis
Posts: 11
Joined: Thu Oct 24, 2019 3:21 am

Re: IK Error: Incorrect number of keys

Post by Israel Luis » Sat Jul 18, 2020 1:39 pm

Hi Guys,

it was very useful for me as well. I had that problem but for scaling my model in Opensim 4.1. I had the same error "Incorrect number of keys".

I followed what Joseph mentioned and it worked. Here is my own:

DataRate CameraRate NumFrames NumMarkers Units OrigDataRate OrigDataStartFrame OrigNumFrames
100 100 394 57 mm 100 2 394

You need to also include the value of "OrigNumFrames" in the next row (394 for me), and it needs to be spaced by Tab, white space does not solve the issue.

POST REPLY