LitePlacer-rmod Updates

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

Re: LitePlacer-rmod Updates

Post by thereza »

It's annoying not being able to use version control and rely on a large number of zip files. unable to get git to work, i've uploaded the source to an svn server i found online.

https://www.assembla.com/code/liteplace ... es/1/trunk

Feel free to back-port the code to git if you like.

I rewrote the slack compensation so it only kicks in if the last movement was not in the intended direction.

there are a few outstanding issues like when i start up, someones one of my cameras doesn't turn on and i need to power-cycle the app 3 times for it to turn on.

also i've not found a way to dispose of old frames and get a frame _now_ for computation -- with the higher resolution images there was a delay which made some of the calculations break so I reverted to a smaller image. I really want to figure out a way to grab images in a different thread and just display them on my thread with reduced lag.
JuKu
Site Admin
Posts: 1110
Joined: Thu Feb 14, 2013 3:06 pm
Location: Tampere, Finland
Contact:

Re: LitePlacer-rmod Updates

Post by JuKu »

> also i've not found a way to dispose of old frames and get a frame _now_ for computation

There might not be one. I tried that too, but USB, camera drivers, Windows and the image processing library all seem to have buffering. To get the current image, there should be a way to tag a frame at the camera level and get an event when that particular frame is available for video processing. It seems that there is nothing towards that; I ended up just waiting and/or retrying.
thereza
Posts: 138
Joined: Fri Feb 13, 2015 11:49 pm

Re: LitePlacer-rmod Updates

Post by thereza »

I found a way... I knew something must exist. Had to go digging through the source to find this - couldn't find anything by googling.

_videoSource = new VideoCaptureDevice(MonikerString);
VideoSource = new AsyncVideoSource(_videoSource, true);

the 2nd argument to AsyncVideoSource tells it to drop frames when the handler is busy. Running a quick tests shows that my capture rate is at 30fps but when I turn on some filtering (i.e. noise filtering 1 that is known to be slow), it shows that it recieved 30 frames but only processed 5, so 25 frames were dropped. This should solve the issue of missing _now_ frames.

Only problem is that now, when I close the form, something prevents me from quitting the application and I suspect it's this..

Reza
JuKu
Site Admin
Posts: 1110
Joined: Thu Feb 14, 2013 3:06 pm
Location: Tampere, Finland
Contact:

Re: LitePlacer-rmod Updates

Post by JuKu »

> The only issue/question I have is that I see no need for the job offset as the offset will be captured in the machine coordinates.

That is there for cases when CAD data origin is not at board low left corner.
thereza
Posts: 138
Joined: Fri Feb 13, 2015 11:49 pm

Re: LitePlacer-rmod Updates

Post by thereza »

fair enough.

solved the race issue that wasn't letting me quit (2 issues) - had to pull in the async source and modify it as part of the problem was there. The other issue is that the code to cleanup the async handler wanted the video processing to complete before continuing and the video processing code was handled on the main thread so there was yet another race condition. had to call the cleanup code from a separate thread and that fixed it.

most everything is working and i should be putting out the binaries soon for testing. the only issue is that calibration(s) are complicated and i would like a way to simplify them. like what order things need to happen and what events require different components to be re-calibrated.

i think you should consider adding the pressure sensor as a standard component of your build -- or do you not have the same bad-pickup issue that I have?
thereza
Posts: 138
Joined: Fri Feb 13, 2015 11:49 pm

Re: LitePlacer-rmod Updates

Post by thereza »

So reimplemented the transform code a bit differently based on https://en.wikipedia.org/wiki/Kabsch_algorithm

made some tweaks and it seems quite robust as long as you have enough fiducials to give you a singular solution. by limiting the degrees of freedom to just rotation and translation it simplifies everything greatly. how much did you pay for the homogony transform code?

once i get a board built with the latest code, i'll release some binaries.
thereza
Posts: 138
Joined: Fri Feb 13, 2015 11:49 pm

Re: LitePlacer-rmod Updates

Post by thereza »

I couldn't figure out how to find the holes for clear tape so I implemented component based detection. Same as the fiducial template matching, you specify an image to correspond to a part, point to the first one, and it will determine the slope and spacing of the parts.

The nice part is that all the code I wrote allows for arbitrary filter generation and if a filter ends with 'Tape' then it will be added as a tape type and automatically used by the code.

the vacuum code is working well though if it doens't pick up the first time, it never seems to pick up. I have it set to retry 5 times and skip to the next one if it fails.

-r
thereza
Posts: 138
Joined: Fri Feb 13, 2015 11:49 pm

Re: LitePlacer-rmod Updates

Post by thereza »

Added support for quick addition of tapes. If you have a bunch of tapes spaces evenly then you can specify the list of them and their offsets and it will auto-add and auto-calibrate them all in sequence. got tired to entering tapes one at a time and this speeds it up greatly. all the tapes have to be of the same type (i.e. paper) with the components all facing the same direction.

A few more minor tweaks and I'll be finished.

