From Saturday, Nov 23rd 7:00 PM CST - Sunday, Nov 24th 7:45 AM CST, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Saturday, Nov 23rd 7:00 PM CST - Sunday, Nov 24th 7:45 AM CST, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
08-16-2016 11:38 AM - edited 08-16-2016 11:39 AM
This is my first labview project, and while the VI runs, I need some help with error handling, and would appreciate some general tips for more effective programming with labview. The purpose of my project is to stabilize a laser beam over time to account for thermal drift. To do this, we are using a webcam to lock on to the current manually aligned position of a laser beam, compare the template position to the current position over time, and adjust the mirrors accordingly if there is any drift detected. To do this, we must control a piezo motor controlled mirror mount, using an AG-UC2 controller, which is connected to the computer with the webcam.
When I run the VI, the program will hold the position over short periods (~5 min) over time; we have yet to let it sit and run for longer. When we manually adjust the laser beam, the program is sometimes able to move the beam back to it's original position and hold; other times it will continue moving in the same direction until the beam is completely out of the camera's view. Often times, if we move the beam in the positive y direction (for example), it can move the beam back down as needed; however, if after that, we move it in the negative y direction without quitting and restarting the program, it is unable to bring the beam back to it's original position. We know that one of the motors on the mirror mount is finicky, although it will work fine sometimes. I'm trying to implement solid error handling so I can determine which of these errors is attributable to the program, and which are due to the damaged piezo motor on the mirror mount(i.e.: the program is processing new images correctly, determining which direction to move, sending the signal to the controller, and the controller sends instructions to the mirror mount, but the motor itself is unable to successfully expand/contract to move the camera accordingly). Thanks for any help!
08-16-2016 11:57 AM
i am adding my 2 cents for general tips
@Stevies304 wrote:general tips for more effective programming with labview.
First try simpifying code by using subvis: http://www.ni.com/white-paper/7593/en/ and using Project if you have multiple filess : http://www.ni.com/white-paper/7197/en/
08-16-2016 11:58 AM
Error handling depends very much on the application. You'll want to think of critical errors, non-critical errors, and warnings.
Critical Errors: Someone could get hurt or something could get damaged. Put the dangerous piece of equipment into a safe state or shut it down. It's always nice to log the error to some kind of a text file. You may also want to show the user a pop-up, make something on the front panel turn red, or send an email. It's always better to include more information than less, like the timestamp, what went wrong, and any applicable sensor readings.
Non-Critical Errors: Something isn't working right. Let the user know that something went wrong. If it is a piece of equipment let them know which one. It still would be good to log the error.
Warnings: Something isn't as expected, but the show can still go on. If an input is invalid, let the user know. It might also make sense to fix it behind the scenes. For instance, if the user tries to enter a save path that doesn't exist, you might create the folder because that is how the software is meant to function.
08-16-2016 12:16 PM
Are you asking about errors as in errors returned by sub_VI calls OR "error" as in the diffrence between were teh centroid is and where it should be?
Ben