by ArtF » Mon Dec 16, 2019 12:08 pm
It is the nature of the scripter that it passes such numbers as floats. So when a number like
.00000061 shows up it will be printed as 6.1E-7 or such thing, but its still in essence a 0.0
in terms of the math. So you could use a Goto or any math on that number and typically
get the result your looking for.
This is no different than Mach3 or other controller, one of the most common support
questions I got on Mach3 was why the display would show .003421 or something after
a Goto(0,0,0). Of course this is simply less than 1 step of the motors, to move one
step more would be -0.0000xxx. Often when a DRO is showing 0.0 the base value its
displaying could actually be .000000001786 or so.
So dont worry about the number, unless your multiplying by millions, its simply
a rounding error more related to printing it than using it. As Kirk says, its common
to do a comparison to a small number to see if its actually zero. A statement
like
" if( fabs(x) < epsilon ) x = 0; "
is pretty common in code. epsilon changes from situation to situation, but is typically
pretty small. These small floats play a part though as they accumulate small errors
until they get large enough to be a full step of the motors. They play a part in end
accuracy of position over time.
My advice would be to ignore such small numbers, they mostly come from the fact
the motor can only move in quantum increments, so small differences will exist on every
move, but as they accumulate they self correct errors in motion over time.
Art
It is the nature of the scripter that it passes such numbers as floats. So when a number like
.00000061 shows up it will be printed as 6.1E-7 or such thing, but its still in essence a 0.0
in terms of the math. So you could use a Goto or any math on that number and typically
get the result your looking for.
This is no different than Mach3 or other controller, one of the most common support
questions I got on Mach3 was why the display would show .003421 or something after
a Goto(0,0,0). Of course this is simply less than 1 step of the motors, to move one
step more would be -0.0000xxx. Often when a DRO is showing 0.0 the base value its
displaying could actually be .000000001786 or so.
So dont worry about the number, unless your multiplying by millions, its simply
a rounding error more related to printing it than using it. As Kirk says, its common
to do a comparison to a small number to see if its actually zero. A statement
like
" if( fabs(x) < epsilon ) x = 0; "
is pretty common in code. epsilon changes from situation to situation, but is typically
pretty small. These small floats play a part though as they accumulate small errors
until they get large enough to be a full step of the motors. They play a part in end
accuracy of position over time.
My advice would be to ignore such small numbers, they mostly come from the fact
the motor can only move in quantum increments, so small differences will exist on every
move, but as they accumulate they self correct errors in motion over time.
Art