Another approach to assembly solver (A2plus)

Discussion about the development of the Assembly workbench.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Turro75
Posts: 179
Joined: Mon Aug 15, 2016 10:23 pm

Re: Another approach to assembly solver (A2plus)

Post by Turro75 »

kbwbe wrote: Mon Jul 30, 2018 4:09 pm
Turro75 wrote: Mon Jul 30, 2018 12:31 pm Do You think You can skip move or rotation independently while solving?
Hi Turro,
i do not really know at moment. For coding, it is no problem. But in reality any "magnetic" rotation is inexact per calculation step somehow, and moves are necessary to correct some errors. So i do not know at moment, what will happen if trying this.

A very good thing would be, using your systematics to find the "candidates" for next partial system to solve. Is that possible ?
And, if your answer is yes, how to do this ?

Do you perhaps have some "pseudo-code" ideas ?
Sure we'll try, there is something You should implement to go straight to the next step, the grouped rigid.
When we find 2 rigid which are fully constrained on each other (is. a circular edge + lock rotation) we have to:
1) solve the constraints that involve only the 2 rigids and remove them from constraint list
2) create a new rigid which has a new center. May be a middle point between the 2 center?
3) the dep of the new rigid are the dep left unsolved, refpoint are the same.
4) every time one of the 2 rigids above are involved in a constraint, the rigid used by solver has to be the group.

Example: in the 6dof_assembly each piston-cylinder couple has 5dof lost, if You set lockrotation = True all DOF are lost so You can solve each piston-cylinder as a reduced set of rigid, create a new rigid group which has only 2 constraints : the spherical to both plates.
now the solver can work on 7 rigids as bottom plate is fixed instead of the 13 rigids if lockrotation is left False.

this, added to several other rules will help reducing the number of rigids involved on each step even when the chain started from a fixed part is somewhere broken.
kbwbe
Veteran
Posts: 1052
Joined: Tue Apr 10, 2018 3:12 pm
Location: Germany, near Köln (Cologne)

Re: Another approach to assembly solver (A2plus)

Post by kbwbe »

project4 wrote: Mon Jul 30, 2018 5:45 pm Hi guys,

Sorry for being less involved recently. There is a chance I'll have to step down from active involvement due to very big changes in my business that will require all of my time for some period.
Hi @project4,
saying it again: Thank you for all your work done within this project. I wish you the very best and good luck regarding the changes in your business. I would be glad to see you back here in some time if possible !
KBWBE

https://github.com/kbwbe/A2plus
latest release: v0.4.56, installable via FreeCAD's addon manager
Tutorial: gripper assembly https://www.youtube.com/watch?v=QMxcQ5tssWk
Documentation: https://www.freecadweb.org/wiki/A2plus_Workbench
project4
Posts: 237
Joined: Fri Jul 12, 2013 12:53 pm

Re: Another approach to assembly solver (A2plus)

Post by project4 »

kbwbe wrote: Mon Jul 30, 2018 6:30 pm
project4 wrote: Mon Jul 30, 2018 5:45 pm Hi guys,

Sorry for being less involved recently. There is a chance I'll have to step down from active involvement due to very big changes in my business that will require all of my time for some period.
Hi @project4,
saying it again: Thank you for all your work done within this project. I wish you the very best and good luck regarding the changes in your business. I would be glad to see you back here in some time if possible !
I'll stay here and will try to contribute with ideas, but probably won't have time to develop.
I still have the project pending that needs the assembly module, so I hope you could move it forward until I'll get back to that project.
kbwbe
Veteran
Posts: 1052
Joined: Tue Apr 10, 2018 3:12 pm
Location: Germany, near Köln (Cologne)

Re: Another approach to assembly solver (A2plus)

Post by kbwbe »

Turro75 wrote: Mon Jul 30, 2018 6:20 pm You should implement to go straight to the next step, the grouped rigid.
Hi Turro,
i will think about your suggestions. In case of 6DOF platform, it is easy to find a cylinder and a piston which can be combined. Two parts which are fully constrained to each other are forming a group. But we need additional rules, if a group consists of more parts. Maybe that the code has to be heavily modified to match groups of rigids.
KBWBE

https://github.com/kbwbe/A2plus
latest release: v0.4.56, installable via FreeCAD's addon manager
Tutorial: gripper assembly https://www.youtube.com/watch?v=QMxcQ5tssWk
Documentation: https://www.freecadweb.org/wiki/A2plus_Workbench
Turro75
Posts: 179
Joined: Mon Aug 15, 2016 10:23 pm

Re: Another approach to assembly solver (A2plus)

Post by Turro75 »

kbwbe wrote: Mon Jul 30, 2018 8:12 pm
Turro75 wrote: Mon Jul 30, 2018 6:20 pm You should implement to go straight to the next step, the grouped rigid.
Hi Turro,
i will think about your suggestions. In case of 6DOF platform, it is easy to find a cylinder and a piston which can be combined. Two parts which are fully constrained to each other are forming a group. But we need additional rules, if a group consists of more parts. Maybe that the code has to be heavily modified to match groups of rigids.
I agree that probably we won't find directly a group which is made by more than 2 rigids, but with the same strategy we would find a group fully constrained to another rigid or why not to another group. believe me a small group of 2 rigids or 2 groups is a good starting point. few small steps at a time. We only have to define a reliable way to get a rigid center.
Part booleans are not an option as rigids can be fully constrained on each other even without get in touch, we have to find an alternative
Turro75
Posts: 179
Joined: Mon Aug 15, 2016 10:23 pm

