Need a HELP on G-Code

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

(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.


As a starter for 10, this will write out to file in a format that can be used as gcode, with a suitable header and footer

It is 6 axis specific, edit and adapt as required.
Code:
#!/usr/bin/python """Usage: python train.py You must ". scripts/emc-environment" before running this script, if you use run-in-place. """ # 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 hal import sys import linuxcnc s = linuxcnc.stat() def get_cart(): s.poll() position = "G01 X%-8.4f Y%-8.4f Z%-8.4f A%-8.4f B%-8.4f C%-8.4f\n" % ( s.position[0], s.position[1], s.position[2], s.position[3], s.position[4], s.position[5] ) return position h = hal.component("train") h.newpin ("record", hal.HAL_BIT, hal.HAL_IN) outfile = "train.ngc" h.ready() try: while 1: if h["record"] == 1: f = open(outfile, 'a') pos = get_cart() f.write(pos) f.close() except KeyboardInterrupt: raise SystemExit
Last edit: 10 years 9 months ago by ArcEye.
The following user(s) said Thank You: marq_torque, SKH

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

More
10 years 9 months ago #68442 by SKH
Replied by SKH on topic Need a HELP on G-Code
We used the positive limit switches as the home switches. When homing it goes to the home switches and goes back to the point we have given. From the home point we jogged only the joint 0 to another position and saved the coordinates.

-4.3687 -0.5114 -7.6510 136.1938 -71.7058 25.1489 – then we converted these values to the following g-code.

G20 G90
G0 G53 X-4.3687 Y-0.5114 Z -7.6510 A136.1938 B-71.7058 C25.1489 F200
G30
M30

When try to run it with this g-code it won’t go to the position where we first jogged in to. In fact it tries to go beyond the limit switches and trigger them. That is the problem we have. We were wandering if it is because of the DH parameters or the way we edited the g-code. Is there any error in the way we used the g-code or anything we missed??

Best regards
SKH

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

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

SKH wrote: We were wandering if it is because of the DH parameters or the way we edited the g-code.


The G-code looks correct, but it may be trying to take a path to that point that exceeds a joint limit due to the DH parameters being wrong.

The DH need to be right. Even if that doesn't solve the current problem.
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 #68465 by ArcEye
Replied by ArcEye on topic Need a HELP on G-Code

When try to run it with this g-code it won’t go to the position where we first jogged in to. In fact it tries to go beyond the limit switches and trigger them. That is the problem we have. We were wandering if it is because of the DH parameters or the way we edited the g-code. Is there any error in the way we used the g-code or anything we missed??


What you have not said is what code you used to capture the positions you are feeding back in.

If you use code which gets the offset G54 positions and then run that code as machine positions with G53, it is bound to go wrong and exceed limits.
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 #68654 by SKH
Replied by SKH on topic Need a HELP on G-Code
Thank you Andy/ArcEye.....
Then we'll try setting the DH parameters first and get back to you soon......

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

More
10 years 9 months ago #68668 by SKH
Replied by SKH on topic Need a HELP on G-Code
Hay..
We've setup all DH Parameters.
now we want to run a "linuxcnc" G-Code.
but when we imported it to our work space,then the G-Code is located faraway from the tool tip of the robot.
so when we run the program,it will try to exceed the limits

so how can we move the G-code closer to the robot?

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

Time to create page: 0.643 seconds
Powered by Kunena Forum