Code Contributions to the software

mrandt
Posts: 407
Joined: Mon Apr 27, 2015 10:56 am
Location: Stuttgart, Germany

Re: Code Contributions to the software

Post by mrandt »

Hi Reza,

now you have the code published to GitHub in your own fork, you need to create a pull request.

By doing this, you tell the repository owner (Juha) to review and merge your changes back to main branch.

IMHO this is really cool about git... Helps distributed and diverse teams to contribute to the main branch while making sure the it stays functional and quality standards are met.

You can create the pull request from your Git client or the website, there is a corresponding button on the top right:
2015-05-25 15_42_00-thethereza_LitePlacer.png
2015-05-25 15_42_00-thethereza_LitePlacer.png (21.65 KiB) Viewed 4883 times
2015-05-25 15_41_38-thethereza_LitePlacer.png
2015-05-25 15_41_38-thethereza_LitePlacer.png (9.65 KiB) Viewed 4883 times
Thanks for your hard work on this - the autocalibrate is great!!!
mrandt
Posts: 407
Joined: Mon Apr 27, 2015 10:56 am
Location: Stuttgart, Germany

Re: Code Contributions to the software

Post by mrandt »

RinusDamen wrote:I've taken the files of thereza from Github, how can I install it?
I've also used the alternative download link, it gives me an installer, but no liteplacer software, is that correct?
Hi Rinus,

Reza has created his own installer. You need to download two files - the installer "setup.exe" plus the installer package "Installer.msi".

Put them in the same folder and run the setup.exe to install Reza's modified version to C:\LitePlacer.

If anyone wants to work on or compile the code from GitHub, you will need to setup a development environment with Visual Stuido 2013 (Express) and the necessary prerequisites (libraries, etc.) as described by Juha.

Cheers
Malte
RinusDamen
Posts: 32
Joined: Sun Apr 05, 2015 5:51 pm

Re: Code Contributions to the software

Post by RinusDamen »

Hi Malte,

I've tried exactly as you told, without success, I start feeling stupid, what did I do wrong?
I have liteplacer installed on C:\liteplacer and added both setup and installer in the same folder, run setup it installs the installer .... that's it...
Nothing happened to the camera tab, no new button...
mrandt
Posts: 407
Joined: Mon Apr 27, 2015 10:56 am
Location: Stuttgart, Germany

Re: Code Contributions to the software

Post by mrandt »

RinusDamen wrote:I have liteplacer installed on C:\liteplacer and added both setup and installer in the same folder, run setup it installs the installer .... that's it...
Nothing happened to the camera tab, no new button...
Sorry, my bad. By default Reeza's installer puts the files into:

Code: Select all

C:\Program Files (x86)\LitePlacer
I think I manually changed folder during install to:

Code: Select all

C:\LitePlacer
Just to be safe, I deleted the existing directory before.

Please note that you probably need to reconfigure the visual processing for homing etc. after installing Reeza's version.

I also had to change privileges to read-write in filesystem, otherwise the settings would not save when closing the program.

I have tested the "Calibrate" button and functionality, but still have a few issues I will probably need to fix in sourcecode.

Juha's latest change, resize behaviour of the image boxes, is not included in Reeza's version. Thus higher resolution cameras only show a limited viewport on "Setup Cameras" tab.

Also, the measurements taken by the calibrate function are off by a factor of about 1.8 on my machine - box size is 7.5 mm while calib function results in about 4 mm. I have to figure out why that happens.
thereza
Posts: 138
Joined: Fri Feb 13, 2015 11:49 pm

Re: Code Contributions to the software

Post by thereza »

I've made changes to the code that are not available in the binary - I'm working on rewriting the tape management code as I think there are bugs in it but I can't track the workflow - so I'm having a go at just rewriting it. My problem is that it keeps trying to pick up a part to the left of the tape independent of however I have configured it.

I'll post an updated installer soon. And It looks like it installs it but doesn't add a link to the file - so you would have to go to the directory and run it from there directly.

