URDF Workbench, robotics

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
fosselius
Posts: 381
Joined: Sat Apr 23, 2016 10:03 am
Contact:

URDF Workbench, robotics

Post by fosselius »

Hello i am working on some robotics projects and i do my modeling in FreeCAD.
I am playing around with the idea of a URDF workbench, I will be a kind of a simple subset of a assembly workbench.

I would like to build the URDF model in 3 steps,
1. create a link (http://wiki.ros.org/urdf/XML/link)
Either just create a pad from a dialog with h,w,l and some other parameters or use the bounding box of a existing FreeCAD model or mesh format file.

2. add joint(s) to the link (http://wiki.ros.org/urdf/XML/joint)
Visualize joint as a sphere with a disc in the middle. only 1 dim rotational joints to start with. disc shows rotation and can be a half moon to show a 180 degree joint.

3. mate a joint from the new link with a joint from a previous link (if it exists).
urdf.png
urdf.png (181.38 KiB) Viewed 17072 times
Then you repeat the steps until you save it as urdf (http://wiki.ros.org/urdf/XML/model)

this is an example of a simple URDF:
http://wiki.ros.org/urdf/Tutorials/Buil ... %20Scratch

I have started with the basics but i would like to hear some points on how i should implement this the best way? I think the new part design object structure might make this a lot easier.
Also can i save the project file as some kind of freecad format file? i think i might be able to use some of the code that is used in assembly2.

As a bonus, it would be great if i could play around with the degrees of freedom and do collision checks between two link meshes. I tested http://solvespace.com/ the other day and it was very cool to be able to trace a point and do collision checking of joints, will have to look at that code.
galou_breizh
Posts: 436
Joined: Wed Sep 15, 2010 9:38 am

Re: URDF Workbench, robotics

Post by galou_breizh »

Hi fosselius,

as a robotist, I'm very interested in such a workbench. For the modeling of the links, I would not use meshes, otherwise, we loose the interest of using FreeCAD over a mesh modeler. I would also not use the bounding box but rather geometry features such as circles and cylinders.

We can discuss further about it. Meanwhile, please have a look at Phobos https://github.com/rock-simulation/phobos. This is the similar module for Blender with URDF export.

Unless you really hurry, I would not invest too much time into it before the assembly module stabilizes. Until then, you would have to define your own type to represent joints, what can possibly take a lot of efforts. This would be mitigated by the fact that only serial or tree structures are supported in URDF for which simple matrix multiplications suffice to place links relative to each others.

Anyway, I'm glad that someone is willing to work about it. Thanks!

Cheers,
Gaël
User avatar
fosselius
Posts: 381
Joined: Sat Apr 23, 2016 10:03 am
Contact:

Re: URDF Workbench, robotics

Post by fosselius »

Ah, cool, had missed phobos! that will probably play well with MORSE https://www.openrobots.org/morse/doc/la ... morse.html

I will continue to work on my workbench as i want to be able to export / test the model in the same tool as i make the models.
I know its possible to use blender as a CAD program http://www.rab3d.com/tut_blender.php, but i still prefer FreeCAD.

Currently i am not sure how to object structure should be. The "joint" should just be a place holder for the coordinates and limits and a visual indication so i think the joints should be in the same "body" as the link. But i am unable to get two objects to render in the same "body" if they do not "touch" each other. is this a bug or a feature?

HowTo Replicate: create a sphere then add a disc to a body with "additive part" dialog, set coordinate system placement to be far enough away from each other to not touch. i guess "additive part" uses boolean join and brakes if the objects do not intersect. But i do not know how to add an object with a coordinate system inside a body in any other way..

for now i have the joint as a seperate body.
linkAndJoint.png
linkAndJoint.png (22.04 KiB) Viewed 17048 times
User avatar
NormandC
Veteran
Posts: 18587
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: URDF Workbench, robotics

Post by NormandC »

fosselius wrote:But i am unable to get two objects to render in the same "body" if they do not "touch" each other. is this a bug or a feature?
As far as I know it's a feature. A body should only contain a single body, that's the whole idea, if you need more than one you create a separate body.

But what you can do is to first create a Part, and then create multiple bodies inside the Part object. Each body has its own coordinate system, as well as the Part object above them.

With your file, you can add a Part, and then in the Model tree drag and drop Link1 and Joint1 over the Part.

At least that's how I think it's supposed to work. Even for most of us forum regulars here, it's a totally new work flow we need to learn.
User avatar
fosselius
Posts: 381
Joined: Sat Apr 23, 2016 10:03 am
Contact:

Re: URDF Workbench, robotics

Post by fosselius »

Of cause! :D thank you! so i mixed up part and body.

part > body > *mesh/shape* ex. box, pad etc..

One assembly can have several parts
One part can have several bodies
One body can only have one "mesh/shape"
ickby
Veteran
Posts: 3116
Joined: Wed Oct 05, 2011 7:36 am

Re: URDF Workbench, robotics

Post by ickby »

fosselius wrote:Of cause! :D thank you! so i mixed up part and body.

part > body > *mesh/shape* ex. box, pad etc..

One assembly can have several parts
One part can have several bodies
One body can only have one "mesh/shape"
close, but not exactly right. A body can not hold a mesh, it can only be used for solid shapes. It is bound very specificly to the PartDesign workbench where on handles solid shapes only. But Parts can hold meshes and every other freecad type so this should not be an issue.
User avatar
fosselius
Posts: 381
Joined: Sat Apr 23, 2016 10:03 am
Contact:

Re: URDF Workbench, robotics

Post by fosselius »

So i make progress i guess: https://youtu.be/56LOty4Yh1E
The new part structure makes my life very easy.
More stuff coming soon.
ickby
Veteran
Posts: 3116
Joined: Wed Oct 05, 2011 7:36 am

Re: URDF Workbench, robotics

Post by ickby »

Nice Progress! Just want to note that the new Part object in 0.17 development is not yet fixed and may change. For example nesting Parts currently breaks the sketcher. It is furthermore intended that Parts cannot hold other Parts and that for nesting stuff other "assembly objects" will be introduced. Not sure if this will happen but it could. So you should have that always in mind
ollydbg
Posts: 36
Joined: Thu Apr 07, 2016 2:54 pm

Re: URDF Workbench, robotics

Post by ollydbg »

fosselius wrote:So i make progress i guess: https://youtu.be/56LOty4Yh1E
The new part structure makes my life very easy.
More stuff coming soon.
Great job, I also try to construct some robot arm under FreeCAD, but before I see your video, I used the animation wb, see my post here: Re: rotation along a selected axis, but I use the "time" field to control the rotation. In your wb, you are using the native angle. ;)
User avatar
fosselius
Posts: 381
Joined: Sat Apr 23, 2016 10:03 am
Contact:

Re: URDF Workbench, robotics

Post by fosselius »

ickby wrote:Nice Progress! Just want to note that the new Part object in 0.17 development is not yet fixed and may change. For example nesting Parts currently breaks the sketcher. It is furthermore intended that Parts cannot hold other Parts and that for nesting stuff other "assembly objects" will be introduced. Not sure if this will happen but it could. So you should have that always in mind
Good to know that the sketcher breaks. was positively surprised that it did work. detected it by an accidental copy paste with a part selected.
Its fine and understandable if this behavior wont be supported in the future, just as long as a new structure is implemented/enabled before the support for the current part nesting is removed..
Post Reply