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!
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: ping
Hi Turro,
first feed back regarding your PR with two solvers.

I had to switch back to spinstep-divisor/weights used within master. When i did this, the new second "merge+master" solves most cases, but not all.
I think it has nothing to do with the parameters mentioned above. There must be another difficulty. Perhaps it has something to do with merging of rigids. Perhaps the merging happens at poor accuracy level. If unfixing is not able to unmerge the rigids, there will be problems.

Because lack of time, i did not have an intensive look at the new code. I will do this soon.
If the problematic cases have to do with merging, there two possibilities:
- merging of rigids at an enhanced accuracy level
- unmerging if needed and possible

My opinion tends to the enhanced accuracy level. Next days, we will know more.

In generally, your new solver is much faster and it is worth to invest some work.

I attach a simple file. Master solver works, master+merging not. (old parameters 12.0/0.5/8.0)
If we get the new solver working correctly on this small file, i think we will have found main part of the difficulties)
Attachments
frame-4-parts.fcstd
(118.73 KiB) Downloaded 36 times
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
polymer
Posts: 278
Joined: Fri Sep 12, 2014 8:49 am

Re: Another approach to assembly solver (A2plus)

Post by polymer »

Hello,

In A2+ you can import an existing FC-File. Would it be possible to add a funktion „add new“ which creates a new object and also creates a new FC-File?

Greetings
Turro75
Posts: 179
Joined: Mon Aug 15, 2016 10:23 pm

Re: Another approach to assembly solver (A2plus)

Post by Turro75 »

kbwbe wrote: Wed Sep 12, 2018 7:07 pm
Turro75 wrote: ping
Hi Turro,
first feed back regarding your PR with two solvers.

I had to switch back to spinstep-divisor/weights used within master. When i did this, the new second "merge+master" solves most cases, but not all.
I think it has nothing to do with the parameters mentioned above. There must be another difficulty. Perhaps it has something to do with merging of rigids. Perhaps the merging happens at poor accuracy level. If unfixing is not able to unmerge the rigids, there will be problems.

Because lack of time, i did not have an intensive look at the new code. I will do this soon.
If the problematic cases have to do with merging, there two possibilities:
- merging of rigids at an enhanced accuracy level
- unmerging if needed and possible

My opinion tends to the enhanced accuracy level. Next days, we will know more.

In generally, your new solver is much faster and it is worth to invest some work.

I attach a simple file. Master solver works, master+merging not. (old parameters 12.0/0.5/8.0)
If we get the new solver working correctly on this small file, i think we will have found main part of the difficulties)
I agree, I faced exactly the same, actually the right values depend on the constraint scheme used, some work other don't.
I would try some changes:
1) improve accuracy at merging stage
2) create a new list instead of modify self.rigids so in case the original rigids can be easily recovered if unfixing is needed
3) the more i like to try, instead of solving everything and then improve accuracy, merge at best accuracy before go to the next workList
Koemi
Posts: 150
Joined: Thu Dec 28, 2017 11:13 am
Location: The Netherlands

Re: Another approach to assembly solver (A2plus)

Post by Koemi »

kbwbe wrote: Wed Sep 12, 2018 4:52 pm Find a bugfix v0.1.1 release on github for this error. Please update A2plus...
I will be offline for perhaps 2 or 3 days. Next bug, you found, i will work on later.
Update done: https://github.com/kbwbe/A2plus/releases/tag/v0.1.1 and now it seems right, thanks!! :D

Then I tried to get the part to it's position. I noticed that I could create constraints, - they appeared in the Application tree - but the part did not move at all to its expected position. 'Autosolve' was switched ON, 'Solve AS2 constraints' did not do anything...

So I tried to find out what was going on and I discovered:

- When you try to constrain an imported part to another part already inside the assembly which is NOT fixed (for itself) or is not connected to another fixed part, the imported part does NOT move to its desired position. I think the behaviour is the same when Autosolve is switched OFF. I do not know if this is the intention or is it a bug?
Turro75
Posts: 179
Joined: Mon Aug 15, 2016 10:23 pm

Re: Another approach to assembly solver (A2plus)

Post by Turro75 »

Koemi wrote: Thu Sep 13, 2018 6:54 am
kbwbe wrote: Wed Sep 12, 2018 4:52 pm Find a bugfix v0.1.1 release on github for this error. Please update A2plus...
I will be offline for perhaps 2 or 3 days. Next bug, you found, i will work on later.
Update done: https://github.com/kbwbe/A2plus/releases/tag/v0.1.1 and now it seems right, thanks!! :D