Has anyone gotten it to run yet? I'm not 100% if all the required libs are getting packaged and distributed correctly. Please PM me if you need help so I can figure out what bugs I need to correct.

Reza
mrandt
Posts: 407
Joined: Mon Apr 27, 2015 10:56 am
Location: Stuttgart, Germany

Re: Code Contributions to the software

Post by mrandt »

Hi Reeza,

I am using the latest version of Juha's LitePlacer code without any problems on my machine. The tape position and pickup works like a charm for me.

Intended behaviour is that the needle will try to pickup the part top left of the sprocket hole - so you might have to teach it the second hole as "Hole 1".

Also, you should verify that you did calibrate the relative camera to needle distance (tab "Setup Cameras", button "Calibrate Needle") correctly. This step takes extra care, I use a large printed cross on paper to match needle position with camera.

I have your version running as well, but the auto calibration yields implausible results. Box size measured is about 7.5mm - auto calibration results in about 4mm - which is obviously not correct.

Also, please make sure to the the pictureBox.SizeMode to "CenterImage" on all camera images like this:

Code: Select all

this.Cam_pictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
This ensures that people using cameras with higher resolution see the center part of the image and not just a small viewport of the top-left higher res camera image.

Thanks!
thereza
Posts: 138
Joined: Fri Feb 13, 2015 11:49 pm

Re: Code Contributions to the software

Post by thereza »

thanks for the feedback. I noticed that change and have reincorporated it into my code - i will double check though.

curious about the auto-calibrate - do you have the zoom checkboxes turned on in the bottom of the screen? I can dump some debugging output that might help elucidate the problem.

Also, finished up redoing the tape code. Most all the code relies on various tables to store data which isn't terribly efficent, in my opinion. Not to criticize Juha at all - he's done a great job - I just have a different way I like to code. I like keep the business logic very terse and easy to follow and let classes handle the ugly stuff.

In order to not break the rest of the code, I added a 'TapeObj' class which will read and parse a row from the tape table, and then you can do simple things like get the position of any arbitrary part, etc. I also added a PartLocation class which implements object based operations. It makes it simple as you can then just compute offset vectors and then apply a rotation based on the tape orientation to find thing.

For example, this code is used to show where the holes and components are that will next be picked up

Code: Select all

TapeObj to = new TapeObj(Tapes.GetTapeRow(row));
 for (int i=0; i<3; i++)   DownCamera.MarkA.Add((to.GetHoleLocation(i) - to.GetHoleLocation(0)).ToPixels().ToPointF());
for (int i=to.CurrentPartIndex();i<to.CurrentPartIndex()+5;i++) 
                DownCamera.MarkB.Add((to.GetPartLocation(i) - to.GetHoleLocation(0)).ToPixels().ToPointF());
I added List<PointF> MarkA and MarkB to make it so you can draw markers on the screen more easily without having to add functions.

Image

I'll do a bit more testing, then check in the code and upload new binaries.
thereza
Posts: 138
Joined: Fri Feb 13, 2015 11:49 pm

Re: Code Contributions to the software

Post by thereza »

i'm having some issues with the needle calibration - it's consistently off by a bit and i was able to modify the values in the needle offset boxes to compensate - but I suspect there is a problem with the needle calibration that's causing it. in looking at the code, it doesn't look like it takes the needle wobble into consideration when making that measurement but uses the compensation when applying it. but I was able to place some components and they weren't that far off (0402s).

The latest code has been uploaded again to the same folder - same filenames- but it should install a shortcut as well so it'll be easier to use. it's not pretty but it's a start.

https://www.dropbox.com/sh/ic2jtr1qi3is ... 4UJla?dl=0

the big change is the enhancements to the tape code as I mentioned. I'll check in the changes in a couple minutes (in git) in case anyone wants to check them out.
mrandt
Posts: 407
Joined: Mon Apr 27, 2015 10:56 am
Location: Stuttgart, Germany

