Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question using osim_to_biomod #615

Closed
tiagocoelhoma opened this issue Feb 10, 2023 · 8 comments
Closed

Question using osim_to_biomod #615

tiagocoelhoma opened this issue Feb 10, 2023 · 8 comments

Comments

@tiagocoelhoma
Copy link

tiagocoelhoma commented Feb 10, 2023

Hi there!

Im having some problems using the converteed file from the osim_to_biomod tool. I will attach one file as example (from model leg39.osim). Please find the resulting (converted) file below:

legexample.txt (edit: txt format so I could upload it here)

I tried to use this file with a simple example to plot the results (for instace, custom_plotting.py) but I got the following error:

Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)

Ps: all ".vtp" files are installed within the project path

I dont know if it is a silly question (sorry for that). I will try to work on this but maybe you could give some insight.

Thank you for you attention!

@Ipuch
Copy link
Collaborator

Ipuch commented Feb 10, 2023

@aceglia could have a deeper look into it.
Should it be an issue in https://github.com/pyomeca/osim_to_biomod ?

As a first guess, I would try to execute a code with bioviz to check the result from the converter:

"""
This file is to display the human model into bioviz
"""
import bioviz

export_model = False
background_color = (1, 1, 1) if export_model else (0.5, 0.5, 0.5)
show_gravity_vector = False if export_model else True
show_floor = False if export_model else True
show_local_ref_frame = False if export_model else True
show_global_ref_frame = False if export_model else True
show_markers = False if export_model else True
show_mass_center = False if export_model else True
show_global_center_of_mass = False if export_model else True
show_segments_center_of_mass = False if export_model else True

model_name = "YOUR_MODEL.bioMod"
biorbd_viz = bioviz.Viz(
    model_name,
    show_gravity_vector=show_gravity_vector,
    show_floor=show_floor,
    show_local_ref_frame=show_local_ref_frame,
    show_global_ref_frame=show_global_ref_frame,
    show_markers=show_markers,
    show_mass_center=show_mass_center,
    show_global_center_of_mass=show_global_center_of_mass,
    show_segments_center_of_mass=show_segments_center_of_mass,
    mesh_opacity=1,
    background_color=background_color,
)
biorbd_viz.set_camera_position(-0.5, 3.5922578781963685, 0.1)
biorbd_viz.resize(1000, 1000)
if export_model:
    biorbd_viz.snapshot("doc/model.png")
biorbd_viz.exec()

@tiagocoelhoma
Copy link
Author

Sorry for that! I guess you are right and it should be an issue in https://github.com/pyomeca/osim_to_biomod

@pariterre
Copy link
Member

Dear @tiagocoelhoma
I did not code osim_to_biomod, so I cannot help much on that. That said, I had a very quick look at your file .txt. It seems that some of the values are "None". For instance :

ranges
				-1.5707963300000001 1.5707963300000001
				None
				None

which is indeed an invalid value. If you don't need the ranges, I suggest you simply remove them :)
PS: The file may content extra invalid lines (I did not have the time to run your file).

@aceglia
Copy link
Contributor

aceglia commented Feb 10, 2023

Dear @tiagocoelhoma,
Thank you for pointing out this error. I have fixed the problem in the PR [https://github.com/pyomeca/osim_to_biomod/pull/4] please try a model conversion to see if it fixes it. If not, please provide the .osim model so I can recreate the problem.

@tiagocoelhoma
Copy link
Author

Dear @aceglia ! Thank you for your reply.

I updated the file and tested it. Just to give a feedback on the script, besides "none" values are not shown anymore, I had to comment the "ranges" that had no values inserted on the generated file. For example, if the generated file has:

  ranges
  	//-1.5707963300000001 1.5707963300000001

in order to run, I had to comment "ranges". For my particular case, I'm not sure, however, if these specifics values (as the example above) should have been commented in my application. I'm reviewing if there is any utility on these values.

Another thing I should point out is that since the pin joint wasn't implemented (see error below) I had to try weld and custom joints to complete the conversion. As a result, some translation information between segments associated with this joint (eg, knee) is missed and the segments are superimposed.

Error: RuntimeError: Joint type PinJoint is not implemented yet.Allowed joint type are: ['WeldJoint', 'CustomJoint']

The original osim file is attatched below if you want to run it (.txt so i could upload it here)
gait10dof18musc_updt.txt

Thank you for your attention.

@pariterre
Copy link
Member

Just a quick reply for the ranges. As far as the computation are concerned, ranges are completely ignored. It is mostly used by bioviz (the vizualiser) to limit the slider to useful ranges. I let @aceglia answers the rest!

@aceglia
Copy link
Contributor

aceglia commented Feb 20, 2023

I've added a commit to the PR to fix the last problem with uncommented ranges in biomod.
Also, I'm sorry but I don't have time to add PinJoint in the osim_to_biomod code. If you find a way to do it easily, feel free to contribute to the osim_to_biomod github repo. Otherwise, please open an issue to add this type of joint and try to convert your joint to Custom with a single coordinate.
I hope I have answered your questions.

@pariterre
Copy link
Member

Closing since it relates to osim_to_biomod

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants