Hi Chris,

I did not know how to give the first point a weight, in addition I 
definitely had a bug in my GCode, in the sense that I wanted points 1 
and 3 to have the same lower weight, but not point 2. With this change, 
the curve looks like I wanted and the path is followed very closely, 
even when the weight of point 3 is vastly different from 1 and 2 .
Thanks for pointing this out.

Now there is just the issue of G41, G42 that have no effect, do you have 
a fix for that ?

I understand what you say about the nurb approximation. I think the 
optimal way to subdivide would be to use the curvature function of the 
curve and subdivide on each point where the curvature exceeds a given 
epsilon compared to the previous subdivision point. That way there would 
be more segments (or arcs) in sections of high curvature and fewer in 
flatter sections.

Could you point me where in the code this is handled ? Maybe I could 
take a stab at implementing that...

Cheers

Bruno




Hi Bruno,

Investigating this led me to find and fix several bugs in the NURBS
implementation, which will give you a MUCH smoother wrong path when
you run your test program.

But that aside, you are seeing a problem because you have very
different weights on your control points, and that is poorly handled
by the algorithm used by linuxcnc, which breaks the NURBS into arcs.
The split we use should do a recursive bisect by arc length, but
instead it uses a fixed number of splits (4 * number of control
points) and splits with equal du, not equal length.  Fixing this the
right way is a bit beyond me.  Nevertheless, if you understand the
problem I bet you can work around it easily:

Your program, simplified even more, is

G0 X0 Y37.75
G5.2 X39 Y39 P356 L3
      X39 Y0 P356
G5.3

So you have three control points.  The initial one (0, 37.75) has
weight 1, which is the default weight.  The second and third points
have weight 356.

This means the path moves away from the initial point very fast.
This probably doesn't affect the shape you see very much, but it
will affect it a little bit.  It does GREATLY affect the algorithm
we use to split into arcs, though -- there are very few points
sampled at the beginning of the curve.  That leads to the very poor
path following there (although at least it's smooth now, with one of
my bugfixes.)

If you change your program to weight the points more similarly, you
will get the path you want:

G0 X0 Y37.75
G5.2 P1  (This is how you specify weight for the initial point)
      X39 Y39 P10 L3
      X39 Y0 P1
G5.3

I think this gives something like the path you want.  With the
weights of the control points within a factor of 10, I get very good
path following.

I hope this helps you.  It's not perfect and I'm not very happy with
it.

Chris


------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their 
applications. Written by three acclaimed leaders in the field, 
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
_______________________________________________
Emc-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-developers

Reply via email to