Need a HELP on G-Code

More
10 years 9 months ago #68300 by SKH
Replied by SKH on topic Need a HELP on G-Code
Thank you andy..
:laugh: lol.. Most of the Sri Lankan wall-sockets and plugs are just like that. :)

We re using genserkins.

which means can't we get the XYZ coordinates directly without building the source??

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

More
10 years 9 months ago #68301 by andypugh
Replied by andypugh on topic Need a HELP on G-Code

SKH wrote: sing genserkins.
which means can't we get the XYZ coordinates directly without building the source??


OK, genserkins is a good start.
Genserkins and Joints_axes is probably a better combination, and is something you should consider, but is not 100% necessary.

Are the XYZABC coordinates on the screen correct? Is the problem that your logging process it capturing joint positions and not cartesian positions?

What is the teach process you are using?
The following user(s) said Thank You: SKH

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

More
10 years 9 months ago #68302 by ArcEye
Replied by ArcEye on topic Need a HELP on G-Code
Cartesian - Joints problems aside, have a look at teach-in.py

It is in src/emc/usr_intf/axis/scripts in the sources, but I don't know where it is or if it is installed in a distro.
Code:
#!/usr/bin/python """Usage: python teach.py nmlfile outputfile If outputfile is not specified, writes to standard output. You must ". scripts/rip-environment" before running this script, if you use run-in-place. """ # Copyright 2007 Jeff Epler <jepler@unpythonic.net> # # 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA import linuxcnc import Tkinter import sys linenumber = 1; if len(sys.argv) > 1: linuxcnc.nmlfile = sys.argv[1] if len(sys.argv) > 2: outfile = sys.argv[2] sys.stdout = open(outfile, 'w') s = linuxcnc.stat() def get_cart(): s.poll() position = " ".join(["%-8.4f"] * s.axes) return position % s.position[:s.axes] def get_joint(): s.poll() position = " ".join(["%-8.4f"] * s.axes) return position % s.joint_actual_position[:s.axes] def log(): global linenumber; if world.get(): p = get_cart() else: p = get_joint() label1.configure(text='Learned: %s' % p) print linenumber, p, s.flood, s.mist, s.lube, s.spindle_enabled; linenumber += 1; def show(): s.poll() if world.get(): p = get_cart() else: p = get_joint() label2.configure(text='Position: %s' % p) app.after(100, show) app = Tkinter.Tk(); app.wm_title('LinuxCNC Teach-In') world = Tkinter.IntVar(app) button = Tkinter.Button(app, command=log, text='Learn', font=("helvetica", 14)) button.pack(side='left') label2 = Tkinter.Label(app, width=60, font='fixed', anchor="w") label2.pack(side='top') label1 = Tkinter.Label(app, width=60, font='fixed', text="Learned: (nothing yet)", anchor="w") label1.pack(side='top') r1 = Tkinter.Radiobutton(app, text="Joint", variable=world, value=0) r1.pack(side='left') r2 = Tkinter.Radiobutton(app, text="World", variable=world, value=1) r2.pack(side='left') show() app.mainloop()

Should give you a starting point.

I am also not sure what positions you are after, but AFAIK the motion planner works in cartesian planes even if the end result is different from the output that would produce.
The following user(s) said Thank You: SKH

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

More
10 years 9 months ago #68344 by SKH
Replied by SKH on topic Need a HELP on G-Code
We referred the modified version of teach-in.py given in the below link.


we are using the get_cart() function to save Cartesian coordinates.(Q1.Is this function doing that?)
here Ive attached a file ,that i saved from this method.

File Attachment:

File Name: pos_saved.txt
File Size:0 KB

As you can see there are 6 values saved each time.(Q2.why we are getting 6 values when i use get_cart(). it should be X,Y,Z only right?)
(Q3.can't we use joint values to make the g-code?)

also we haven't configure those DH parameters yet.(we taught it is not necessary since we are manually recording the coordinates other than running a direct G-code,) ( Q4.is it a must to configure DH parameters?)

right now we are able to Home the robot arm successfully.
Attachments:

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

More
10 years 9 months ago - 10 years 9 months ago #68350 by ArcEye
Replied by ArcEye on topic Need a HELP on G-Code

SKH wrote: We referred the modified version of teach-in.py given in the below link.


The link didn't show up, (you don't need to use the URL bracket pairs, they don't seem to work for some reason)
forum.linuxcnc.org/forum/41-guis/25849-t...eration?limitstart=0

I presume you mean this script
forum.linuxcnc.org/media/kunena/attachme...16368/Teachin.py.txt

we are using the get_cart() function to save Cartesian coordinates.(Q1.Is this function doing that?)


To see what you are getting, you need to read
src/emc/usr_intf/axis/extensions/emcmodule.cc
src/hal/halmodule.cc
www.linuxcnc.org/docs/devel/html/man/man9/axis.9.html

here Ive attached a file ,that i saved from this method.

File Attachment:

File Name: pos_saved.txt
File Size:0 KB

As you can see there are 6 values saved each time.(Q2.why we are getting 6 values when i use get_cart(). it should be X,Y,Z only right?)


You have said your machine is 6 axis and your photo of the DRO shows XYZABC, so why would you expect only XYZ ?

(Q3.can't we use joint values to make the g-code?)


That is the whole point of a teach program
You could have the teach-in.py script write out as GCode, but you would need to process the fields in position first, to insert modal codes and axis letters into the string.

( Q4.is it a must to configure DH parameters?)


What do you mean by DH ?
If you mean must you have the machine homed before starting, yes otherwise there is no base reference for the values that you output.
Last edit: 10 years 9 months ago by ArcEye.

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

More
10 years 9 months ago #68359 by andypugh
Replied by andypugh on topic Need a HELP on G-Code

SKH wrote: As you can see there are 6 values saved each time.(Q2.why we are getting 6 values when i use get_cart(). it should be X,Y,Z only right?)

No. If you consider the end-point to be the centre of the circle that forms the "hand" of the arm, then consider how many ways that you can put that centre point in a give XYZ position in space you will see that here are an infinite number of solutions.
The positions you are getting are the XYZ point in space and the ABC anglular positions of the end-effector in space.
Put more simply, you need 6 inputs to solve the 6 degree-of-freedom equations that define the joint positions.

also we haven't configure those DH parameters yet.(we taught it is not necessary since we are manually recording the coordinates other than running a direct G-code,) .

I think that setting the DH parameters correctly will be absolutely necessary to get the machine to work properly.
If you can't jog in straight lines in cartesian space then the inverse solutions to the kinematics equations will be wrong.
The following user(s) said Thank You: SKH

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

Time to create page: 0.217 seconds
Powered by Kunena Forum