Cartesian G-code to cylindrical machine coordinate

More
21 May 2014 16:24 #47149 by andypugh

I've created *.stl 3D file in my CAE and succesfully imported to Blender.


I don't think you want to do it like that.

This is a job for 2D CAD. Define the parabola (probably analytically) and use that to create some lathe G-code from a DXF or similar 2D format.
CamBam can do lathe-style G-code.

However, I think if I was doing it I would not use CAM at all, I would write a G-code program that took outside diameter and focal length as inputs and generated the parabola shape in the g-code.
You can have loops in G-code, and it can do maths.
www.linuxcnc.org/docs/html/gcode/overvie...nary-Operation-Value

Please Log in or Create an account to join the conversation.

More
21 May 2014 21:47 - 21 May 2014 22:09 #47164 by eneuro

This is a job for 2D CAD. Define the parabola (probably analytically) and use that to create some lathe G-code from a DXF or similar 2D format.

Maybe it was not clear in mold concept, but it is not posible to create this mold using perfect parabola, while I want those trianlges size close to showed before and keep them flat.
File Attachment:

Its size may change but not too much, so those flat triangles vertexes will fit into perfect parabola, but a few more much smaller triangles in rings shape will make this surface more rigid and it is maybe not shown in this concept, but it was created only for overview how this 3D mold will look like.
These bigger main reflectors triangles shown in this concept so far will be flat and mark itself place where to fit mirror reflectors.
I've made simulation to determine this parabolic mirror made of about 500 flat mirrors its reflectivity capabilities and it fits my needs:

3D shaped mold is a must there and simply rotation of 2D parabolic curve does not fit my requirements for this mold ;)

Thank you for CAM hints maybe one of those tools will be able create tool paths I expect else I will try create G-code with cylindric and ball tools to create this parabolic mold, but with flat surfaces too.
Last edit: 21 May 2014 22:09 by eneuro.

Please Log in or Create an account to join the conversation.

More
22 May 2014 00:23 #47174 by andypugh

Thank you for CAM hints maybe one of those tools will be able create tool paths I expect else I will try create G-code with cylindric and ball tools to create this parabolic mold, but with flat surfaces too.


If you want the facets then you might actually want to make a 3-axis machine after all.

If the Z could rotate on the X then you could make each facet with a flat-faced cutter. As the shape appears to be convex everywhere the facets would actually appear naturally.

Simply place the cutter above the centroid of each facet, align the cutter with the face-normal and make a plunge cut.

You might want to look on eBay for harmonic drives. I found one in Israel recently for less money than normal (£50)

Please Log in or Create an account to join the conversation.

More
22 May 2014 02:24 - 22 May 2014 14:33 #47176 by eneuro

Simply place the cutter above the centroid of each facet, align the cutter with the face-normal and make a plunge cut.

It looks like 4th axis attached to my Zblue could be needed to make this alignment while I need turn this cutter to fit into facet?

I think that styrofoam based soft materials ( The Art of styrofoam ) could be good for this mold, while I could create G-code files to get final mold in a few steps: first quite simply to get close to final parabolid shape starting from the top and rotating around Zaxis my CNC machine and adjusting radius and Zaxis depth to remove most of styrofoam as descibed before.
Then change tool to heated linear cutter perpendicular to the radius, turn in Z axis this machine to the Xangle facet triangle centroid, lock this angle and simply make a plunge cut starting from the bottom of each facet triangle by adjusting Zaxis depth and Yradius position because of in this case those main bigger mirror triangle facets are designed to be as close as possible to equilateral triangles.
So, this close to finishing job of this machine will look like reversed lathe with tools rotated around Zaxis to given position to make this plunge cut while this angle is locked ;)

3 axes should do this and other jobs and at the moment the most important thing is for me to make this transformation from cartesian (X Y Z) to machine (Xangle Yradius Znochange) inside LinuxCNC, so it is time to create some G-code (this easy first part) and try to hack in simulation or by logging LPT LinuxCNC with Hal configured this translation and to be able maybe log it into text file for analysis :S
However, it could be nice to make simply PCB with LPT port soldered, microcontroler to catch LPT outputs from PC and program microcontroler to respond on input LPT pins to simulate my CNC machine to see what is going on inside HAL using real hardware attached.
I could even, connect another Linux PC using my I2C serial interface to this microcontroller and send control commands, log collected LPT I/O, etc., directly from hardware attached to LinuxCNC LPT even without Hal hacking while I know how to do this, but I will try crack Hal first B)

