MarilynKeller / SMPL2AddBiomechanics

Enable inputting a SMPL sequence into AddBiomechanics to fit an OpenSim skeleton model to the sequence.
Other
78 stars 3 forks source link

Encounter error in AddBiomechanics processing #1

Closed hwy1992129 closed 9 months ago

hwy1992129 commented 9 months ago

Hi, thanks for your work. I encounter some issues on processing optimization in AddBiomechanics. Do you know how address the following error? I also posted the error in the forum of AddBiomechanics.

ERROR: Unwrapped joint pose is out of bounds at timestep 1214 of 2000. This means that we are trying to lowpass filter a joint angle that has wrapped around (for example, from 2PI back to 0, or from PI to -PI), and in "unwrapping" the joint angle to be continuous with the previous angle has caused it to go past the bound. Error joints are ['pelvis_tilt']
Writing OpenSim results
Writing the OpenSim result files...
Adjusting marker locations on scaled OpenSim file
Scaling OpenSim files: cd /tmp/tmpm8j60d9t/ && opensim-cmd run-tool /tmp/tmpm8j60d9t/rescaling_setup.xml
[info] Preparing to run ScaleTool.
[info] Processing subject optimized_scale_and_markers...
[info] Step 1: Loading generic model
[info] Updating Model file from 40000 to latest format...
[info] Loaded model FullBodyModel_MuscleActuatedLowerLimb_TorqueActuatedUpperBody from file /tmp/tmpm8j60d9t/unscaled_but_with_optimized_markers.osim
[warning] Couldn't find file 'sacrum.vtp'.
[warning] Couldn't find file 'r_femur.vtp'.
[warning] Couldn't find file 'r_fibula.vtp'.
[warning] Couldn't find file 'r_patella.vtp'.
[warning] Couldn't find file 'r_talus.vtp'.
[warning] Couldn't find file 'r_foot.vtp'.
[warning] Couldn't find file 'r_bofoot.vtp'.
[warning] Couldn't find file 'l_femur.vtp'.
[warning] Couldn't find file 'l_fibula.vtp'.
[warning] Couldn't find file 'l_patella.vtp'.
[warning] Couldn't find file 'l_talus.vtp'.
[warning] Couldn't find file 'l_foot.vtp'.
[warning] Couldn't find file 'l_bofoot.vtp'.
[warning] Couldn't find file 'cervical_spine.vtp'.
[warning] Couldn't find file 'lumbar_spine.vtp'.
[warning] Couldn't find file 'thorax.vtp'.
[warning] Couldn't find file 'scapula.vtp'.
[warning] Couldn't find file 'scapula_l.vtp'.
[warning] Couldn't find file 'humerus.vtp'.
[warning] Couldn't find file 'humerus_l.vtp'.
[warning] Couldn't find file 'ulna.vtp'.
[warning] Couldn't find file 'ulna_l.vtp'.
[warning] Couldn't find file 'radius.vtp'.
[warning] Couldn't find file 'radius_l.vtp'.
[warning] Couldn't find file 'lunate.vtp'.
[warning] Couldn't find file 'lunate.vtp'.
[warning] Couldn't find file 'lunate_l.vtp'.
[error] Failed to connect Socket 'parent_frame' of type PhysicalFrame (details: Component 'BLTI' could not find 'tibia_l' of type PhysicalFrame. Make sure a component exists at this path and that it is of the correct type.
    Thrown at Component.h:770 in getComponent().).
    In Object 'BLTI' of type Marker.
    Thrown at Component.cpp:310 in finalizeConnections().
[error] Unable to load the generic model or marker set file.
[error] ScaleTool: No model specified.
[error] ScaleTool: No model specified.
Traceback (most recent call last):
  File "/app/src/../../engine/src/engine.py", line 105, in <module>
    main()
  File "/app/src/../../engine/src/engine.py", line 84, in main
    subject.write_opensim_results(path + output_name,
  File "/engine/src/subject.py", line 1017, in write_opensim_results
    self.scale_osim(
  File "/engine/src/subject.py", line 978, in scale_osim
    shutil.copyfile(tmpdirname + 'optimized_scale_and_markers.osim',
  File "/usr/lib/python3.8/shutil.py", line 264, in copyfile
    with open(src, 'rb') as fsrc, open(dst, 'wb') as fdst:
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/tmpm8j60d9t/optimized_scale_and_markers.osim'
exit: 1

The link provided in README is not correct... Change "-" to "."... dev.addbiomechanics.org Could you provide the download link for case 01.zip? Thank you.

hwy1992129 commented 9 months ago

Hi, I got the answer from AddBiomechanics forum.

It was solved by prepending the Socket parent frame paths with "/bodyset/" for each Marker in the model. Change

<socket_parent_frame>tibia_l</socket_parent_frame>

to

<socket_parent_frame>/bodyset/tibia_l</socket_parent_frame>
davidpagnon commented 6 months ago

Hi @hwy1992129, did you manage to make it work? I cannot find your post on the forum, would you mind posting the link?

I'm personally hitting this issue: ValueError: Digital filter critical frequencies must be 0 < Wn < fs/2 (fs=30.014534883720934 -> fs/2=15.007267441860467)

hwy1992129 commented 6 months ago

Hi @hwy1992129, did you manage to make it work? I cannot find your post on the forum, would you mind posting the link?

I'm personally hitting this issue: ValueError: Digital filter critical frequencies must be 0 < Wn < fs/2 (fs=30.014534883720934 -> fs/2=15.007267441860467)

my post

davidpagnon commented 6 months ago

Thanks! And it worked seamlessly afterwards? Does it still work with the last Addbiomechanics web app?

hwy1992129 commented 6 months ago

Thanks! And it worked seamlessly afterwards? Does it still work with the last Addbiomechanics web app?

My issue is solved following the answer for the forum. I haven't touched it in recent months, I don't know any updates about it....

MarilynKeller commented 4 months ago

For info, I applied this fix to the bsm.osim downloadable from the SKEL website.

MarilynKeller commented 4 months ago

I'm personally hitting this issue: ValueError: Digital filter critical frequencies must be 0 < Wn < fs/2 (fs=30.014534883720934 -> fs/2=15.007267441860467)

For reference for future, a fix to this problem was proposed here.

hykong99 commented 4 months ago

My bsm.osim is /bodyset/tibia_l. But I encounter this same error. image

hykong99 commented 4 months ago

I think AddBiomechanics output Geometry is 'NAME.vtp'. But the GitHub Code uses the 'NAME.vtp.ply'. Past AddBiomechanics(24.05.30)'s result is 'NAME.vtp.ply', but current AddBiomechanics(24.07.17)'s result is 'NAME.vtp'. What is the correct Geometry?

MarilynKeller commented 4 months ago

So AddBiomechanics uses NimblePhysics to load the .osim file. The .osim file points to meshes that are .vtp files. But NimblePhysics effectively loads .ply files. So under the hood, if your .osim file points to tibia_r.vtp, NimblePhysics tries to load tibia_r.vtp.ply

This is why I released a version of Geometry with .vtp.ply meshes.

I am not sure why AddBiomechanics outputs a Geometry file with .vtp. Probably it is to be able to load the model in OpenSim as OpenSim will look for the .vtp files.

But to load the models with this GitHub repo, you should use the Geometry folder I provide containing the .vtp.ply files.

I hope this clarify.