levylabpitt / AFM-Lithography

BSD 3-Clause "New" or "Revised" License
6 stars 0 forks source link

Use Refactored Asylum Driver #25

Closed Monkeymerlot closed 9 months ago

Monkeymerlot commented 4 years ago

Previously I refactored a driver for the Asylum microscopes (MFP-3D and Cypher). There are only a few things that I need to do to finish this driver, and then I think it can be a replacement. I also want to redo the way that we call drivers and swap them. Here are the main things that I see that are bad practices and I should change when adding the new driver.

First, is that we send information by changing values on their front panels using named controls: Current current way to send information to driver Instead we should user User Events.

Second, we currently abort VIs when swapping them inside of a subpanel and at the end. There is a better way to do this: First thing is that you don't need to abort a VI to take it out of a subpanel. Second thing is, you should never abort a VI period. Like ever. There are a few instances when you might have to as a last resort, but you should set up a way to stop them gracefully to begin with. Where we abort subpanel Current method of swapping subpanels that aborts them Current method of swapping a subpanel: Swapping Subpanels So to implement this I think that it would be beneficial to think about having a User Event that will send a stop request. We can wait on some conformation that the VI has stopped. If it has not stopped in a certain amount of time, we can then abort it.

Other, less problematic issues (for now) Use of a global variable for information such as offset and the like.

Monkeymerlot commented 4 years ago

Going to use a Driver Management class. Here is the start up routine: image It takes an array of paths to the drivers, and for each one it will start them, and initialize a cluster of events created for each driver. I initially wanted to do call by reference, but this wasnt possible as we dont have a set front panel where everything is based off of the same interface. For now, I think that setting the event cluster, which is named very uniquely, will suffice. Front Panel of Refactored Driver: image Creation of Events in start up routine: image

Monkeymerlot commented 4 years ago

Shut down flow: image Send Stop Event to all drivers image Give them one second to stop: If they stop in one second: Do nothing If they don't stop in time: Consider them hanging, abort them: image Destroy all User Events image Destroy all VI References image

Monkeymerlot commented 4 years ago

Added functionality to embed into a subpanel: image And I envision its usage like so: image

Monkeymerlot commented 4 years ago

Added steps that are performed after each object is performed. It will write the tip voltage to be zero, and then will move the tip upwards. image

Monkeymerlot commented 4 years ago

Investigation of the lithography program has revealed that the data is sent to the drivers in units of um. To do otherwise would require a significant overhaul in the program it seems. So here it writes the inkscape ratio: image If the size of the image is greater than 100x100 (ie 100x100 um) then it is actually nm, and the ratio is 1000. If it is less than 100x100 um, then it is determined to be in um, not nm, and its ratio is simply 1. It reads it in the Paths Apply Inkscape Ratio: image and Rectangle Apply Inkscape Ratio: image

Monkeymerlot commented 4 years ago

The timing seems to be 50 kHz in the old driver, so I think that its ok to use that value in the new driver as well. image

Edit: Issue #29 discusses this in detail.

Monkeymerlot commented 4 years ago

Abort functionality:

Driver:

In Litho Objects: image Normally we would have used OpenG Wait (ms), but instead we wait with abort in Litho Object Points: image And if Abort Notifier is True: image We send a stop command to the software, and then give it a second. (edit: I want to add that since this doesnt stop the driver, it will stop the current object from being written, and then it will run the Object finish sequence where we set the voltage to zero and lift the tip up. If we happen to get it between objects, which would be exceedingly rare, it should just ignore the next object. If we get it while it is preparing to start the object, once it begins it will immediately stop.)

Heres how we get the abort Abort Notifier Event to Provide Reference to driver. image

AFM_Lithography.vi:

Run button Event will call this code: image Where we create notifier and send it to the driver: image If we then hit "Abort" button while lithography is running: image And once lithography is finished and we get the Lithography Done Event: image

I hope this makes sense.

Monkeymerlot commented 4 years ago

Added Resistor Box with help from @johnbrickmaier and put post object stuff in terminateLithographyObject image Added event call back to post object stuff: image Added abort for initial move: image Fixed bug involving speed on move to initial point (wasnt orignally written, making it zero, thus dividing by zero gave inf, which was the time we would have waited for...) image

Monitored commands and everything looks good. Ready for second code review.

ciozi137 commented 4 years ago

@Monkeymerlot I'm looking at things now and preparing test build. There are some issues with files being in weird places and the Asylum Driver project is inside the AFM Litho project (issues #34 #32 ?) Maybe we should switch to autopopulating folders...?

Monkeymerlot commented 4 years ago

I think the Asylum Driver Project is because of the autopopulating folder that I later got rid of. We can take that out. Everything should be in the right place, but you and I both know that with LabVIEW and source control that only happens when the stars align ¯\_(ツ)_/¯ Ill look into the other issues.

Monkeymerlot commented 4 years ago

image Minor change. I made the move to initial point speed be equal to the value in the old program

Monkeymerlot commented 4 years ago

@aditi-nethwewala Reviewing over the command order. I think that tip down should happen after the move to the initial point? image

Edit: Nevermind, that is ensuring that the tip is up. The tip will set down in part of the actual writing sequence.

Monkeymerlot commented 4 years ago

@ciozi137 I saw that you did a build. I just wanted to make sure that you turned Debug? to False on the driver: image

ciozi137 commented 4 years ago

don't know. I will check

ciozi137 commented 4 years ago

no. it was true. I will fix in v8.6.0.5

ciozi137 commented 4 years ago

Still building 8.6.0.5. It's taking a really long time for the installer for some reason. Will have to come back later to check and commit/push my changes.

ciozi137 commented 4 years ago

That build was terrible. Starting over. Will be 8.6.0.7.

ciozi137 commented 4 years ago

@Monkeymerlot @aditi-nethwewala new build 8.6.0.7 is posted. Code is pushed also

Monkeymerlot commented 4 years ago

Reported issue: (@aditi-nethwewala)

  1. It created a duplicate version of LV 2020 which led to all the programs freezing for the next user. I ultimately had to restart the computer while someone was in between their experiment
  2. After the restart, somehow the lithography got a little messed up. The tip started going to 0,0 position at the start of the writing instead of starting from its last position. I could only get rid of it by uninstalling the exe version.
Monkeymerlot commented 3 years ago

image Got this issue when I was running a built version of the program.

Monkeymerlot commented 3 years ago

With the new build, this should be ready for testing. Hopefully, everything is now in order and should work.

Monkeymerlot commented 1 year ago

@ciozi137 I think we can close this issue out (finally)?