EUTAFT Software

From Control Systems Technology Group
Jump to navigation Jump to search

Main

The only thing that main does is start an instance of mainwindow, if mainwindow is not already active.

Architecture of Qtvision

Mainwindow

Mainwindow functions as the main hub of all other files. Mainwindow consists of a user interface, in which the user can select which function needs to start and can control several options.


Visionsettings

This file starts another ui in which the user can control several settings such as white balance.


Runcmdline

This file is used to start a thread, in which the program can start matlab with a particular matlab file and communicate with matlab. This matlab program is used to calibrate for color. This way, the program will know what colors can be seen as green, which as white, etc. Using this information the program is able to differentiate between the ball and the rest.


Camera

The camera file consists of a set of functions which directly communicate with the camera through the pylon library. Functions such as initializing the camera, grabbing the last frame of the camera, checking to see if the camera is correctly connected, etc. The functions are called from several other files, namely the mainwindow file, which checks if the camera is connected, and the cameracalibrate and visionexecute file, which actually use the camera to receive images.


Cameracalibrate

The cameracalibrate file starts a thread which does two important things. First if all, if the user ticked the box, the cameracalibrate file will start to look at the received video for a checkerboard, which it uses to see in what way the received image is distorted. It creates an undistortionmatrix from this information to improve the received images. This next function of the cameracalibrate file is to select to location in the image of all computer controlled players. The current program is only able to locate the ball, and is not able to locate his own players. As such, the user needs to give the program the location of these players. Cameracalibrate also displays the received images for the user, so the user is able to see everything.



Visionexecute

The visionexecute file is the meat of the program. This file starts a thread which actually uses the received images and all calibration information to play a game of foosball against the user. It is able to start to locate the position and velocity of the ball, through the use of a Kalman filter. It then uses the position of the ball to decide what all the players on the field need to be doing. The desired location and orientation of all players is then saved in memory which is shared with a separately controlled matlab program, which uses this information to control the motors. This matlab program saves the actual location an orientation of the players in the shared memory, which it reads from the encoders. Visionexecute can then use this information to make the next decisions. Visionexecute is also responsible for displaying the received images on screen for the user to see if the program is still able to locate the ball correctly.


Immkf

This file consists of a set of functions which together function as a kalman fitler. These functions are used in visionexecute to locate the position and velocity of the ball.