Another approach to assembly solver (A2plus)

Discussion about the development of the Assembly workbench.
kbwbe
Posts: 938
Joined: Tue Apr 10, 2018 3:12 pm
Location: Germany, near Köln (Cologne)

Re: Another approach to assembly solver (A2plus)

Postby kbwbe » Sun Aug 05, 2018 1:47 pm

@manuelkrause

Hi Manuel,
your are right. There is an issue that's solving of circularEdgeConstraints (and axisConstraint, perhaps more) is not working correct.
Iteration stops to early with message "system solved". But it is'nt.
The bug is already in branch "automatic-solver-mode-switching". You do not need to test it.
It seems to be some longer time within code. I will go back in versions until it is working again. I am curious at which point this happened.
KBWBE

https://github.com/kbwbe/A2plus
latest release: v0.4.43a, 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
Posts: 938
Joined: Tue Apr 10, 2018 3:12 pm
Location: Germany, near Köln (Cologne)

Re: Another approach to assembly solver (A2plus)

Postby kbwbe » Sun Aug 05, 2018 3:08 pm

@manuelkrause, @turro75

Hi Manuel + Turro,
severe bug is found. It was in code since 2018-07-24. Rotation is working again. I had to update all branches.

Hi @all,
master-branch is updated. The new version is recommended for using now.

What's new:
- several bugfixes
- solver switches automatically from method "partial system" to "magnetic/alltogether" method, if "partial" is not possible.
KBWBE

https://github.com/kbwbe/A2plus
latest release: v0.4.43a, 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: 175
Joined: Mon Aug 15, 2016 10:23 pm

Re: Another approach to assembly solver (A2plus)

Postby Turro75 » Sun Aug 05, 2018 3:34 pm

kbwbe wrote:
Sun Aug 05, 2018 3:08 pm
@manuelkrause, @turro75

Hi Manuel + Turro,
severe bug is found. It was in code since 2018-07-24. Rotation is working again. I had to update all branches.

Hi @all,
master-branch is updated. The new version is recommended for using now.

What's new:
- several bugfixes
- solver switches automatically from method "partial system" to "magnetic/alltogether" method, if "partial" is not possible.
ok thanks
User avatar
manuelkrause
Posts: 442
Joined: Thu Jul 05, 2018 7:16 pm

Re: Another approach to assembly solver (A2plus)

Postby manuelkrause » Sun Aug 05, 2018 4:44 pm

kbwbe wrote:
Sun Aug 05, 2018 3:08 pm
@manuelkrause, @turro75

Hi Manuel + Turro,
severe bug is found. It was in code since 2018-07-24. Rotation is working again. I had to update all branches.

Hi @all,
master-branch is updated. The new version is recommended for using now.

What's new:
- several bugfixes
- solver switches automatically from method "partial system" to "magnetic/alltogether" method, if "partial" is not possible.
@kbwbe:
Hi Klaus,

really great work, thank you!
I've just re-assembled with the same steps like last night (with actual devel-branch) and all is working fine, no errors, and is pretty fast.

Manuel
kbwbe
Posts: 938
Joined: Tue Apr 10, 2018 3:12 pm
Location: Germany, near Köln (Cologne)

Re: Another approach to assembly solver (A2plus)

Postby kbwbe » Mon Aug 06, 2018 9:51 pm

@Turro75, @project4, @manuelkrause

i welcome new team member @wandererfan. :D

Find updated branches at github.

What's new:
- modular toolbar
- new icons
KBWBE

https://github.com/kbwbe/A2plus
latest release: v0.4.43a, 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: 175
Joined: Mon Aug 15, 2016 10:23 pm

Re: Another approach to assembly solver (A2plus)

Postby Turro75 » Thu Aug 09, 2018 8:53 am

Hey Guys

I'm currently on vacation (writing this at the beach), just to say that this afternoon or later tonight I'll send the new logic solver based on dof. It is already able to solve almost everything. I have to optimize it a lot as at the moment is slower than "all together", sure I inserted too much debugging and redundant operation.

So stay tuned!

@Kbwbe

I'm working on latest devel branch.
User avatar
Kunda1
Posts: 6489
Joined: Thu Jan 05, 2017 9:03 pm

Re: Another approach to assembly solver (A2plus)

Postby Kunda1 » Thu Aug 09, 2018 11:04 am

That's how you know someone is doing something they love enough to be at the beach/vacation and coding a solver for an open source Assembly WB. Cheers!
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
Turro75
Posts: 175
Joined: Mon Aug 15, 2016 10:23 pm

Re: Another approach to assembly solver (A2plus)

Postby Turro75 » Thu Aug 09, 2018 1:40 pm

Ok I have no time to learn github, I'll do , promised.
in the meanwhile who want try it, there is a first review of dof solver, simply overwrite the files (current master/devel only) and test them.

the output is now quite extensive, at first it analyze the assembly and show the dof and which obj is linked to:

Code: Select all

Solvermode = partialProcessing !

