Need a HELP on G-Code
Currently I'm working on a 6 Axis robotic arm (I've attached some photos of my design below)& I'm having a little trouble while teaching the G-Code.
right now I'm able to record axis values to a text file,my problem is how to convert those axis values to G-Code.
Ive tried creating the G-code manually by typing those values to a example g code file,
then the robot moves in a awkward manner..
Q1) can i create the G-code from those X,Y,Z,A,B,C motor position values?How?
Q2) also how to move a imported G-code ,to the working space of the robot arm?
People have used it for robotic arms, but it is not a shining success as the simulations show, if you can get them to work.
Before you get too much time invested in what may well be a cul-de-sac, why not use something that was intended for the job - ROS.
SKH wrote: but we have gone so far to turn back,so is there any way to get the X,Y,Z Cartesian coordinates at a particular instant of the robot?
What kinematics are you using?
Or are you using trivkins?
As a first step, switch to using the Joints-Axes branch of LinuxCNC where a lot of recent work has taken place to make running non-cartesian machines work better.
It is probably best to build this from source, though there may be ways to get it from the Buildbot as a binary package (buildbot.linuxcnc.org)
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?
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.
#!/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 <firstname.lastname@example.org> # # 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 if len(sys.argv) > 2: outfile = sys.argv 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.
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.