Only outstanding thing that I dont want to deal with is documenting all the changes in functionality. There are a lot. Hopefully people it'll be intuitive enough.
thereza
Posts: 138
Joined: Fri Feb 13, 2015 11:49 pm

Re: LitePlacer-rmod Updates

Post by thereza »

Ok, I've worked out enough bugs and have used the software (with the pressure part pickup detection) to build a board. This is an early alpha/beta release of the software if you want to give it a shot.

The installer is attached to this post. and I wrote up some quick docs on getting it working :

1. under calibrations & locations set the machine size under max machine (it will not let you move till this is set)

2. Home the machine

3. in the cameraview form, select show filters, down camera to 'homing' and add filters to configure the homing circle detection. I use threshold of 80 and invert. click save when done

4. move the homing mark (or any other circle) under the cross. specify a ballpark figure for the downcamera enclosing box size under calibrations & locations (i.e. 5mm), set click calib downcamera. you should get a spread of crosses across the screen. adjust the calib move distance till you get good spacing of them. if it gives you an out of bounds error, try calibrating a dot anywhere on the table.

5. move then needle over a spot on the table where these is nothing (and should remain clear) and select set location -> needle zeroing in the pulldown menu. under the calibrations tab perform the following calibrations and follow on screen instructions:
a) backoff
b) needle height <-rerun whenever needle changed
c) pcb thickness


6. move needle over the upcamera and select set location -> up camera in the pulldown menu. adjust the needle height till it is in focus. You specify the needle height from the table surface in the 'focus height' field under the calibrations tab then click on 'to focus' in the bottom of the screen to verify that it's positioned correctly and well focused. don't worry about centering it fully,just get it close. in the camera view form, select the needle filter and set it up so that the needle center can be detected. click save when done. mine is set using a threshold of 220 and a zoom of 3.

6. click upcamera calib under calibrations tab. same idea - start out with anything, perform the calibration, then adjust the cliab distance and repeat till results look good. calibration is performed at the focus height.


7. under the calibrations and locations tab, click on camera offset and follow the instructions. After calibrating, the upcamera location will be adjusted such that the needle is perfectly centered at that location just in case. Use Note that 'upcamera zero' to repeat the zeroing if needed.

you're ready to operate. quick notes :

-if you want to add a pressure sensor, you'll need to read the posts I made on the subject and enable the pressure sensor preset value. it will also require you to reflash the firmware on the tinyg and to set a deltavalue (i use 50 for my device).

- there are two ways to add a tape - by hole or by fiducial. after adding the tape and selecting the necessary config options, move the camera over a tape circle and click 'hole calib' to add by holes. for fiducal detection :
- create a new down camera filter that must end in 'Tape'. This can include an empty filter (i.e. NoFilterTape) as template matching doesn't need anything to work. If you add a filter, you'll have to quit and restart the application currently - will be fixed shortly.
- move the camera over the part with whatever filter applied (or no filter) and ensure that no markup is enabled (i.e. turn off the cross). Use snip.exe (comes with windows) or some other capture tool to capture an image of the part. ensure it is centered and some of the bounding area (i.e. tape background) is also present. save it. use a picture editing program if needed to touch it up.
- specify the part pitch
- click part calib and speicfy the saved snapshot.

- for fiducal detection, you can also use the same approach - just take a snapshot of the fiducial you want, specify it using the ... button under fiducial settings on the calibrations tab, enable 'use template' and modify the fid regexp to match the fiducial designator of your choise (i use test points denoted as TP1, TP2 so my regexp is ^TP. ^FID? means that it starts with FI or FID).

- when you save a job it also saves all the associated components and settings except for job offset.



bugs -

sometimes the cameras don't startup - i have to restart the program 3 times when this happens - still investigating why.

probably lots more. just let me know
Attachments
LiteplacerRmod-A1.zip
(3.73 MiB) Downloaded 548 times
thereza
Posts: 138
Joined: Fri Feb 13, 2015 11:49 pm

Re: LitePlacer-rmod Updates

Post by thereza »

added support for qfn detection and placement. will detect center of qfn and angle of qfn, and place it with the required rotation on the PCB. I had it misaligned by quite a bit for testing and it worked great. will update svn with the enhancements shortly.
Image

instructions :

- create a filter that allows detection of the part in the tape with the 'detect rectangle' checkmark selected. ensure filter name ends in 'Tape'
- add the tape and select QFN for part type and the filter you made for the tape type. you will be required to add this as a 'part calib' part using an unfiltered image of the part as a template. again, just a quick screen capture of the part is sufficient. be sure to set the part spacing correctly first before selecting part calib.

changes :

- removed support for filters for fiducal part detection so the template must be without any filtering applied. i saw no need for filtering for this.

Other comment:

- for part alignment on the tape, i use posx/posy/negx/negy but they correspond to 0,90,180,270 deg. for the part in question (that was placed), my cad program considers that 0deg. it was rotated 90 relative to that in the tape. So in the tape holder, i selected posy to denote the 90deg tape rotation.
Post Reply