Current Rigid = tube100_001
    is not Fixed and has 0 DegreesOfFreedom
    Depends on Rigid = turning_90deg_001
        Dependencies between tube100_001-turning_90deg_001, type circularEdge
        DOF Position free with this rigid = 0
        DOF Rotation free with this rigid = 1
    Depends on Rigid = MainBody_001
        Dependencies between tube100_001-MainBody_001, type circularEdge
        DOF Position free with this rigid = 0
        DOF Rotation free with this rigid = 0

Current Rigid = MainBody_001
    is Fixed

Current Rigid = turning_90deg_001
    is not Fixed and has 0 DegreesOfFreedom
    Depends on Rigid = tube100_002
        Dependencies between turning_90deg_001-tube100_002, type circularEdge
        DOF Position free with this rigid = 0
        DOF Rotation free with this rigid = 0
    Depends on Rigid = MainBody_001
        Dependencies between turning_90deg_001-MainBody_001, type planesParallel
        DOF Position free with this rigid = 3
        DOF Rotation free with this rigid = 1
    Depends on Rigid = tube100_001
        Dependencies between turning_90deg_001-tube100_001, type circularEdge
        DOF Position free with this rigid = 0
        DOF Rotation free with this rigid = 1

Current Rigid = tube100_002
    is not Fixed and has 0 DegreesOfFreedom
    Depends on Rigid = tube100_003
        Dependencies between tube100_002-tube100_003, type circularEdge
        DOF Position free with this rigid = 0
        DOF Rotation free with this rigid = 0
    Depends on Rigid = turning_90deg_001
        Dependencies between tube100_002-turning_90deg_001, type circularEdge
        DOF Position free with this rigid = 0
        DOF Rotation free with this rigid = 0

Current Rigid = tube100_003
    is not Fixed and has 0 DegreesOfFreedom
    Depends on Rigid = turning_90deg_002
        Dependencies between tube100_003-turning_90deg_002, type circularEdge
        DOF Position free with this rigid = 0
        DOF Rotation free with this rigid = 1
    Depends on Rigid = tube100_002
        Dependencies between tube100_003-tube100_002, type circularEdge
        DOF Position free with this rigid = 0
        DOF Rotation free with this rigid = 0

Current Rigid = turning_90deg_002
    is not Fixed and has 0 DegreesOfFreedom
    Depends on Rigid = tube100_004
        Dependencies between turning_90deg_002-tube100_004, type circularEdge
        DOF Position free with this rigid = 0
        DOF Rotation free with this rigid = 0
    Depends on Rigid = tube100_003
        Dependencies between turning_90deg_002-tube100_003, type circularEdge
        DOF Position free with this rigid = 0
        DOF Rotation free with this rigid = 1

Current Rigid = tube100_004
    is not Fixed and has 0 DegreesOfFreedom
    Depends on Rigid = turning_90deg_003
        Dependencies between tube100_004-turning_90deg_003, type circularEdge
        DOF Position free with this rigid = 0
        DOF Rotation free with this rigid = 1
    Depends on Rigid = turning_90deg_002
        Dependencies between tube100_004-turning_90deg_002, type circularEdge
        DOF Position free with this rigid = 0
        DOF Rotation free with this rigid = 0

Current Rigid = tube100_005
    is not Fixed and has 1 DegreesOfFreedom
    Depends on Rigid = SmallBody_001
        Dependencies between tube100_005-SmallBody_001, type circularEdge
        DOF Position free with this rigid = 0
        DOF Rotation free with this rigid = 1
    Depends on Rigid = turning_90deg_003
        Dependencies between tube100_005-turning_90deg_003, type circularEdge
        DOF Position free with this rigid = 0
        DOF Rotation free with this rigid = 1

Current Rigid = SmallBody_001
    is not Fixed and has 0 DegreesOfFreedom
    Depends on Rigid = tube100_005
        Dependencies between SmallBody_001-tube100_005, type circularEdge
        DOF Position free with this rigid = 0
        DOF Rotation free with this rigid = 1
    Depends on Rigid = LastBody
        Dependencies between SmallBody_001-LastBody, type circularEdge
        DOF Position free with this rigid = 0
        DOF Rotation free with this rigid = 1
    Depends on Rigid = MainBody_001
        Dependencies between SmallBody_001-MainBody_001, type plane
        DOF Position free with this rigid = 2
        DOF Rotation free with this rigid = 1

Current Rigid = LastBody
    is not Fixed and has 1 DegreesOfFreedom
    Depends on Rigid = SmallBody_001
        Dependencies between LastBody-SmallBody_001, type circularEdge
        DOF Position free with this rigid = 0
        DOF Rotation free with this rigid = 1

Current Rigid = turning_90deg_003
    is not Fixed and has 0 DegreesOfFreedom
    Depends on Rigid = tube100_005
        Dependencies between turning_90deg_003-tube100_005, type circularEdge
        DOF Position free with this rigid = 0
        DOF Rotation free with this rigid = 1
    Depends on Rigid = tube100_004
        Dependencies between turning_90deg_003-tube100_004, type circularEdge
        DOF Position free with this rigid = 0
        DOF Rotation free with this rigid = 1