Then I tried to get the part to it's position. I noticed that I could create constraints, - they appeared in the Application tree - but the part did not move at all to its expected position. 'Autosolve' was switched ON, 'Solve AS2 constraints' did not do anything...

So I tried to find out what was going on and I discovered:

- When you try to constrain an imported part to another part already inside the assembly which is NOT fixed (for itself) or is not connected to another fixed part, the imported part does NOT move to its desired position. I think the behaviour is the same when Autosolve is switched OFF. I do not know if this is the intention or is it a bug?
Hi Koemi,

ATM the solver needs at least 1 fixed part linked directly or indireclty to all other.
If You need 2 or more groups of obj You need to set at least 1 fixed part on each group
Turro75
Posts: 179
Joined: Mon Aug 15, 2016 10:23 pm

Re: Another approach to assembly solver (A2plus)

Post by Turro75 »

Turro75 wrote: Wed Sep 12, 2018 11:07 pm
kbwbe wrote: Wed Sep 12, 2018 7:07 pm
Turro75 wrote: ping
Hi Turro,
first feed back regarding your PR with two solvers.

I had to switch back to spinstep-divisor/weights used within master. When i did this, the new second "merge+master" solves most cases, but not all.
I think it has nothing to do with the parameters mentioned above. There must be another difficulty. Perhaps it has something to do with merging of rigids. Perhaps the merging happens at poor accuracy level. If unfixing is not able to unmerge the rigids, there will be problems.

Because lack of time, i did not have an intensive look at the new code. I will do this soon.
If the problematic cases have to do with merging, there two possibilities:
- merging of rigids at an enhanced accuracy level
- unmerging if needed and possible

My opinion tends to the enhanced accuracy level. Next days, we will know more.

In generally, your new solver is much faster and it is worth to invest some work.

I attach a simple file. Master solver works, master+merging not. (old parameters 12.0/0.5/8.0)
If we get the new solver working correctly on this small file, i think we will have found main part of the difficulties)
I agree, I faced exactly the same, actually the right values depend on the constraint scheme used, some work other don't.
I would try some changes:
1) improve accuracy at merging stage
2) create a new list instead of modify self.rigids so in case the original rigids can be easily recovered if unfixing is needed
3) the more i like to try, instead of solving everything and then improve accuracy, merge at best accuracy before go to the next workList
@Kbwbe
i'm thinking it twice,

considering the simple frame-4parts:
1) all items are fully constrained on each other
2) this means that the assembly is overconstrained
3) ideally it is perfect as some constraints are simply redundant but...
4) placing within (any) accuracy immediately create conflicts which leads in request for unfixing and so

Just 1 question, assuming there are only 2 obj involved, which are fully constrained of course, assuming that only one obj is free to move, Could the current solver placing the second obj direclty to the target position without intermediate steps?
In other words, can we use a simple placement instead of refpoint attraction?
Koemi
Posts: 150
Joined: Thu Dec 28, 2017 11:13 am
Location: The Netherlands

Re: Another approach to assembly solver (A2plus)

Post by Koemi »

@Turro75: describes exactly what I noticed 8-)

And I tumbled over something new... And it worries me.

I am assembling some parts in an assembly; importing and assembling is going smooth and simple, great! I love it!

Then I noticed that one of the assembled parts needs some adjustments. I make the adjustment and save the file; so far so good. In A2P I click the 'Update parts imported into the assembly' button. A message pops up saying I am going to loose a constrain. This could also happen using A2, so nothing to worry. The assembly which is recomputed has tumbled some parts in other positions and angles, which I can accept.

After this I try to rearrange. From another part I try to delete a constrain. I get a warning I am going to loose more constraints. Ok.

This action not only deletes constraints, but also several parts...? This effect is new to me...

A little bit more searching around and I discovered constraints connected to parts, which are not present anymore... Clicking 'repair the treeview ' does not solve it. Clicking on a constraint which should not excist, creates a complete blank Property / View tree. It is also impossible to remove these 'ghost-constraints'...

Furthermore: the constraints which should be present, cannot be adapted anymore (change of angle / offset is not possible anymore).

I have added the assembly, maybe you can find something?
Attachments
SAM Beugel_TV55inch_compleet.FCStd
(909.71 KiB) Downloaded 35 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 »

