What's new
Hi all,

I would appreciate some advice on which path to take in order to achieve my goal. I want to load a robot that I designed in Alibre Design and train it using Reinforcement Learning. For that, I ultimately need to express it in URDF or SDF format.

I need to make an informed decision before I spend too much time and/or money on something that may not work, and I hope that you might have some helpful insights.

Here are my options as I see them:

1) Write an Alibre tool using the API that allows me to convert directly into URDF or SDF format.
- Pro(s): It would remove many steps for subsequent creations
- Con(s): It would be yet another language/framework I would have to master, and the information I have so far suggests that it might not be that straightforward to capture constraint information.

2) Wait for Alibre to write something.
- Pro(s): I wouldn't have to write it, and I could concentrate on the many other balls I have to juggle. Also, it would undoubtedly be a better product.
- Con(s): I could be waiting for something that may never materialize, particularly because I have no idea whether or not Alibre has an interest in tapping into a market (robotics) valued at US$ 26.52 Billion globally in 2022 with a CAGR of 10.5% between 2023 and 2030....hint, hint ;).

3) Pay for the standalone KeyShot Pro and attempt a conversion from Alibre Expert -> KeyShot Pro -> USD -> SDF -> PyBullet
- Pro(s): It's not the end of the world cost-wise (assuming it's a viable option), and maybe the textures would be preserved in the final model.
- Con(s): It's not clear to me whether or not any of the individual parts or link/constraint information would survive the conversion, and significant manual work could still be required.

4) Switch to or also use SolidWorks, OnShape, or Fusion 360 (I really don't want to do this)
- Pro(s): The functionality currently exists. The thought of creating something and pressing a button or defining things interactively in order to move to the next step seems like it would help the flow quite nicely.
- Con(s): Cost, subscription model, online storage, vendor lock, etc...

5) Painstakingly construct the URDF or SDF manually.
- Pro(s): No more $
- Con(s): Significant time and effort. My design isn't the most simple thing, and the effort to put all of the pieces and associations together is daunting.

6) Blender + Phobos?

Does anyone see any other options (such as some other conversion path), or have some advice/suggestions for me?

Thanks in advance,
Bruce
 
Last edited:

NateLiquidGravity

Alibre Super User
Since this has been asked I'm spending some time looking into it and found this interesting:
"the URDF specification forbids closed-chain model topologies, such as those of four-bar linkages and gear assemblies."
 
Interesting. It appears there's probably a way around some of this.

"...URDF uses a tree structure to represent robot kinematics, which does not permit closed loops like a 4-bar linkage. SDFormat is able to model closed kinematic loops because it uses a graph structure. Since gazebo converts URDF to SDF before loading, we can declare an SDFormat joint inside <gazebo> extension tags to close the loop. That joint will get added to the model after being converted to SDFormat." Gazebo Tutorial
 

NateLiquidGravity

Alibre Super User
Oh it looks like SDF is newer and intended to cover things missing or impossible in URDF.

Depending on how many (or how large a tree) you have to construct it might be quickest to write one from scratch. You would have to learn more to program it and probably type more too.
 

stepalibre

Alibre Super User
I don't have experience with the two formats, but from a CAD and programming point of view, here are some ideas.

1) export your files to OBJ or another 3D format for Unity3d/ros-sharp to work with URDF
- Pro: maybe easier to get up and running
- Con: you would need to use Unity3D
2) export your files to OBJ or another 3D format for Blender/Phobos to work in URDF or SDF
- Pro: maybe easier to get up and running. Phobos also has a CLI and Blender has a headless mode.
- Con: you would need to use Blender

Exporting files for Unity (ros-sharp) and Blender (Phobos) is probably a good 1st step to try since these tools are made to work with URDF and SDF and are free. They require you to learn at least the minimum necessary for your needs. You would simply export your design from AD and import into them using the features they provide for URDF and SDF work. You still need to add joints/constraints but this can be automated.

1) Write an Alibre tool using the API that allows me to convert directly into URDF or SDF format.

3) using ros-sharp, sdformat or another library with Alibre API to make a importer/exporter
- Pro: more control
- Con: more effort/time

