Need a HELP on G-Code

More
14 Jan 2016 09:52 - 14 Jan 2016 09:53 #68350 by ArcEye
Replied by ArcEye on topic Need a HELP on G-Code

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: 14 Jan 2016 09:53 by ArcEye.

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

More
14 Jan 2016 12:11 #68359 by andypugh
Replied by andypugh on topic Need a HELP on G-Code

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.

More
14 Jan 2016 12:14 - 14 Jan 2016 12:15 #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.
#!/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: 14 Jan 2016 12:15 by ArcEye.
The following user(s) said Thank You: marq_torque, SKH

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

More
15 Jan 2016 12:09 #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
15 Jan 2016 12:34 #68444 by andypugh
Replied by andypugh on topic Need a HELP on G-Code

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
15 Jan 2016 16:20 #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
18 Jan 2016 07:50 #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
18 Jan 2016 11:16 #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.

More
18 Jan 2016 11:37 - 18 Jan 2016 13:36 #68670 by ArcEye
Replied by ArcEye on topic Need a HELP on G-Code
Home and Touch it off.

Having found out what DH parameters are, they are nothing that Axis understands

You need to establish a Cartesian home position that Axis understands as G53 X0 Y0 Z0 A0 B0 C0.
You can just set the ini file so that all homing values are 0 and it will home without movement to wherever you are happy with as a home position with your DH parameters set as you require.
This is your base position.

Then move to a position where you are in the centre (ish) of your arm's working area and touch off to 0 under G54 in the various axes, so that you are offset from machine positioning.
(This might conceivably be the same place, but I would have expected an arm to home in a fully retracted position out of the way, but I may be completely wrong)

If your axis figures in your ini file are correct, you should now be able to reach to the extent of your arm in its various planes without exceeding the working area limits.
If the axis can move in both directions from the home position, this range needs to be in the ini file settings.
(or you could just hack it and change MAX_LIMIT and MIN_LIMIT to 9999 and -9999 respectively and be untroubled by limits :laugh: )

You still need to ensure that your collected data is from a homed and touched off arm and it matches the coordinate system you try to run it in, eg collect G54 coordinates and run them under G54, not G53.

Any coordinates you have collected so far will be completely arbitrary insofar as their origin is concerned.

regards
Last edit: 18 Jan 2016 13:36 by ArcEye.
The following user(s) said Thank You: SKH

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

More
18 Jan 2016 13:38 #68684 by andypugh
Replied by andypugh on topic Need a HELP on G-Code

Having found out what DH parameters are, they are nothing that Axis understands

No, but they are crucial to the relationship between the joint angles and the machine cartesian position.

Are you using a Joint_axes branch of LinuxCNC? That separates the joint limits and the cartesian limits. You probably want that.

regardless of that, does the robot home accurately to a fixed point in space, and does this point in space correspond to the HOME position? You won't get anywhere unless the actual machine positions and the internal software model of the machine match.

If you jog in a straight line in the X axis, does the tool point move in a straight line along the X axis? If it doesn't then you still have configuration and homing details to get right.

Experiment with the sim/axis/vismach/puma configuration to see how a properly set-up robot jogs in cartesian space.
The following user(s) said Thank You: SKH, bodhi_94

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

Time to create page: 0.175 seconds
Powered by Kunena Forum