EUTAFT Log

From Control Systems Technology Group

Jump to: navigation, search

We're in the process of updating the computer and camera of the football table. We took the existing software as a starting point; first goal is to make this work on the new hardware (meaning pc + camera).

There are currently two main parts of the software:

  • the Vision software, a c++ based application
  • and the Motion software, a Simulink based model

Vision

Quick update on what has been done on the Vision software so far:

  1. Made the new pc 'ready' by installing the required libraries etc.
  2. Updated deprecated functions etc. in Qtvision software, such that the project could be build on the new computer at all. A more detailed log of this can be found in the git, but it shouldn't be necessary to dive into this again.
  3. Took the old camera, and further debugged the code on the new pc. (For your reference, a working version of this project is located in the git in dev/elise/old/9-12-19)
  4. Took the new camera, and updated the camera calls in the old code. A log of this (and also the previous step) is also located in the git (dev/elise/3-1-20). I do advise to take a look at this, because this is basically where I left off. (I will put a copy of the most recent version of Qtvision in dev/kevin in the git.)

Let me try and explain that last point a bit more in detail and afterwards what needs to be done now...

Simply put, a new camera means a new API. Instead of using PvApi, we now use the Pylon API. PvApi is a C based library that was used in camera.c/camera.h to implement the camera functionalities. This was then compiled into another library (in terminal while being root user "make && make install" in SVN_backup/src/camera) that was used in the rest of the Qtvision project. Pylon API has a C++ API, so the camera related code is now included in the Qt Creator project itself (camera.cpp & camera.h).

For documentation & example code of the features of the Pylon API, go to: https://docs.baslerweb.com/features.html

So what now? We can grab images using the new camera (yay) with our Qtvision application, so the next step would be to have a better look at the processing of these images. Most of this is done in visionexecute.cpp, but there are also still a few things that need another look in camera.cpp as well (please ctrl+F for TODO!). As can be seen when running the program the view is a bit green. Green = Black...yep, due to post-processing black pixels are displayed greenish right now, this needs to be solved! Increasing the exposure time (ET in the GUI) already helps a bit, because more light (duh)... There are a few camera settings (see camera.cpp) and post-processing (visionexecute.cpp) that should be looked into. Furthermore, we need to re-calibrate, the old wiki explains how to do this (http://cstwiki.wtb.tue.nl/index.php?title=Football_Table_Vision). There are four things one can calibrate:

  1. Puppet spacing: open Camera Calibration tab, and click start.
  2. Undistortion: open Camera Calibration tab, check recalibrate, and click start.
  3. Color calibration: open Vision Calibration, make sure the paths are correctly set (e.g. something like /usr/local/MATLAB/R2011a/bin/matlab and ../tools/colorcalibrate/cc.m), click start. This is a separate tool. I didn't use it yet, so chances are that it requires a bit of debugging before it runs properly. You could also just see how well the current color calibration works, but I think it'll need some recalibration...
  4. Masking: I don't think this is needed, since we're using a red ball.

To be able to do calibration, the callback for grabbing one frame instead of continuously grabbing needs to be implemented still (camera.cpp => OnGrabbedImage() function).

Getting started

  1. Open a new terminal -> sudo qtcreator
  2. Open the Qtvision.pro file located in SVN_backup/Qtvision/
  3. Save, build, and run using respectively ctrl+S, ctrl+B, and ctrl+R

Camera

  • Testing with the new camera : just plug in the USB cable.
  • Want to use the old camera? : use Ethernet cable. It doesn't always connect properly, so I mostly just left the Ethernet plugged in and only disconnected the power, saves quite some time. Furthermore, if you don't need the Ethernet and power cables anymore, please return them to Harrie van de Loo, because I borrowed them from him and he'd like them back :) Especially power cable!

Motion

To compile the motion (by running make.m), Matlab 2011a is needed, because the Termination Block in the Simulink model is deprecated. A short log of what has been done to upgrade the motion so far can be found in the git (ADDLINK). But I actually just suggest reading the Motion page on the old wiki (http://cstwiki.wtb.tue.nl/index.php?title=Football_Table_Motion), this should give you all information you need.

Getting started

  1. Open a new terminal -> sudo /usr/local/MATLAB/R2011a/bin/matlab
  2. Both make.m and the Simulink models (to compile a certain version of the model, copy it and rename it to MOTION.mdl) can be found in the root of SVN_backup
Personal tools