Update:
I've found quite good introduction to CNC here MDI: CNC For Manual Machinists and using MDI mode in LinuxCNC Axis with G2/G3 codes described here Circular Arcs With G02 and G03 I can create G-code tool paths needed to create this mold and do manual cuts if needed on real machine :)
File Attachment:

So, I do not need final G-code at the moment to test my LinuxCNC controler, while I can do it in MDI-send G2/G3 codes and see what happends inside LinuxCNC with Hal configured for my machine.
It could be nice to setup vismach wiki.linuxcnc.org/cgi-bin/wiki.pl?Vismach for machine visualisation.
Last edit: 22 May 2014 14:33 by eneuro.

Please Log in or Create an account to join the conversation.

More
23 May 2014 18:20 - 23 May 2014 18:32 #47247 by eneuro
I've made first test version of my kinetics component to my CNC machine based on those included in linuxcnc-dev:
src/emc/kinematics/kinematics.h
src/em/kinematics/trivkins.c
src/emc/kinematics/5axiskins.c
src/emc/kinematics/rotatekins.c
src/em/kinematics/puma.c
and succesfully installed in my LinuxCNC 2.5.4
using component compilator comp:

$ sudo comp --install eneurokins.c

File Attachment:

It is installed in:
/usr/realtime-2.6.32-122-rtai/modules/linuxcnc/eneurokins.ko
I've added eneurokins.diameter Hal variable in this version of this kinematics and exported those 3 kinematics functions like in other similar kins with KINEMATICS_BOTH .
#include "rtapi.h"              /* RTAPI realtime OS API */
#include "rtapi_app.h"          /* RTAPI realtime module decls */

EXPORT_SYMBOL(kinematicsType);
EXPORT_SYMBOL(kinematicsForward);
EXPORT_SYMBOL(kinematicsInverse);
MODULE_LICENSE("GPL");

I was able using halrun to monitor it and change this eneurokins.diameter
File Attachment:


Also I've successfully compiled those kins in latest development linuxcnc-dev LINUXCNC - 2.7.0~pre0 which I've compiled with simulation and run in place enabled
linuxcnc-dev/src$ ./configure --enable-simulator --enable-run-in-place

How to test those created eneurokins in axis linuxcnc in MDI mode?
Do I have to write some linuxcnc configuration to enable and connect this hal?
Last edit: 23 May 2014 18:32 by eneuro.

Please Log in or Create an account to join the conversation.

More
23 May 2014 18:51 - 23 May 2014 18:52 #47249 by andypugh

I've made first test version of my kinetics component to my CNC machine