It is possible to use components from ros-sharp specifically the parts that do import/export and URDF/SDF translating to build something for Alibre. RosBridgeClient appear to be the code that does some of that work. The code refers to Collada (dae) as the 3D file format it uses in the UrdfTransfer class. The formats are XML which makes it relatively straightforward to build reader/writers in many programming languages and tools.

3a) use ChatGPT/Bard to help
- Pro: can speed up development, problem solving and understanding
- Con: AI/LLM tools are useful generally but can be wrong and don't always give solutions that make sense or can provide inconsistent results even with the same input/prompt.
Some examples:

I can do some work to start an addon or tool for Alibre. At least a starting point project. Getting Alibre part and assembly information is straightforward, the hard part as I see it maybe the mapping to the format types and objects. Somehow storing/translating assembly constraint information and associations from Alibre to URDF/SDF. Learning from other exporters it may require a tool that maps bodies and design reference geometry to URDF/SDF specification. Using a naming convention can assist in automating the process.

Are the SolidWorks, Fusion or Onshape exporters adequate for your use case? If so I can use them as a reference.

 

MilesH

Alibre Super User
Oh it looks like SDF is newer and intended to cover things missing or impossible in URDF.

Depending on how many (or how large a tree) you have to construct it might be quickest to write one from scratch. You would have to learn more to program it and probably type more too.
See also:
https://docs.ros.org/en/kinetic/api/moveit_tutorials/html/doc/urdf_srdf/urdf_srdf_tutorial.html
https://tesseract-docs.readthedocs.io/en/latest/_source/intro/srdf_doc.html
 
I don't have experience with the two formats, but from a CAD and programming point of view, here are some ideas.

1) export your files to OBJ or another 3D format for Unity3d/ros-sharp to work with URDF
- Pro: maybe easier to get up and running
- Con: you would need to use Unity3D
2) export your files to OBJ or another 3D format for Blender/Phobos to work in URDF or SDF
- Pro: maybe easier to get up and running. Phobos also has a CLI and Blender has a headless mode.
- Con: you would need to use Blender

Exporting files for Unity (ros-sharp) and Blender (Phobos) is probably a good 1st step to try since these tools are made to work with URDF and SDF and are free. They require you to learn at least the minimum necessary for your needs. You would simply export your design from AD and import into them using the features they provide for URDF and SDF work. You still need to add joints/constraints but this can be automated.



3) using ros-sharp, sdformat or another library with Alibre API to make a importer/exporter
- Pro: more control
- Con: more effort/time

It is possible to use components from ros-sharp specifically the parts that do import/export and URDF/SDF translating to build something for Alibre. RosBridgeClient appear to be the code that does some of that work. The code refers to Collada (dae) as the 3D file format it uses in the UrdfTransfer class. The formats are XML which makes it relatively straightforward to build reader/writers in many programming languages and tools.

3a) use ChatGPT/Bard to help
- Pro: can speed up development, problem solving and understanding
- Con: AI/LLM tools are useful generally but can be wrong and don't always give solutions that make sense or can provide inconsistent results even with the same input/prompt.
Some examples:

I can do some work to start an addon or tool for Alibre. At least a starting point project. Getting Alibre part and assembly information is straightforward, the hard part as I see it maybe the mapping to the format types and objects. Somehow storing/translating assembly constraint information and associations from Alibre to URDF/SDF. Learning from other exporters it may require a tool that maps bodies and design reference geometry to URDF/SDF specification. Using a naming convention can assist in automating the process.

Are the SolidWorks, Fusion or Onshape exporters adequate for your use case? If so I can use them as a reference.


Your response is so information-dense that it might be difficult to respond to every piece directly :), but here are some of my thoughts:

1) I'm already working with several operating systems, many frameworks, a couple of languages (neither of which are in the .NET universe), and Alibre Design. What I really need are ways to simplify my workflow. The conversion of my design to (preferably) SDF would ideally be as simple as possible. Adding another platform and language is less than ideal for me but, in the absence of any other options, I'm going to have to do this conversion somehow, be it buy, build, or kluge together...preferably with help.

