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

CREO2URDF – Add the possibility to run URDF generation from the terminal #53

Closed
FabioBergonti opened this issue Sep 8, 2023 · 10 comments · Fixed by #86
Closed

CREO2URDF – Add the possibility to run URDF generation from the terminal #53

FabioBergonti opened this issue Sep 8, 2023 · 10 comments · Fixed by #86
Assignees
Labels
domain-software Related to Software team-fix Related to Team Fix

Comments

@FabioBergonti
Copy link

It would be nice to have the possibility to generate the URDF from the terminal to automate their generation.

@Nicogene
Copy link
Member

I found this interesting link:

In particular we should call something like

call "%CREO_INSTALL_PATH%\Parametric\bin\parametric.exe" -g:no_graphics -batch_mode -i:rpc_input -RUN_MY_DESIRED_APPLICATION

I have to understand how to handle -RUN_MY_DESIRED_APPLICATION, how to pass to it the arguments(yml, csv) and how to open a specific assembly.

@Nicogene
Copy link
Member

The lack of an automatic generation from Github Action is becoming an issue since the number of maintained urdf is exploding:

@Nicogene
Copy link
Member

Nicogene commented Apr 5, 2024

First super draft PR, just the code backbone:

@Nicogene
Copy link
Member

Nicogene commented Apr 5, 2024

Habemus creo2urdf working from terminal! It is a first draft, the parsing is quite primitive, also because the Toolkit does not provide anything for parsing the parameters but today I managed to generate the urdf running this command line:

call "C:\Program Files\PTC\Creo 9.0.2.0\Parametric\bin\parametric.exe" -g:no_graphics -batch_mode -i:rpc_input creo2urdf +C:\Users\ngenesio\icub-tech-iit\cad-mechanics\projects\simulation_model\ergocub_1-1\sim_ergocub_1-1.asm +C:\Users\ngenesio\icub-tech-iit\cad-libraries\output_urdf\ERGOCUB_all_options.yaml +C:\Users\ngenesio\icub-tech-iit\cad-libraries\output_urdf\ERGOCUB_joint_all_parameters.csv +C:\Users\ngenesio\icub-tech-iit\cad-libraries\output_urdf

As you can see the - are used for passing the parameters to creo, the + are used for passing the parameters to the plugin, but then they are just plain C argc, argv, right now it is not very user friendly.

Moreover, I am using ProTKPrintf but nothing is diplayed on the windows command prompt, and it is not clear when the generation of the urdf finishes.

For debugging I used to open the GUI and write in the message window, but it is not an ideal solution

cc @pattacini @traversaro @FabioBergonti @mfussi66

@traversaro
Copy link
Member

Great!

@pattacini
Copy link
Member

Awesome!

@Nicogene

This comment was marked as outdated.

@mfussi66
Copy link
Member

mfussi66 commented Apr 5, 2024

Moreover, I am using ProTKPrintf but nothing is diplayed on the windows command prompt, and it is not clear when the generation of the urdf finishes.

Maybe you can check in the .bat if the file model.urdf exists to check for success?

@Nicogene
Copy link
Member

Nicogene commented Apr 5, 2024

Moreover, I am using ProTKPrintf but nothing is diplayed on the windows command prompt, and it is not clear when the generation of the urdf finishes.

Maybe you can check in the .bat if the file model.urdf exists to check for success?

Good idea, I will chatgpt-it :D

@Nicogene
Copy link
Member

Nicogene commented Apr 5, 2024

Following @pattacini advice:

I converted it into ps script, and this allowed me to improve it a lot:

  • I added a help section
  • I added the await of the finish of the urdf generation
  • I added names to the parameters
  • I added a final check about the existence of model.urdf after the command exits

Here is the help printed:


NAME
    C:\Users\ngenesio\icub-tech-iit\cad-libraries\run_creo2urdf.ps1

SYNOPSIS
    Converter for Creo assembly to URDF format.


SYNTAX
    C:\Users\ngenesio\icub-tech-iit\cad-libraries\run_creo2urdf.ps1 [[-asmPath] <String>] [[-yamlPath] <String>] [[-csvPath] <String>] [[-outputPath] <String>] [<CommonParameters>]


DESCRIPTION
    This script converts  Creo assembly to URDF format using the creo2urdf plugin.


RELATED LINKS

REMARKS
    To see the examples, type: "get-help C:\Users\ngenesio\icub-tech-iit\cad-libraries\run_creo2urdf.ps1 -examples".
    For more information, type: "get-help C:\Users\ngenesio\icub-tech-iit\cad-libraries\run_creo2urdf.ps1 -detailed".
    For technical information, type: "get-help C:\Users\ngenesio\icub-tech-iit\cad-libraries\run_creo2urdf.ps1 -full".

Here is how it is launched now:

.\run_creo2urdf.ps1 -asmPath "C:\Users\ngenesio\icub-tech-iit\cad-mechanics\projects\simulation_model\ergocub_1-1\sim_ergocub_1-1.asm" -yamlPath "C:\Users\ngenesio\icub-tech-iit\cad-libraries\output_urdf\ERGOCUB_all_options.yaml" -csvPath "C:\Users\ngenesio\icub-tech-iit\cad-libraries\output_urdf\ERGOCUB_joint_all_parameters.csv" -outputPath "C:\Users\ngenesio\icub-tech-iit\cad-libraries\output_urdf"

Here is the output:

Using asm path: C:\Users\ngenesio\icub-tech-iit\cad-mechanics\projects\simulation_model\ergocub_1-1\sim_ergocub_1-1.asm C:\Users\ngenesio\icub-tech-iit\cad-libraries\output_urdf\ERGOCUB_all_options.yaml
Using yaml path: C:\Users\ngenesio\icub-tech-iit\cad-libraries\output_urdf\ERGOCUB_all_options.yaml
Using csv path: C:\Users\ngenesio\icub-tech-iit\cad-libraries\output_urdf\ERGOCUB_joint_all_parameters.csv
Using output path: C:\Users\ngenesio\icub-tech-iit\cad-libraries\output_urdf
Conversion completed successfully. The URDF file is located at: C:\Users\ngenesio\icub-tech-iit\cad-libraries\output_urdf\model.urdf

Warning

This script has to be run in the cad-libraries folder to load the protk.dat

Until this will not become stable, this post will be the only documentation for using the plugin (ccing some people may use it cc @FabioBergonti @pillai-s @traversaro @xela-95 @mfussi66)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain-software Related to Software team-fix Related to Team Fix
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants