Making a GUI for Aligning Feeder Positions and Saving the Values to a CSV file

14 Aug 2022 15:23 #249720 by my1987toyota
    This is a bit of an ambitious one for me I want to make a GUI and put in a selectable tab on Linuxcnc so I can
use the on board down look camera to align the feeders then save the positions to the Feeders CSV file.

The challenges needing to be addressed
1 Getting familiar with Gladevcp
2 make a small DRO display with the G53 Machine Coordinate System output while in the Feeders tab
3 make a Jog control in the tab to control the X, Y,  Z, and C axis while aligning
4 have a window that displays the real time down look camera image with cross hairs.
5 When the X and Y position is written to the Feeders CSV file it will apply an offset so while running a PnP program
   the picking head will be over the feeder component instead of the camera.
6 When the down look Camera is selected for feeder alignment it will use the saved X and Y position plus the camera offset
   so the camera will be over the top of the Feeder component to be aligned.
7 When aligning the Z axis the feeder head will move to the X and Y position of the component and allow G53 Z height to
  be set and saved to the Feeder CSV file
8 Allow the use of an external MPG pendant while in the Feeders Tab

That's all I can think of for now. I am hoping I can actually get it to the ultimate form of having the machine use the camera to
auto align the X and Y positions of the feeders. For now though I need a manual way of doing it. One step at a time.

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

20 Aug 2022 23:24 - 21 Aug 2022 12:44 #250136 by my1987toyota
  This week has been a busy week so I haven't been able to accomplish much
 in way of the pick and place. That said I did make some head way with Opencv.
I wrote a simple Python and Opencv program that uses a usb camera and
places a Red cross-hair on the picture. I have a long way to go to get a working
Glade gui but one step at a time.
 I have been looking over dm17ry's vision and configuration and using that to get
a good starting point.

 In my next post I will be placing my Python / Opencv code in text format for
ease of readability. If you wish to test out the program you will need to
go into synaptic package manager and install python opencv if you don't have
it on your computer already. As far as cameras go I am using an
ELP-USB100W03M-L36 . I am placing the Python file for down load as well.
If you run the program and want to exit press the 'q' key on the keyboard.
Last edit: 21 Aug 2022 12:44 by my1987toyota. Reason: adding info

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

20 Aug 2022 23:26 #250137 by my1987toyota
import cv2 as cv

cap = cv.VideoCapture(0);

cap.set(3, 360)
cap.set(4, 360)
#cap.set = 720 X 720
#3 = 600 = 300
#4 = 800 = 400
#cap.set = 360 X 360
#3=352.0 = 176
#4=288.0 = 144

    ret, frame =

#    horz = cv.line(frame, (0, 300), (800, 300), (0, 0, 255), 1)
    horz = cv.line(frame, (0, 144), (352, 144), (0, 0, 255), 1)
#    vert = cv.line(frame, (400, 0), (400, 600), (0, 0, 255), 1)
    vert = cv.line(frame, (176, 0), (176, 352), (0, 0, 255), 1)
    cv.imshow('Top_CamView', frame)
    if cv.waitKey(1) & 0xff == ord('q'):


File Attachment:

File Name:
File Size:1 KB
The following user(s) said Thank You: tommylight

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

14 Oct 2022 10:38 #254108 by my1987toyota
Well I have had to put this idea on the sideline for now. I will come back to it at some other time
just life as usual has changed my schedule.

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

26 Nov 2022 21:27 #257702 by cakeslob
Hey, Ive been meaning to work on this and Dmitry's up camera, but before that I needed to build/install/configure my hardware with c axis before I started on this.

Nothing against qt/glade, but for simplicity I am trying to do everything in an Axis tab with tk/tcl/tkinter, and probably using usercommand file so that is my challenge.

The usercommand file Ive included is your initial file, but with a camera tab created in axis. I am using this as a starting point.

first hurdle : conflicting mainloops between axis and opencv

here is solutions, but Im trying to understand them first (I struggle with OOP)

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

Time to create page: 0.256 seconds
Powered by Kunena Forum