2) Of the few CAD programs that I'm aware of that currently produce URDF or SDF:
SolidWorks: I haven't used it, but I can currently rule it out because the cost is prohibitive. However, at some point in the not-too-distant future, my efforts and opportunity cost will surpass this.
Fusion 360: I came to Alibre Design from Fusion 360. Fusion 360 routinely ground to a halt for me, and my experience with it was quite frustrating. However, I never got to the URDF stage with it, so I can't really speak to what it's like to work with it from that point on.
OnShape: The onshape-to-robot addon looks EXTREMELY promising from the videos I've watched. It produces both URDF and SDF, and allows one to assign and view things interactively. For me, the attractiveness of the interactive approach lies mainly in the ability to see exactly where something is having difficulty...debugging on-the-fly. This interactivity wouldn't be absolutely necessary, IFF the output of a process works. If it doesn't work, a black box process makes it a lot harder to fix.

If I were forced to choose one, IMHO it would make sense to start by trying to emulate onshape-to-robot's functionality.

3) I find ROS to be very cumbersome, and anything that I can do to avoid ROS / gazebo at this point in time is attractive to me. I'm not saying that I won't eventually arrive at ROS, but I have so much to do, and PyBullet/gym is much more lightweight.

4) I previously tried using ChatGPT 4 to speed up my understanding of how to best code with the Alibre API, but it basically responded that it doesn't know it because it doesn't have access to proprietary APIs and is limited by its design constraints. It was able to provide some IronPython 2.7 suggestions, but the nitty-gritty of putting together meaningful code would probably require importing the Alibre API into ChatGPT, or making it public domain.

Cheers,
Bruce
 
Last edited:

stepalibre

Alibre Super User
I don't have the vocabulary for this area, but I understand things much better now. I'll fork onshape-to-robot to research a possible alibre-to-robot project.

4) I previously tried using ChatGPT 4 to speed up my understanding of how to best code with the Alibre API, but it basically responded that it doesn't know it because it doesn't have access to proprietary APIs and is limited by its design constraints. It was able to provide some IronPython 2.7 suggestions, but the nitty-gritty of putting together meaningful code would probably require importing the Alibre API into ChatGPT, or making it public domain.
Another way to think about LLMs is that they are programmable search engines/assistants. For better results in programming in particular you often need to train it through a very deep conversation as you use it when it lacks information about some code you have. It can learn from any text or code by naming conventions, such as how properties, methods, classes, etc., are named. It sees patterns and attempts to assemble something that resembles previous positive data from your chat or its database. When it's wrong I still learn something and it can assist in my understanding of my problem or task. I often use it not only to generate code but also to explain a code concept or problem. I then use that to help build a solution. I don't understand it technically but as a tool it is invaluable.

Even if the Alibre API (AlibreX.dll) is loaded into ChatGPT/OpenAI It will still give similar results because there isn't much working code on the internet or other sources to do meaningful training. I have done this for a subset of AlibreX classes and it is still not able to provide meaningful results without me guiding it along the way as complexity increases. If you ask it how to build a 10" pipe flange, providing it input data, and using the Alibre classes related, it will get the concept but getting working code mostly works without me guiding it much. It also does much better with Python than C# or Vb. I work in Rhino/Grasshopper, and generating code and solutions is much more successful although it is not without issues. This will obviously all change over time and improve. The same problems exist for AlibreScript, but being in Python, it has that as an advantage.

I also noticed after a while of using LLMs much of what they do is converting from one language where a solution may exist to another where a API may exist in another language. So in my make a 10" pipe flange example it will try to convert a known example to a unknown or new use case. In other words if you ask it to make a 10" pipe flange in RhinoPython and it works you can then tell it to do the same in Alibre API, SolidWorks API, SolidEdge API .,etc. with better results than to only ask for what you ultimately need.

P.S.
Some issues I encountered was related to the ChatGPT/OpenAI not using the correct methods or method parameters for some overloaded methods and not obeying case sensitivity in C# for some enums. Minor fixes not showstoppers, better than nothing and simple to cleanup. :)
 
Last edited:

stepalibre

Alibre Super User
I'm working on a plugin system and a easy addon install/uninstall system with git. Using GitHub for distribution. I made a URDFSDF-prototype addon I'll use to dev/test the system. I'll try out phobos (Python) to talk to .NET. I have a Blender addon so this will be better. I need to build things so it will be able to work in Rhino/Grasshopper, Godot and Dynamo my main tools. I share code across all my projects.

The prototype addon will include only the parts that I have knowledge in. I don't have any experience in robotics but I do want to learn the basics.
 
Top