Non-circular boring. (Linuxcnc fun)
- skunkworks
- Offline
- Moderator
Less
More
- Posts: 361
- Thank you received: 150
10 Mar 2020 01:14 - 10 Mar 2020 01:14 #159619
by skunkworks
Non-circular boring. (Linuxcnc fun) was created by skunkworks
made a surprisingly simple hal component that takes the spindle position and converts to x/y motion to create a polygon.
Last edit: 10 Mar 2020 01:14 by skunkworks.
The following user(s) said Thank You: phillc54, joekline9, chimeno, pkasy, tommylight, COFHAL, BeagleBrainz, smc.collins, Abati
Please Log in or Create an account to join the conversation.
10 Mar 2020 04:02 #159632
by cmorley
Replied by cmorley on topic Non-circular boring. (Linuxcnc fun)
I think you should add some docs to linuxcnc to show some of this crazy stuff you try.
Pretty damn cool!
Pretty damn cool!
Please Log in or Create an account to join the conversation.
- tommylight
- Online
- Moderator
Less
More
- Posts: 19188
- Thank you received: 6430
10 Mar 2020 13:29 #159651
by tommylight
Replied by tommylight on topic Non-circular boring. (Linuxcnc fun)
I agree with Cmorley !
Very nice, indeed.
Very nice, indeed.
Please Log in or Create an account to join the conversation.
- skunkworks
- Offline
- Moderator
Less
More
- Posts: 361
- Thank you received: 150
10 Mar 2020 16:26 #159670
by skunkworks
Replied by skunkworks on topic Non-circular boring. (Linuxcnc fun)
The following user(s) said Thank You: phillc54
Please Log in or Create an account to join the conversation.
- skunkworks
- Offline
- Moderator
Less
More
- Posts: 361
- Thank you received: 150
11 Mar 2020 02:38 - 11 Mar 2020 02:39 #159741
by skunkworks
Replied by skunkworks on topic Non-circular boring. (Linuxcnc fun)
Last edit: 11 Mar 2020 02:39 by skunkworks.
The following user(s) said Thank You: smc.collins
Please Log in or Create an account to join the conversation.
- skunkworks
- Offline
- Moderator
Less
More
- Posts: 361
- Thank you received: 150
11 Mar 2020 03:04 #159745
by skunkworks
Replied by skunkworks on topic Non-circular boring. (Linuxcnc fun)
Really really messy - does a spindle encoder index enable and such. Some comments.
// This is a component for Linuxcnc HAL
// Copyright 2020 Sam Sokolik <samcoinc@gmail.com>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
component polygon "Create a spindle synced motion that carves a polygon using eoffset inputs. Assumes positive rotation.";
pin in bit enable;
pin in unsigned numsides=3 "Number of sides in the polygon";
pin in float inscribedradius=1 "inscribed radius of the polygon";
pin in float cutterdiam "cutter diameter";
pin in float eoffsetscale "scale that eoffset is set to.";
pin in float toolang "angle difference between index and actual tool poition";
pin in float spindlepos "Spindle position scaled to 1 per rev";
pin out float spindlerad "Spindle postion in radians";
pin out float polyradius "radious of the polygon at given spindle position";
pin out float xoffset "x offset to send to offset componant";
pin out float yoffset "y offset to send to the offset componant";
pin out signed xeoffset "x eoffset output";
pin out signed yeoffset "y eoffset output";
pin out bit isindex "set index enable only once";
pin io bit indexenable "hooked to index enable of encoder";
function _;
license "GPL";
;;
#include <rtapi_math.h>
#define PI 3.14159265358979323846
float spinang;
float scale;
float spinangoffset;
if (!enable) {
xoffset=0;
yoffset=0;
xeoffset=0;
yeoffset=0;
isindex = false;
return;
}
// only set index enable once
if (enable && !isindex) {
isindex = true;
indexenable = true;
return;
}
// wait for spindle index before actually enabling
if (enable && isindex && indexenable){
return;
}
//convert spinangoffset to ratio.. for adding to spindle pos - plus a couple rotations
//so the spindle position isn't negative
spinangoffset = (toolang/360)+2;
//formual I found is for circumscribed - convert to inscribed - makes more sense.
scale=inscribedradius/cos(PI/numsides);
spinang = ((spindlepos + spinangoffset) - (int)(spindlepos + spinangoffset))*2*PI;
polyradius = (cos(PI/numsides)/cos((fmod(spinang, (2*PI/numsides))-PI/numsides)))*scale-cutterdiam/2;
//actual offsets applied - could be used for offset componant.
xoffset = cos(spinang)*polyradius * -1;
yoffset = sin(spinang)*polyradius;
//counts for use with eoffset functionality
xeoffset = xoffset / eoffsetscale;
yeoffset = yoffset / eoffsetscale;
spindlerad = spinang;
Please Log in or Create an account to join the conversation.
- skunkworks
- Offline
- Moderator
Less
More
- Posts: 361
- Thank you received: 150
12 Mar 2020 02:18 #159836
by skunkworks
Replied by skunkworks on topic Non-circular boring. (Linuxcnc fun)
Rotatable polygon.. 12 point anyone? (2 hexes one rotated 30 degrees)
// This is a component for Linuxcnc HAL
// Copyright 2020 Sam Sokolik <samcoinc@gmail.com>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
component polygon "Create a spindle synced motion that carves a polygon using eoffset inputs. Assumes positive rotation.";
pin in bit enable;
pin in unsigned numsides=3 "Number of sides in the polygon";
pin in float inscribedradius=1 "inscribed radius of the polygon";
pin in float cutterdiam "cutter diameter";
pin in float eoffsetscale "scale that eoffset is set to.";
pin in float toolang "angle difference between index and actual tool poition";
pin in float polyang "angle of the polygon";
pin in float spindlepos "Spindle position scaled to 1 per rev";
pin out float spindlerad "Spindle postion in radians";
pin out float polyradius "radious of the polygon at given spindle position";
pin out float xoffset "x offset to send to offset componant";
pin out float yoffset "y offset to send to the offset componant";
pin out signed xeoffset "x eoffset output";
pin out signed yeoffset "y eoffset output";
pin out bit isindex "set index enable only once";
pin io bit indexenable "hooked to index enable of encoder";
function _;
license "GPL";
;;
#include <rtapi_math.h>
#define PI 3.14159265358979323846
float spinang;
float scale;
float spinangoffset;
float polyangoffset;
if (!enable) {
xoffset=0;
yoffset=0;
xeoffset=0;
yeoffset=0;
isindex = false;
return;
}
// only set index enable once
if (enable && !isindex) {
isindex = true;
indexenable = true;
return;
}
// wait for spindle index before actually enabling
if (enable && isindex && indexenable){
return;
}
//convert spinangoffset to ratio.. for adding to spindle pos - plus a couple rotations
//so the spindle position isn't negative
spinangoffset = (toolang/360-polyang/360)+2;
polyangoffset = (polyang/360)*2*PI;
//formual I found is for circumscribed - convert to inscribed - makes more sense.
scale=inscribedradius/cos(PI/numsides);
spinang = ((spindlepos + spinangoffset) - (int)(spindlepos + spinangoffset))*2*PI;
polyradius = (cos(PI/numsides)/cos((fmod(spinang, (2*PI/numsides))-PI/numsides)))*scale-cutterdiam/2;
//actual offsets applied - could be used for offset componant.
xoffset = cos(spinang+polyangoffset)*polyradius * -1;
yoffset = sin(spinang+polyangoffset)*polyradius;
//counts for use with eoffset functionality
xeoffset = xoffset / eoffsetscale;
yeoffset = yoffset / eoffsetscale;
spindlerad = spinang;
The following user(s) said Thank You: joekline9, chimeno, tommylight, snoozer77, Cynas, Dorro1971, smc.collins
Please Log in or Create an account to join the conversation.
12 Mar 2020 08:49 #159855
by cmorley
Replied by cmorley on topic Non-circular boring. (Linuxcnc fun)
very cool.
Gonna try aluminum next? I dare you lol
Sanvik capto tool holders use a tapered polygon for connectons....
Gonna try aluminum next? I dare you lol
Sanvik capto tool holders use a tapered polygon for connectons....
Please Log in or Create an account to join the conversation.
- skunkworks
- Offline
- Moderator
Less
More
- Posts: 361
- Thank you received: 150
14 Mar 2020 23:36 #160235
by skunkworks
Replied by skunkworks on topic Non-circular boring. (Linuxcnc fun)
The following user(s) said Thank You: cmorley, phillc54, joekline9, Diederik, tommylight, smc.collins
Please Log in or Create an account to join the conversation.
- tommylight
- Online
- Moderator
Less
More
- Posts: 19188
- Thank you received: 6430
15 Mar 2020 01:35 #160244
by tommylight
Replied by tommylight on topic Non-circular boring. (Linuxcnc fun)
Awesome !
Please Log in or Create an account to join the conversation.
Time to create page: 0.442 seconds