Turro75 wrote: Thu Sep 13, 2018 10:08 am 3) ideally it is perfect as some constraints are simply redundant but...
4) placing within (any) accuracy immediately create conflicts which leads in request for unfixing and so

Just 1 question, assuming there are only 2 obj involved, which are fully constrained of course, assuming that only one obj is free to move, Could the current solver placing the second obj direclty to the target position without intermediate steps?
In other words, can we use a simple placement instead of refpoint attraction?
Hi Turro,
Some remarks regarding your last point, "simple placement"...
Our recent solver is a general purpose solver, being able to solve more complicated things as only solving placement of two parts. I agree, for this case it is perhaps not the optimal design.

Common case for moving second part to other fixed part is solving more than one constraint, so solver has to calculate a resulting placement from several separate constraints. Recent solver can only do this iteratively. ATM i do not know, which math is needed to do this analytical. In any case, this would be a new, second analytical solver. Doing a placement for a first circularEdge constraint is easy, but what is to do if there is the second one and the part has to be rotated around axis of first one ? Analytical way, i do not have any idea. Recent solver does this via refPoint rotation.
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 »

Koemi wrote: Thu Sep 13, 2018 10:09 am Then I noticed that one of the assembled parts needs some adjustments. I make the adjustment and save the file; so far so good. In A2P I click the 'Update parts imported into the assembly' button. A message pops up saying I am going to loose a constrain. This could also happen using A2, so nothing to worry. The assembly which is recomputed has tumbled some parts in other positions and angles, which I can accept.
Hi Koemi,
"updateImportParts" is the weak point at moment. Best way, if you exactly now which part will be updated, is to use the "delete constraints" button, which kills ALL constraints of this part, and then next step do the update. If you do this not this way, A2p will only automatically delete the detected broken constraints. But it detects no all of them. Other can be broken, too. So behaviour of the assembly can get strange.
Koemi wrote: Thu Sep 13, 2018 10:09 am After this I try to rearrange. From another part I try to delete a constrain. I get a warning I am going to loose more constraints. Ok.
Koemi wrote: Thu Sep 13, 2018 10:09 am This action not only deletes constraints, but also several parts...? This effect is new to me...
I think here you used the "deleteConstraints" button. If it kills parts, this is a bug. I will look for next time.
Koemi wrote: Thu Sep 13, 2018 10:09 am A little bit more searching around and I discovered constraints connected to parts, which are not present anymore... Clicking 'repair the treeview ' does not solve it. Clicking on a constraint which should not excist, creates a complete blank Property / View tree. It is also impossible to remove these 'ghost-constraints'...
Maybe, if parts accidently have been removed...
At first, be sure nothing additional been selected before using the "deleteConstraints" buttton
Koemi wrote: Thu Sep 13, 2018 10:09 am Furthermore: the constraints which should be present, cannot be adapted anymore (change of angle / offset is not possible anymore).

I have added the assembly, maybe you can find something?
Could not reproduce at moment, will try again...
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
Koemi
Posts: 150
Joined: Thu Dec 28, 2017 11:13 am
Location: The Netherlands

Re: Another approach to assembly solver (A2plus)

Post by Koemi »

kbwbe wrote: Fri Sep 14, 2018 9:25 am I think here you used the "deleteConstraints" button. If it kills parts, this is a bug. I will look for next time.
I did not use the "deleteConstraints" button. I used the delete button on my keyboard.
kbwbe wrote: Fri Sep 14, 2018 9:25 am Maybe, if parts accidently have been removed...
At first, be sure nothing additional been selected before using the "deleteConstraints" buttton
I was absolutely sure this was not the case. I have tried it several times; same happens
kbwbe wrote: Fri Sep 14, 2018 9:25 am Could not reproduce at moment, will try again...
It is possible this is a 'twist' between parts constructed with Part Design (FC_V0.16) and adapted with Part Design Next (FC_V0.17) but I am not sure

Unfortunately I must take a step back to FC_V0.16 and A2 (no plus). :cry: These 'bugs' are eating too much work-time to keep this up. Unfortunately also A2 is not functional 100% either, especially adapting angle constraints lead to unjustified constraint faillure (one of the known issues I think, that's why A2P is in progress).

Of course I stay 100% on top of this forum-thread, because I know it leads to 100% improvement of A2! If improvements are added and bugs are removed, I will be there to test updates. I find it so impressive to read that you and the others are spending so much of your time to make A2P successful. Keep up the good work! I take a deep bow. :mrgreen:
Post Reply