Re: Another approach to assembly solver (A2plus)

Post by Turro75 »

Turro75 wrote: Mon Jul 30, 2018 8:25 pm
kbwbe wrote: Mon Jul 30, 2018 8:12 pm
Turro75 wrote: Mon Jul 30, 2018 6:20 pm You should implement to go straight to the next step, the grouped rigid.
Hi Turro,
i will think about your suggestions. In case of 6DOF platform, it is easy to find a cylinder and a piston which can be combined. Two parts which are fully constrained to each other are forming a group. But we need additional rules, if a group consists of more parts. Maybe that the code has to be heavily modified to match groups of rigids.
I agree that probably we won't find directly a group which is made by more than 2 rigids, but with the same strategy we would find a group fully constrained to another rigid or why not to another group. believe me a small group of 2 rigids or 2 groups is a good starting point. few small steps at a time. We only have to define a reliable way to get a rigid center.
Part booleans are not an option as rigids can be fully constrained on each other even without get in touch, we have to find an alternative
Spoken too fast...
Part.Fusion does the job even if objs are separated. the resulting shape has a boundbox with its center. once found the center, deleting the fusion restore the single parts. it seems a little bit slow but it's not here we need performances.
kbwbe
Veteran
Posts: 1052
Joined: Tue Apr 10, 2018 3:12 pm
Location: Germany, near Köln (Cologne)

Re: Another approach to assembly solver (A2plus)

Post by kbwbe »

Turro75 wrote: Mon Jul 30, 2018 8:36 pm We only have to define a reliable way to get a rigid center.
This will not be the problem. We can calculate the spin center of a rigid group nearly same way as we are doing now for single rigid.
See function rigid.calcSpinCenter()

P.S.
Forgot to say: master branch is up to date with all changes until now. New branch "devel" is open...
KBWBE

https://github.com/kbwbe/A2plus
latest release: v0.4.56, installable via FreeCAD's addon manager
Tutorial: gripper assembly https://www.youtube.com/watch?v=QMxcQ5tssWk
Documentation: https://www.freecadweb.org/wiki/A2plus_Workbench
Turro75
Posts: 179
Joined: Mon Aug 15, 2016 10:23 pm

Re: Another approach to assembly solver (A2plus)

Post by Turro75 »

actually we need the center of rigid also to correctly handle pointidentity constraints.

just found a way without the need to use fusion

Code: Select all

cyl = App.activeDocument().Cylinder
box = App.activeDocument().Box
fusion = App.activeDocument().Fusion

bbCyl = cyl.Shape.BoundBox
bbBox = box.Shape.BoundBox
bbFusion = fusion.Shape.BoundBox


xmin = min(bbCyl.XMin, bbBox.XMin)
xmax = max(bbCyl.XMax, bbBox.XMax)

ymin = min(bbCyl.YMin, bbBox.YMin)
ymax = max(bbCyl.YMax, bbBox.YMax)

zmin = min(bbCyl.ZMin, bbBox.ZMin)
zmax = max(bbCyl.ZMax, bbBox.ZMax)

center1 = FreeCAD.Vector((xmin+xmax)/2.0, (ymin+ymax)/2.0, (zmin+zmax)/2.0)
print center1
print bbFusion.Center
Attachments
testrigidcenter.FCStd
(6.34 KiB) Downloaded 31 times
kbwbe
Veteran
Posts: 1052
Joined: Tue Apr 10, 2018 3:12 pm
Location: Germany, near Köln (Cologne)

Re: Another approach to assembly solver (A2plus)

Post by kbwbe »

Hi @all,

find updated version at github.
- bug during creation of a constrained has been fixed. After creating a new constraint the mirrored constraint was missing
- after deleting imported parts and using FreeCAD's undo functionality, the tree view is now automatically repaired.
KBWBE

https://github.com/kbwbe/A2plus
latest release: v0.4.56, installable via FreeCAD's addon manager
Tutorial: gripper assembly https://www.youtube.com/watch?v=QMxcQ5tssWk
Documentation: https://www.freecadweb.org/wiki/A2plus_Workbench
kbwbe
Veteran
Posts: 1052
Joined: Tue Apr 10, 2018 3:12 pm
Location: Germany, near Köln (Cologne)

Re: Another approach to assembly solver (A2plus)

Post by kbwbe »

Hi @all,
find feature update at github.

Solving of constraints can now be undone by FreeCAD's UNDO/REDO system.

If solving the constraints let you get undesired positions of your parts, simple hit FreeCAD's undo button. Your assembly looks again like before the wrong operation.
KBWBE

https://github.com/kbwbe/A2plus
latest release: v0.4.56, installable via FreeCAD's addon manager
Tutorial: gripper assembly https://www.youtube.com/watch?v=QMxcQ5tssWk
Documentation: https://www.freecadweb.org/wiki/A2plus_Workbench
Post Reply