Re: Code Contributions to the software

Post by mrandt »

Hi Reeza,

I tested the latest version on my machine.

First, I had to go to Windows Control Center, select "Remove / Uninstall Program" and uninstall what was just called "Installer" - I guess you did not label your application in the installer package. Until I did that, the new installer would not let me install as there was already "another version of this program installed".

After installing from your new package, I had to manually change file system privileges of the program folder to grant all users full access - otherwise the settings (SQLLite tables?) would not save.

Once these issues were out the way, I tested the auto calibration again. Unfortunately, I had no luck still. I made sure "Zoom factor" for downward cam was disabled, I also tried enabling this but it did not make any difference. However, it seems to me as if the result were influenced by the visual processing filters I set for "Homing". After removing the "Measure Zoom" filter I normally use, the calibration results were closer to the true size but still not accurate. Even worse, they are not deterministic. If I run the procedure multiple times in a row, it yields different results each time. Without the "Measure Zoom", the circle detection is not very accurate either.

Also, there seem to be issues in conjunction with homing cycle. After running the auto calibration, I can no longer home the machine as it does not recognize the circle of my homing mark any longer. If I enable circle detection and project the filter to display, the homing mark is detected and marked orange in the picture. But if I click "Measure button", the status window shows "no results". If I close and restart the application, this works again - homing and measure button.

I did not have the time yet to install Visual Studio on my LitePlacer PC (it is a different machine than my regular computer) and debug / step through your code to see what is really going on - but something is clearly going wrong here :-( The debug output in status window is not helping me much at this point, as the camera measurements are not displayed but just the machine movements. I think it is worthwhile adding these.

Maybe it has to do with camera resolution? My downward cam has 1920x1080 pixels.

Last not least, I tested the tape functions. At first glance, these seem to work. I like the projection of the pickup locations - but as the pixel to mm setting was wrong due to my auto calibration attempts, they also appear in the wrong location... I need to manually measure again and retry tape functions, will do that tomorrow.
thereza
Posts: 138
Joined: Fri Feb 13, 2015 11:49 pm

Re: Code Contributions to the software

Post by thereza »

Thanks for the feedback. Not sure how to better configure the installer to take care of these issues automatically. Anyone know?

The software spits out a purple blob of text when you do the calibration - can you copy and paste that?
It assumes that there is one circle that it can detect the location of as the camera moves - and it uses the homing function to do so. This function is to be run right after you do the homing, so it expects to see the homing dot (though it will work with any dot). Go to setup camera, down camera, and select homing to display. turn on find circles. then move the the camera up and to the right a bit - it should still see the circle in all the frames. it then computes an average slope based on the values. here are mine :

---- AUTO OPTICAL CALIBRATION ----
CircleX,CircleY,MovementX,MovementY
0.2,0.2,-5.5,4.5
0.7,0.7,-19,19.5
1.2,1.2,-34.5,35
1.7,1.7,-50.5,50.5
2.2,2.2,-65.5,67
2.7,2.7,-79.5,82.5
3.2,3.2,-95,98
3.7,3.7,-110.5,113.5
4.2,4.2,-125.5,129.5
-0.03333333 Xmm/pixel 0.032 Ymm/pixel

So you can see the X,Y coordinates for the move, and the pixel locations where it finds the dots. If you plot the 1st and 3rd column or the 2nd and 4th, you should get a straight line.

I've been doing more work on the tape detection. I really should make a list of my tape objects be the data source for the grid, but i've been trying to synchronize the data back and forth between the two which has been a headache. I also notice that it's slow detecting the nearest circle so I have it designed to measure the location of a number of circles, do a linear regression to compute the slope, and use that in computing the locations of the components. Initial results look promising - though it's a bit tricky.

Also after some time, the image switches to a big X and I'm not sure why - but the image works in other views. Not sure how to debug that.

Image
Post Reply