Pick and Place control possible with EMC2?
26 May 2010 21:51 #3020
by webbyguy
Pick and Place control possible with EMC2? was created by webbyguy
The basic question is can I send movement commands to EMC2 or some part of EMC2 to handle locations moves from a program that I write? For instance can I from a program tell EMC2 to tell the motors to move to an XYZA location? Here is the background on what I'm trying to do:
I'm currently trying to make a pick and place machine for surface mount components based on stepper motors (like a cnc machine). I was wondering if I could use something in EMC2 to make the programming of the motor control easier. The tricky part is that I would like to have vision incorporated, so I don't think I can simply write gcode to tell the controller to just go to this and that location. The routine that I want to make in my software is:
1. Pick up part
a. Read part pickup location from file
b. Tell EMC2 or something to move to XY location of the part.
c. Take picture of current location to find actual location of part.
d. Adjust XY location
e. Move Z axis to pick up part
f. Turn on suction
g. Move Z axis back up
2. Place part
a. Read relative part placement location, and calculate actual part placement based on which board is being placed (for multi boards at a time).
b. Move to XY location of placement
c. Take picture of current location (and maybe of orientation of the part if not saved from before).
d. Adjust XY location
e. Move Z axis to put part on board
f. Turn of suction, and maybe turn on some blow
g. Move Z axis back up.
It would be really sweet if I could use my setup that I already have from EMC2, and simply have my program send out comands like:
move to x=12.5in y=5.5in z=0in
move to x=12.5in y=5.5in z=-3in
...
Then I would only need to worry about the image processing part of the programming, and not have to re-invent the wheel on the motor control part.
Is there some way to do that with EMC2 or a part of EMC2? It seems like it would basically be writing a new GUI for it that, instead of reading a gcode file and creating moves, it would read some coordinate file and create moves.
I know this is out of the scope of normal EMC use, but I thought someone could point me into the direction of a nice doc on how to do something like this. I've look online for awhile, but I either haven't found it, or I didn't realize I was looking right at it.
Thanks ahead of time.
I'm currently trying to make a pick and place machine for surface mount components based on stepper motors (like a cnc machine). I was wondering if I could use something in EMC2 to make the programming of the motor control easier. The tricky part is that I would like to have vision incorporated, so I don't think I can simply write gcode to tell the controller to just go to this and that location. The routine that I want to make in my software is:
1. Pick up part
a. Read part pickup location from file
b. Tell EMC2 or something to move to XY location of the part.
c. Take picture of current location to find actual location of part.
d. Adjust XY location
e. Move Z axis to pick up part
f. Turn on suction
g. Move Z axis back up
2. Place part
a. Read relative part placement location, and calculate actual part placement based on which board is being placed (for multi boards at a time).
b. Move to XY location of placement
c. Take picture of current location (and maybe of orientation of the part if not saved from before).
d. Adjust XY location
e. Move Z axis to put part on board
f. Turn of suction, and maybe turn on some blow
g. Move Z axis back up.
It would be really sweet if I could use my setup that I already have from EMC2, and simply have my program send out comands like:
move to x=12.5in y=5.5in z=0in
move to x=12.5in y=5.5in z=-3in
...
Then I would only need to worry about the image processing part of the programming, and not have to re-invent the wheel on the motor control part.
Is there some way to do that with EMC2 or a part of EMC2? It seems like it would basically be writing a new GUI for it that, instead of reading a gcode file and creating moves, it would read some coordinate file and create moves.
I know this is out of the scope of normal EMC use, but I thought someone could point me into the direction of a nice doc on how to do something like this. I've look online for awhile, but I either haven't found it, or I didn't realize I was looking right at it.
Thanks ahead of time.
Please Log in or Create an account to join the conversation.
01 Jun 2010 12:39 #3055
by andypugh
Replied by andypugh on topic Re:Pick and Place control possible with EMC2?
webbyguy wrote:
The basic answer is "Yes". There are a number of ways to do it, too.
(This is all from guesswork, I don't have a machine available right now)
As a proof of concept:
Take your standard HAL file and comment out the "net" line that connects each stepgen to the axis.N.position-cmd pin from the motion controller. replace any amp-enable logic with a simple setp stepgen.N.enable true and the same for any physical amp-enable pins, then save it under a new filename. (You might have to save a copy of the INI file with a matching filename too, I am not sure)
Then open a terminal window and type:
halcmd source yourhalfilename.hal
halcmd start
halcmd setp stepgen.0.position-cmd 100
And you should see the axis move to that position.
Some fiddling might be needed, I haven't tested that this works. From a cursory glance at the docs it looks like the speed and accel limits are handled by the stepgen function, but it is possible that you might need to use a separate limit3 function.
(A list of all the available HAL realtime components can be found about half way down www.linuxcnc.org/docview/html/ )
In effect, all that is needed to move an axis is a numeric value sending to the stepgen position-cmd pin. How you get that value there is up to you, you can use halcmd as shown above, streamer / halstreamer (www.linuxcnc.org/docview/html//man/man1/halstreamer.1.html) your own pick-and-place "comp" component ( linuxcnc.org/docs/html/hal_comp.html ) or a custom driver that access the HAL shared memory and exports pins that can me linked to the stepgens in HAL) and probably a dozen other ways I haven't thought of yet.
The basic question is can I send movement commands to EMC2 or some part of EMC2 to handle locations moves from a program that I write?
The basic answer is "Yes". There are a number of ways to do it, too.
(This is all from guesswork, I don't have a machine available right now)
As a proof of concept:
Take your standard HAL file and comment out the "net" line that connects each stepgen to the axis.N.position-cmd pin from the motion controller. replace any amp-enable logic with a simple setp stepgen.N.enable true and the same for any physical amp-enable pins, then save it under a new filename. (You might have to save a copy of the INI file with a matching filename too, I am not sure)
Then open a terminal window and type:
halcmd source yourhalfilename.hal
halcmd start
halcmd setp stepgen.0.position-cmd 100
And you should see the axis move to that position.
Some fiddling might be needed, I haven't tested that this works. From a cursory glance at the docs it looks like the speed and accel limits are handled by the stepgen function, but it is possible that you might need to use a separate limit3 function.
(A list of all the available HAL realtime components can be found about half way down www.linuxcnc.org/docview/html/ )
In effect, all that is needed to move an axis is a numeric value sending to the stepgen position-cmd pin. How you get that value there is up to you, you can use halcmd as shown above, streamer / halstreamer (www.linuxcnc.org/docview/html//man/man1/halstreamer.1.html) your own pick-and-place "comp" component ( linuxcnc.org/docs/html/hal_comp.html ) or a custom driver that access the HAL shared memory and exports pins that can me linked to the stepgens in HAL) and probably a dozen other ways I haven't thought of yet.
Please Log in or Create an account to join the conversation.
01 Jun 2010 17:43 #3059
by webbyguy
Replied by webbyguy on topic Re:Pick and Place control possible with EMC2?
This is exactly the info I needed. I'll start trying this out soon. (I've got to get my rails and screws set up first, but I'll start reading this now.) Thank you very much.
Please Log in or Create an account to join the conversation.
Time to create page: 0.097 seconds