Current Rigid = turning_90deg_004
    is not Fixed and has 1 DegreesOfFreedom
    Depends on Rigid = MainBody_001
        Dependencies between turning_90deg_004-MainBody_001, type plane
        Dependencies between turning_90deg_004-MainBody_001, type plane
        DOF Position free with this rigid = 1
        DOF Rotation free with this rigid = 0
there are 14 dependencies

then it starts solving by using 5 stages:

stage1 and stage2 try to solve only constraints linked to fixed/tempfixed objs, as stage1 set as tempfixed the solved obj, tage1 and stage2 are repeated until there are obj that match the rules.

stage 3 and stage 4 are dedicated to subassemblies and small group of fully constrained obj but not to tempfixed objs. ATM not implemented.

stage 5, everything else is solved all together.

Code: Select all

evaluating stage = 1
Tempfixed objs:
    MainBody_001
        Dependencies between tube100_001-MainBody_001, type circularEdge
        Solve them!
        Dependencies between turning_90deg_001-MainBody_001, type planesParallel
        Dependencies between turning_90deg_001-tube100_001, type circularEdge
        Solve them!
        Dependencies between tube100_002-turning_90deg_001, type circularEdge
        Solve them!
        Dependencies between tube100_003-tube100_002, type circularEdge
        Solve them!
evaluating stage = 2
Tempfixed objs:
    tube100_001
    MainBody_001
    turning_90deg_001
    tube100_002
    tube100_003
        Dependencies between turning_90deg_004-MainBody_001, type plane
        Dependencies between turning_90deg_004-MainBody_001, type plane
        solve them!
evaluating stage = 1
Tempfixed objs:
    tube100_001
    MainBody_001
    turning_90deg_001
    tube100_002
    tube100_003
    turning_90deg_004
evaluating stage = 2
Tempfixed objs:
    tube100_001
    MainBody_001
    turning_90deg_001
    tube100_002
    tube100_003
    turning_90deg_004
evaluating stage = 3
Tempfixed objs:
    tube100_001
    MainBody_001
    turning_90deg_001
    tube100_002
    tube100_003
    turning_90deg_004
evaluating stage = 4
Tempfixed objs:
    tube100_001
    MainBody_001
    turning_90deg_001
    tube100_002
    tube100_003
    turning_90deg_004
evaluating stage = 5
Tempfixed objs:
    tube100_001
    MainBody_001
    turning_90deg_001
    tube100_002
    tube100_003
    turning_90deg_004
        Dependencies between turning_90deg_002-tube100_003, type circularEdge
        Dependencies between turning_90deg_002-tube100_004, type circularEdge
        Dependencies between tube100_004-turning_90deg_003, type circularEdge
        Dependencies between tube100_005-SmallBody_001, type circularEdge
        Dependencies between tube100_005-turning_90deg_003, type circularEdge
        Dependencies between SmallBody_001-LastBody, type circularEdge
        Dependencies between SmallBody_001-MainBody_001, type plane
===== System solved ! ====== 
the Assembly-platform-6DOF doesn't match anything so everything is solved in the stage5, this behavior is equivalent to "magnetic" mode.

ATM there is no difference from parent/children, only tempfixed/constrained objs make sense.

let me know, I expect bugs.
Attachments
a2p_solversystem.py
(25.53 KiB) Downloaded 8 times
a2p_rigid.py
(17.47 KiB) Downloaded 7 times
a2p_libDOF.py
(26.16 KiB) Downloaded 7 times
a2p_dependencies.py
(27.36 KiB) Downloaded 7 times
kbwbe
Posts: 938
Joined: Tue Apr 10, 2018 3:12 pm
Location: Germany, near Köln (Cologne)

Re: Another approach to assembly solver (A2plus)

Postby kbwbe » Thu Aug 09, 2018 2:06 pm

Hi @Turro75,
thank you. I will test it soon and give feedback.
Enjoy your holiday :D
KBWBE

https://github.com/kbwbe/A2plus
latest release: v0.4.43a, 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
Posts: 938
Joined: Tue Apr 10, 2018 3:12 pm
Location: Germany, near Köln (Cologne)

Re: Another approach to assembly solver (A2plus)

Postby kbwbe » Thu Aug 09, 2018 3:29 pm

@Turro75

Hi Turro,
i created a new branch "turro-DOF-1" on Github including your recently changed files.

Doing first tests, there seems to be a problem within the new algorithm. It only solves the parts with distance 1 from fixed Part. Other parts beginning with distance 2 are not moved, but solver gives message "system solved". I attach 2 test assemblies which show this effect on my machine. Perhaps it is only a small bug.

After a quick look at the report-view, the DOF calculation seems to be correct. Only processing of the resulting chain does not work.

FYI: 6DOF-Platform example is solved without any problems. Stage 5 of your new algorithm seems to work.
Attachments
group-001.fcstd
(16.83 KiB) Downloaded 7 times
assembly-bigplate.fcstd
(14.83 KiB) Downloaded 7 times
KBWBE

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