Results 1 to 7 of 7

Thread: How would you rotate a part at runtime?

  1. #1
    Join Date
    Jan 2012
    Location
    Minneapolis
    Posts
    27

    Default How would you rotate a part at runtime?

    Hi,
    Imagine a hardwood chair leg. After anchoring my material to the spoilboard I’d like to cut several legs from the same board. I’d like each part placed and rotated depending on the specific grain of my board. I know I could edit the drawing and recalculate but a runtime solution would be much more efficient.

    What I want to do is rotate a part and set a new 0,0 location based on 2 points. I want to be able to lay a pre-cut hardboard template down on my material. Once I've found pleasing grain to cut the part from my material, I want to use 2 predetermined points on the template to rotate and move my file to cut where I laid the template.

    Has anyone ever done something like this? I know it's going to be possible but the path to the solution is a little foggy.

    The part file I've attached is just a test file. there are 2 toolpaths. The first is just there to identify where the points are on the template. The second toolpath, the profile, represents the part I want to cut.
    rotationtest.sbp

    I would like to include prompts in my part file to ask the user to drive the bot to 2 points (or at least ask the user to enter coordinates). Once these points are identified, I would like to rotate the part based on the points and then cut the part.

    I found this on the forum archive. This is what got me thinking.
    http://www.talkshopbot.com/forum/arc...hp/t-1163.html


    I commonly write sbp subroutines to cut a "feature" and then cut that feature several times, each time rotated to a different angle. The locking lap joint that I described in the tilting shop cart has a subroutine that cuts the pillars and another that cuts the wells; and both of these routines simply rotate their standard feature by a specified amount at run time.

    If the feature is originally in terms of cartesian coordinates, convert to polar coordinates consisting of a distance (r) from the point of rotation (x0,y0) and the angle (a) from the point of rotation. To rotate the feature, just add the amount of rotation (d) to the angle a and convert back to cartesian coordinates using:

    x = x0 + r * cos(a + d) and
    y = y0 + r * sin(a + d)

    I usually just use these expressions right in a M2 command:

    M2 &X0 + &R * COS(&A + &D),&Y0 + &R * SIN(&A + &D)

    ------------------------------------------------

    I thought I'd start by trying to write out what I imagine would happen in English. It's not bullet-proof but it's a starting point.

    ------------------------------------------------
    At the computer, the part file is drawn with 0,0 centered on material.

    0,0 is always the first reference point (A)
    Refpoint B is somewhere else on the part.
    The part always rotates around 0,0

    A template is cut with the 2 points drilled through.

    At the bot, the material is attached to the spoilboard. The user aligns the pre-cut template to the appropriate spot on material and marks 2 points (the 0,0 point of the new part and the second point) Both points are marked using holes drilled in the template.


    load part file
    Current reference pointA and pointB are set
    This is the point of rotation
    &refPointXA = 0
    &refPointYA = 0

    &refPointXB = -2 (changes depending on part)
    &refPointYB = 16 (changes depending on part)

    user is prompted for coordinates of new pointA
    This is where the new 0,0 will be
    INPUT >get input from user/keyboard or by driving bot manually to new pointA
    &newPointXA = user input
    &newPointYA = user input

    user is prompted for coordinates of new pointB
    INPUT >get input from user/keyboard or by driving bot manually to new pointB
    &newPointXB = user input
    &newPointYB = user input

    Relocate zero with a Z2 at new pointA position
    &newPointXA = &refPointXA
    &newPointYA = &refPointYA

    convert coordinates to polar

    &refPointDistanceB
    &refPointAngleB
    &newPointDistanceB
    &newPointAngleB

    get angle difference
    &AngleChange = &refPointAngleB - &newPointAngleB

    Convert entire part to polar (all at once or as the file runs?)
    Change angle for all coordinates by &AngleChange

    Convert file back to cartesian coordinates.

    Cut file in new location with calculated angle change
    Bob's your uncle

    Phew, that's all I've got. I wanted to make sure i thought it through before I asked y'all. Sorry for the very long post. If I get this working I'd love to share the technique with a nice video tutorial.

  2. #2
    Join Date
    Jan 2004
    Location
    iBILD Solutions - Southern NJ
    Posts
    7,986

    Default

    The simple answer is no, you cannot do this in the way you want with the SB software. You CAN use FP, offset parameters to change the XY location of the template as it relates to table base coordinates in logical XY cartesian space, but no polar transformations or rotations are permitted. (that I know of anyway)

    What you are looking to do is very similar to what they do in the logging industry, and other applications where they want to cull knots and blemishes from the lumber. They typically pre-process the raw materials using cameras, and sometimes non-contact scanners, with machine vision software to identify and record the positions of blemishes. This data is then passed along to the next operation where the machine cuts away the blemishes as indicated in the previous step. Obviously, there is some post processing of the captured data in order to generate information the cutting machine needs to navigate to the proper locations.

    Emulating what other industries do...(why reinvent the wheel?) the 'grassroots' approach would be to first digitize the material to be cut using a camera. If one was crafty enough, he could set the camera on the gantry and trigger it to capture every few inches in X, and then do a composite photo of the entire board. The image can then be brought into CAD/CAM & with human eyes, a vector template can be quickly and efficiently (WAY faster than any algorithm) transformed to fit the material and avoid the blemished areas & toolpaths recalculated to update to the current locations. It's all dynamic, very fast and efficient with visual confirmation that the transformations made are correct. As long as you tag your lumber with identification, you should have no trouble syncing up the toolpaths.

    I am sure that there are controls out there that have this level of machine vision capability as a module or feature (Fanuc anyone?)...but I would imagine that the combination of software and hardware costs more than a nice house. They may be some kind of arduino/Raspi embedded controller work arounds possible along with a CNC controller, but you'd have to research that one & question whether it's even worth going down that hole.

    -B
    High Definition 3D Laser Scanning Services - Advanced ShopBot CNC Training and Consultation - Vectric Custom Video Training IBILD.com

  3. #3
    Join Date
    Sep 2006
    Location
    Garland Tx
    Posts
    2,334

    Default

    I wonder if you can use Bill Young's “File Rotator” program as the basis of this type of program. Since his program rotates a file around 0,0 your two known points would need to be used to establish 0,0.
    http://shopbottools.com/mSupport/shopbotlabs.htm


    SG

  4. #4
    Join Date
    Jan 2012
    Location
    Minneapolis
    Posts
    27

    Default

    Brady,
    Thanks for your input. I knew I could count on you to have some insight. I like the idea of using a camera mounted on the gantry. I was discussing this with a coworker yesterday. That's the type of fuctionality that the Glowforge laser cutter has built into it. They use a cell phone camera to scan material and/or artwork. It would be interesting to cut along grain patterns using that approach. The heavy lifting would be in the software and firmware but it seems like something people could use in lots of ways.

    Steve,
    Great pickup! That will indeed get me by. I can layout my template, set a new 0,0 position, measure the angle manually, run Bill's File Rotator, and go.
    That accomplishes what I am after.

    I would love to make this a more seamless solution as I feel it would be useful for lots of woodworkers. Is there anyone developing CNC utilities like this for the small shop?

  5. #5
    Join Date
    Jan 2004
    Location
    iBILD Solutions - Southern NJ
    Posts
    7,986

    Default

    Greg,
    Since I get requests to do 2D digitizing either too convoluted or delicate for a 2D touch probe routine, I use the camera as I've described above. There are a few important things with this setup worth pointing out. First, you don't want a camera phone...the lens is small and has a lot of distortion. A point & shoot digital camera is best. Even a GoPro with a Back-Bone setup has too much distortion for my needs...So, any DSLR or even regular digital camera with a good lens will get the job done. Second, you will want to overlap/over sample the camera shots as much as 80% of the field of view. This gets rid of vignetting and lens distortion at the outer edges of the lens. Third, good even diffused light is essential. And finally, you want to put the camera into manual mode so that autofocus doesn't jack up the linearity of the captures.

    The proposed pattern is like a patchwork quilt, rastering incrementally in Y the overlap distance. An entire collection of photos are taken and then processed (semi-automatically) using ICE or Photoshop to create a composite image. That image, with very high resolution can then be pulled into Aspire or VCP etc and used as a basis for steering around blemishes, capturing the wood texture itself or capturing the outside edge of the subject without shadows typical of flatbed scanning or arbitrary photo capture. The camera is triggered via an output switch on the CNC to the camera itself. Depending on the I/O of the camera, it may take getting creative to trigger the camera you have already invested in...Mine is just an RC servo with a 3D printed ring that holds it onto the camera and is triggered via Arduino. Simple...

    Yes, it does require some human interaction to do it this way & it is not low level at the controller - but it does open up possibilities not available using other means.

    There are a number of machine vision software projects out there that may interest you, that are more automated than the solution I mentioned. None of them would interface with the SB controller in the way you would probably wish it could...but there are always work arounds, bootstraps and other bandaids to get where you need to be...It's just a matter of time & money - just like everything else!

    -B
    High Definition 3D Laser Scanning Services - Advanced ShopBot CNC Training and Consultation - Vectric Custom Video Training IBILD.com

  6. #6
    Join Date
    Jun 2001
    Location
    Austin, TX
    Posts
    445

    Default

    Not to be a Ludite but if you have a template why not just lay the pieces out and bandsaw the blanks. It seems more direct and faster to me.

  7. #7
    Join Date
    Jan 2012
    Location
    Minneapolis
    Posts
    27

    Default

    Quote Originally Posted by waynelocke View Post
    Not to be a Ludite but if you have a template why not just lay the pieces out and bandsaw the blanks. It seems more direct and faster to me.
    I totally get that. No need to complicate things, right?

    There's a bit of other joinery that gets cut along with the profile. I just don't have any in the file.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •