Hi John,

I'm taking another look at this now, and seeing some weird behavior with
the example NGC file in LinuxCNC 2.7.x too (hits an acceleration violation
in the A axis around line 1600). I suspect that there is an issue with the
floating point comparisons as well, in particular since LinuxCNC handles
the case of rotary + linear motion differently than a pure rotary motion.
As such, a motion that has some rotary motion and a pathologically small
linear motion could be triggering the problem. I don't currently have a
machinekit build on my dev PC, but I will set one up and do further testing
in simulation shortly.

Best,
Rob

On Thu, Jan 24, 2019 at 10:26 AM <[email protected]> wrote:

> Hey Robert,
>
> Have you had a chance to look at this any closer? We hit this error 100%
> of the time on the Pocket NC for specific values of various HOME_OFFSETs
> (our current solution is to tweak those values by .0001" until the error
> goes away). The error occurs immediately after pressing the run button on
> any program after homing the machine. Any jogging before running the
> program and it runs fine. I've done a little digging into the code base to
> see what could be causing the issue, but don't have a good enough sense of
> the overall flow of data. Any insights would be appreciated. I've located
> several floating point equality comparisons that would result in a more
> precise comparison than the 1e-20 the trajectory planner is comparing
> against, but haven't had any luck when changing from direct equality (or
> inequality) operations to a difference comparison (i.e. changing x == y to
> abs(x-y) < epsilon).
>
> Here are a few places I've tried adjusting:
>
> https://github.com/machinekit/machinekit/blob/1dfa0045ba95fd68e744826d684efa513cbffa97/src/emc/motion/control.c#L449
>
> https://github.com/machinekit/machinekit/blob/1dfa0045ba95fd68e744826d684efa513cbffa97/src/emc/rs274ngc/interp_convert.cc#L2465
> (and several other similar instances in that same file)
>
> https://github.com/machinekit/machinekit/blob/1dfa0045ba95fd68e744826d684efa513cbffa97/src/emc/nml_intf/canon_position.cc#L73
> (as well as !=)
>
> I don't know the best way to go about debugging this. Do you know how I
> could find where the zero length moves are being added to the trajectory
> planner and what normally prevents that from happening?
>
> Yours and Schooner's insights have been helpful so far. Maybe we can work
> together to figure out what is going on.
>
> -John
>
> On Saturday, February 25, 2017 at 1:16:32 PM UTC-7, Robert Ellenberg wrote:
>>
>> Hi All,
>>
>> My guess is that this is a mismatch between canon and the TP in how a
>> zero length segment is defined. I recall running into a similar issue with
>> LinuxCNC. If we're lucky, it's been fixed already in another branch and
>> it's a matter of porting the fix over to Machinekit. I'll take a look this
>> weekend.
>>
>> Best,
>> Rob
>>
>> On Sat, Feb 25, 2017 at 10:08 AM [email protected] <
>> [email protected]> wrote:
>>
>>>
>>> On 25/02/17 11:47, [email protected] wrote:
>>>
>>>
>>> On 25/02/17 07:55, icecube45 wrote:
>>>
>>> It's seemingly a different line each time I run the file, this time it
>>> was line 20462, which is either the middle of
>>>
>>>> G1 X-9.794 Y-69.769 A29.4549
>>>>
>>>> G1 X-10.971 Y-71.809 A29.5489
>>>>
>>>> G1 X-13.951 Y-71.809 A29.6678
>>>>
>>>> or the middle of
>>>
>>>>
>>>
>>> G1 X31.776 Y-64.609 A48.9986
>>>
>>> G1 X34.755 Y-64.609 A49.1175
>>>
>>> G1 X35.933 Y-62.569 A49.2115
>>>
>>>
>>> defendant on if comments count as lines or not..
>>> Nothing seems out of the ordinary here, which is why I'm so confused.
>>>
>>>
>>> The error is defined as TP_ERR_ZERO_LENGTH
>>>
>>> https://github.com/machinekit/machinekit/blob/master/src/emc/tp/tp_types.h#L61
>>>
>>> The trajectory planner is dark magic with which I have no particular
>>> familiarity.
>>> It was certainly not developed to squirt plastic in tens of thousands of
>>> extremely small moves.
>>>
>>> My only guess might be that depending upon what blending settings you
>>> have, it may not recognise  a commanded move(s) as
>>> any sort of move at all.
>>> But I could be completely wrong.
>>>
>>> Hopefully Robert or someone with more knowledge will chime in.
>>>
>>>
>>> Just to flesh this out a bit
>>>
>>> This is the code which is throwing the error
>>>
>>> https://github.com/machinekit/machinekit/blob/master/src/emc/tp/tp.c#L1937
>>>
>>> if (tc.target < TP_POS_EPSILON) {
>>>     rtapi_print_msg(RTAPI_MSG_DBG,"failed to create line id %d,
>>> zero-length segment\n",tp->nextId);
>>>     return TP_ERR_ZERO_LENGTH;
>>>     }
>>>
>>> If you switched on debugging, you should see this message in
>>> /var/log/linuxcnc.log
>>>
>>> This is why I am surmising that an extremely small move, with some
>>> rounding down from the tp settings,
>>> could be causing the error.
>>>
>>> TP_POS_EPSILON is defined here
>>>
>>> https://github.com/machinekit/machinekit/blob/master/src/emc/tp/tp_types.h#L44
>>> as 1e-12 ( which is 10 to -12 or 0.000 000 000 001 !! )
>>>
>>> Why this is occurring I don't know, but you can switch on debugging and
>>> confirm that this is indeed the bit causing it.
>>>
>>> You can also switch off blending (G64 P0) or adjust the blend tolerance
>>> settings ( G64 Pn.nn ) and see if it improves.
>>>
>>>
>>>
>>>
>>> On Friday, February 24, 2017 at 4:47:47 AM UTC-8, Schooner wrote:
>>>>
>>>>
>>>> On 24/02/17 12:03, icecube45 wrote:
>>>>
>>>> Does anyone have any idea what this error code is? It occasionally
>>>> happens, yet I can't isolate what is actually causing it, nor what the -7
>>>> error code actually means.
>>>>
>>>>
>>>>
>>>> https://github.com/machinekit/machinekit/blob/master/src/emc/motion/command.c#L953
>>>>
>>>> It means that it does not like one of the parameters to a linear move.
>>>>
>>>> EMCMOT_COMMAND_BAD_EXEC means there was an error trying to initiate the
>>>> command.
>>>> This would suggest the command was valid syntax but the acc, vel, move
>>>> extent or some other factor was not.
>>>>
>>>> Unless you can tell us what the move asked for was, it is impossible to
>>>> guess.
>>>>
>>>> line xxxx should be a number, it may not strictly equate to the line
>>>> number but should be a number non the less.
>>>>
>>>>
>>>>
>>>> I'd appreciate any advice on how to fix this error - it's popping up
>>>> randomly and stopping my prints.
>>>>
>>>> For reference, I'm on a BeBoPr++ lineardelta configuration.
>>>> --
>>>> website: http://www.machinekit.io blog: http://blog.machinekit.io
>>>> github: https://github.com/machinekit
>>>> ---
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Machinekit" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to [email protected].
>>>> Visit this group at https://groups.google.com/group/machinekit.
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>>
>>>> --
>>> website: http://www.machinekit.io blog: http://blog.machinekit.io
>>> github: https://github.com/machinekit
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "Machinekit" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> Visit this group at https://groups.google.com/group/machinekit.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>>
>>> --
>>> website: http://www.machinekit.io blog: http://blog.machinekit.io
>>> github: https://github.com/machinekit
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "Machinekit" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> Visit this group at https://groups.google.com/group/machinekit.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>>
>>> --
>>> website: http://www.machinekit.io blog: http://blog.machinekit.io
>>> github: https://github.com/machinekit
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "Machinekit" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> Visit this group at https://groups.google.com/group/machinekit.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
> website: http://www.machinekit.io blog: http://blog.machinekit.io github:
> https://github.com/machinekit
> ---
> You received this message because you are subscribed to the Google Groups
> "Machinekit" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> Visit this group at https://groups.google.com/group/machinekit.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
website: http://www.machinekit.io blog: http://blog.machinekit.io github: 
https://github.com/machinekit
--- 
You received this message because you are subscribed to the Google Groups 
"Machinekit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
Visit this group at https://groups.google.com/group/machinekit.
For more options, visit https://groups.google.com/d/optout.

Reply via email to