I actuallly think that you would have an easier time generating G-code in X,B,C,W coordinate space than converting XYZAB into XBCW.
(I am using "W" to mean the rotatable Z, if that wasn't clear).
The you could use G-code like:
#1=3000 ; radius
O100 WHILE [#1 GT 100]
#2 = 0 ; main "lathe" axis
O200 WHILE [#2 LT 360]
#3 = (some clever maths to define the parabola)
#4 = (more maths to define the Z-axis tilt angle
G0 X#1 C#2 B#4
G1 W#3
G0 W0
#2 = [#2 + #1/100 * PI]
O200 ENDWHILE
#1 = [#1 + 20]
O100 ENDWHILE

How to test those created eneurokins in axis linuxcnc in MDI mode?
Do I have to write some linuxcnc configuration to enable and connect this hal?


it isn't trivial, and there are almost no docs, but it might be worth making a Vismach model of your proposed machine for testing.

"5axis" in the sample configs has a fairly good example of a Vismach model of a 5-axis gantry mill.
Last edit: 23 May 2014 18:52 by andypugh.

Please Log in or Create an account to join the conversation.

More
23 May 2014 20:50 - 23 May 2014 20:56 #47252 by eneuro

I actuallly think that you would have an easier time generating G-code in X,B,C,W coordinate

4 axis is close to 6dof robot ;)
Maybe later I could add another 4th axis for Z tilting but for styrofoam molds which can be cut using metal heated by high current pulse circuit (2.5VAC hundreds of Amps from 230VAC transformer) I think that for the moment Z axis up/down should be fine.
I do not need those molds at very high percision, while in solar parabolic mirror project I can do small final adjustments of those reflective mirors glued to created rigid fiberglass mold to fit into its designed focus.

it might be worth making a Vismach model of your proposed machine for testing.

I have also LinuxCNC 2.7.0 pre development sources installed, I will try to dig into axis source code and try to monitor hals while doing simple linuxcnc g-code G0/G1/G2/G3 tasks in MDI manual mode.

I see that there is nice hal interface while was writting my eneurokins component in C language, so maybe it could be possible simply write another OpenGL application, add hal calls to read linuxcnc & axis hals and make my CNC machine visualisation without vismach while it is easy for me do it in OpenGL C/C++ and the only concern is to find a way to catch linuxcnc or axis hals needed to read them while g-code is executed in linuxcnc axis :S
I think, I will try to add a few more hal debug values like this one I have so far in my kins (eneurokins.diameter) to my eneurokins component, to be able to monitor what happends inside this module-to see if those forward/inverse/home kins are executed and when (timestamps), simply make joints passed to them beetween calls visible in hal monitor as another hal values, then I should be able to monitor my kins hal values in another machine visualisation OpenGL application and make its animation, I guess?
Last edit: 23 May 2014 20:56 by eneuro.

Please Log in or Create an account to join the conversation.

More
23 May 2014 21:22 #47254 by andypugh

I do not need those molds at very high percision, while in solar parabolic mirror project I can do small final adjustments of those reflective mirors glued to created rigid fiberglass mold to fit into its designed focus.


That sounds like a job for the same machine in pick-and-place mode with a vacuum pick-up..

I see that there is nice hal interface while was writting my eneurokins component in C language, so maybe it could be possible simply write another OpenGL application, add hal calls to read linuxcnc & axis hals and make my CNC machine visualisation without vismach

That sounds like a lot more work than using Vismach!

Please Log in or Create an account to join the conversation.

More
23 May 2014 23:52 - 24 May 2014 07:17 #47258 by eneuro

That sounds like a lot more work than using Vismach!

I know C/C++/Java much better than python, so if I will be able catch those linuxcnc axis internals using C hal interface It is easy for me to draw a few boxes and lines in OpenGL and maybe even I will try to add visualisation of material removal during its job and interface to setup faster this monster for diffrent tasks.
I have also OpenGL code from other projects for... 3D anaglyph & stereo setups so could see this monster CNC machine in cool VR environment and maybe even make virtual walk during its milling job ;)
Meanwhile, based on linuxcnc-dev/src/emc/kinematics/pumakins.c I've added cartesian CX,CY,CZ coordinates as well as those machine joint coords ML,MR,MZ which are set in forward/inverse kinematics function calls.
File Attachment:

ML is for the moment not angle but... some kind of distance from lets say clock 0h/12h/24h hour in machine path around this circle defined by diameter eneurokins.md -it is positive in CCW direction and negative in CW looking from the top to the bottom :blink:
Of course I can change it to angle easy while this length is function of angle-for the moment it does not matter while all I want to do is crack linuxcnc axis hals in MDI mode and maybe connect halscope to these coords :evil:

It works as expected and it was easy to change those trivial kinetics in LinuxCNC axis configuration for my new eneurokins :woohoo:
File Attachment:

I looks like this radius machine joint length eneurokins.mr is correct based on G-codes
G01 X10 Y10 Z10
I've entered in MDI manual mode while Maxima, a Computer Algebra System says exactly the same:
(%i3) mr: float(sqrt(10^2+10^2));
(%o3)                          14.14213562373095
Last edit: 24 May 2014 07:17 by eneuro. Reason: tested

Please Log in or Create an account to join the conversation.

Time to create page: 0.499 seconds
Powered by Kunena Forum