Page 1 of 2 12 LastLast
Results 1 to 12 of 17

Thread: Algorithm?

  1. #1
    Registered
    Join Date
    Aug 2004
    Location
    Greece
    Posts
    145
    Downloads
    0
    Uploads
    0

    Algorithm?

    I don't know if it's the right place to post this.

    Some time ago someone posted that he was developing his own motion control software and someone suggested he took a look on some algorithm of converting the motion to intermediate steps (essentially a vector to raster transformation).

    The algorithm was named after the man who invented it, doesn anybody know what I'm talking about?

    Thanks,
    Nikolas


  2. #2
    Registered WayneHill's Avatar
    Join Date
    Mar 2004
    Location
    Michigan
    Posts
    780
    Downloads
    0
    Uploads
    0
    Bezier curves ?
    Wayne Hill


  3. #3
    Registered
    Join Date
    Aug 2004
    Location
    Greece
    Posts
    145
    Downloads
    0
    Uploads
    0
    No, but thanks for answering. The one I'm looking for is much simpler. I want to go from point A to point B. Say I'm using steppers so there's a finite amount of positions the machine can take. Which are the points that better represent the A to B line. I hope I made it clearer.

    Nikolas


  4. #4
    Registered
    Join Date
    Apr 2005
    Location
    Australia
    Posts
    28
    Downloads
    0
    Uploads
    0
    Hi Nikolas,

    The algorithm you are looking for is the Bresenham Algorithm.

    Cheers,

    Pat


  • #5
    Registered
    Join Date
    Aug 2004
    Location
    Greece
    Posts
    145
    Downloads
    0
    Uploads
    0
    Quote Originally Posted by gimbal View Post
    Hi Nikolas,

    The algorithm you are looking for is the Bresenham Algorithm.

    Cheers,

    Pat
    Yeaaaaah!!! Thank's a lot, I owe you a beer!

    Nikolas


  • #6
    Registered DR-Motion's Avatar
    Join Date
    Mar 2004
    Location
    Ontario,Canada
    Posts
    120
    Downloads
    0
    Uploads
    0
    Consider the process of connecting two points on a piece of paper by drawing a line between them. To do so we must move our pencil in two axes simultaneously... where the motion of one axis is in fixed proportion to the motion of the other. This fixed proportion is the ratio of the distance the secondary axis has to move compared to the primary axis... and is equivalent to the slope of the line between the two points.

    The procedure we use to calculate this ratio can have a major impact on the maximum precise pulse rate that our controller can produce. The processing time, used for the calculation limits the minimum step delay time, which determines our maximum speed. When we extend the coordinated motion to three or four axes, this processing time becomes even more significant.

    The most efficient approach adopts an algorithm from the old days... when men were men and computers were wimpy. In the early days of computing, processing power was extremely expensive and limited. The task of connecting two points with a line was solved, for the problem of plotting a line on the raster display of a typical monitor.

    The solution was called Bresenham's algorithm and involved only integer arithmetic, using addition and subtraction.

    Here's an example of some pseudo code that demonstrates the application of Bresenham's algorithm in coordinating two axes of movement from one point to another.

    distance = master // master is the axis which has the longer
    distance to travel.

    error = zero // error tracks the distance from the ideal
    position.

    While distance > zero // loop until distance has been traveled

    {

    Step pulse on master axis // outputs a pulse for the master axis .

    distance = distance - 1 // distance has one less step to take

    error = error + slave // slave is the axis, which has the
    shorter distance to travel.

    If error > slave // compare error

    {

    error = error - master

    step pulse on slave axis // outputs a pulse for the
    slave axis.

    }

    }

    It turns out that this algorithm can be adapted to more than two axes simply by having a separate error term for each slave axis term. So as the master axis is traversed one step at a time... each of the (shorter) slave axes are stepped in proportion to their ratio (to the master).

    So now we have a method of coordinating the motion of multiple axes with a minimum of computational overhead. In fact, a similar algorithm exists for circular motion.
    Last edited by DR-Motion; 10-14-2006 at 04:41 PM. Reason: fix spelling
    embrace enthusiasm to accomplish the task
    Gary Davies... www.durhamrobotics.com


  • #7
    Registered acondit's Avatar
    Join Date
    Apr 2005
    Location
    USA
    Posts
    1,778
    Downloads
    0
    Uploads
    0
    I thought that in 8 bit logic 2b = 00101011 and ~2b = 11010100.
    So 2b | ~2b = 00101011 | 11010100 = 11111111. Or FFh or 255.

    Alan
    Last edited by acondit; 10-14-2006 at 11:38 PM. Reason: correct binary representation of 2b and ~2b


  • #8
    Registered DR-Motion's Avatar
    Join Date
    Mar 2004
    Location
    Ontario,Canada
    Posts
    120
    Downloads
    0
    Uploads
    0
    Sorry that would be 0x2d | ~ 0x2d ( 0b00101101 | 0b11010010 )

    Symbolic algebra does not imply any particlular number base.

    To paraphrase another member's sig... there are 10 kinds
    of people in this world, those who don't understand binary,
    those who think binary is the greatest new thing and
    those who routinely use a plethora of modulo number bases ;-)
    embrace enthusiasm to accomplish the task
    Gary Davies... www.durhamrobotics.com


  • #9
    Registered acondit's Avatar
    Join Date
    Apr 2005
    Location
    USA
    Posts
    1,778
    Downloads
    0
    Uploads
    0
    Gary,

    You are correct, (my bad).

    Alan


  • #10
    Moderator HuFlungDung's Avatar
    Join Date
    Mar 2003
    Location
    Canada
    Posts
    4,826
    Downloads
    0
    Uploads
    0
    Hey, I got it...."10 kinds of people", but that's two in decimal talk isn't it? So shouldn't it be 11 kinds of people?

    Question on the application of this algorithm to machine motion: it would seem that none of the axis can move less than a pulse, so how do you prevent the loss of steps due to rounding off errors? Or how does the computer create what appears to be a smooth output over this bumpy road of digital bits? Is there some kind of averaging thing that is having all these "go, don't go" signals fed in?
    First you get good, then you get fast. Then grouchiness sets in.

    (Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)


  • #11
    Registered
    Join Date
    Jul 2005
    Location
    Canada
    Posts
    11,960
    Downloads
    0
    Uploads
    0
    Quote Originally Posted by HuFlungDung View Post
    Hey, I got it...."10 kinds of people", but that's two in decimal talk isn't it? So shouldn't it be 11 kinds of people?
    Thanks Hu, I did wonder what I was missing.


  • #12
    Registered DR-Motion's Avatar
    Join Date
    Mar 2004
    Location
    Ontario,Canada
    Posts
    120
    Downloads
    0
    Uploads
    0
    count 0,1,2,10 in base 3 (trinary numbers)
    It's a Monte Python number base...
    yes, no and perhaps ;-)

    Hu, a step and direction system can never output a fractional step/microstep;
    if you zoom in close enough all curves show as a staircase albeit smoothed
    by the inertia and flex of the machine.
    Last edited by DR-Motion; 10-15-2006 at 05:51 PM. Reason: fix spelling
    embrace enthusiasm to accomplish the task
    Gary Davies... www.durhamrobotics.com


  • Page 1 of 2 12 LastLast

    Posting Permissions


     


    About CNCzone.com

      We are the largest and most active discussion forum from DIY CNC Machines to the Cad/Cam software to run them. The site is 100% free to join and use, so join today!

    Follow us on

    Facebook Dribbble RSS Feed


    Search Engine Friendly URLs by vBSEO ©2011, Crawlability, Inc.