Up | Example 01 - Calculate Area | Example 02 - Calculate mean value | Example 03 - Manipulate the results from two LineFinders | Example 04 - Dynamic threshold | Example 05 - Auto Exposure | Example 06 - DrawLine | Example 07 - Overlays | Example 08 - Python Objects | Example 09 - Timing | Example 10 - Image Averaging | Example 11 - Image Resampling | Example 12 - Constant Contrast | Example 13 - Serial Communication | Example 14 - Python results | Example 15 - Making a result string | Example 16 - Running tools from a script | Example 17 - Image Manipulation using Python Scripting | Example 18 - Calculating the median angle | Example 19 - Iterating objects located by a blob | Example 20 - Resampling using non-linear calibration | Example 21 - Custom Scorpion Python extension | Example 22 - Accessing Image Pixels | Example 23 - Implementing a tcp/ip Socket Server | Example 24 - Setting ExternalReference from calculated four points | Example 25 - Rotating a reference around in a circle | Example 26 - Grabbing an image from an MOXA Video IP Server | Example 27 - Toolbox Switch | Example 28 - Color Matcher Iteration | Example 29 - Audio Notification | Example 30 - Windows MessageBox | Example 31 -  Client to tcp Socket Server | Example 32 -  Read / Write External Data from / to file | Example 33 - Changing a tool's ROI | Example 34 - Histogram Equalization | Example 35 - Robust Adam 6060 scripts | Example 36 - Bubblesort | Example 37 - Element Statistics | Example 38 - Saving 3D Image | Example 39 - Disabling Zoom in Image Windows | Example 40 - Filtering timeseries | Example 41 - Scorpion Watchdog keep system running | Example 42 - Binary Search | Example 43 - Creating an ordered pointcloud | Example 44 - UDP Socket Communication

 

  

 
Example 41 - Scorpion Watchdog keep system running

This example documents how to communicate with the Resuscitator program to create a watchdog for both Scorpion and a Proscilica camera which is controlled by Scorpion.

The Resuscitator program - also named Scorpion Watchdog - is a program managing tool and is available on the Scorpion CD. This program can control startup, shutdowns sequence and be a watchdog for all kinds of programs.

This example shows how to use it to implement a fast watchdog if a program stops capturing images. 

The example is available on the Scorpion CD and the Scorpion profile is called: Test Prosilica Watchdog.

Example : Test Prosilica Watchdog

Requirements:

  • Python
  • Python for Windows Extentions
  • Resuscitator

must be installed.

Scorpion is started and controlled by Resuscitator and must be closed when it is started from Resuscitator.

The Resuscitator configuration file - Resuscitator.ini -  is placed in the profile base directory.

Scorpion and Resuscitator will communicate as follows:

Scorpion will write two lines in Resuscitator.ini file. They are stated below

[AliveStatus]
status= 1

In our example Resuscitator will check if these two lines has been written every 10 seconds. If they are present in the file, Resuscitator will delete them. If not, Resuscitator will restart scorpion. It is important that Scorpion writes the program lines above more frequently than they are written (for instance every second)

Scorpion setup:

In Central make a function named KickResuscitator as shown below.

def KickResuscitatior(applicationName, iniFileName)
  import win32api
  profile = GetStringValue('System.Profile') # when the code is executed, profile will contain a string with the the path of the current scorpion profile.
  win32api.WriteProfileVal('AliveStatus',applicationName,1,profile + '\\' + iniFileName) #for writing the lines to the file using the win32api (for details read the win32 api)

The script which calls the KickResuscitator function will must be executed both when the Scorpion is IDLE, and when Scorpion is RUNNING. If RUNNING we call Grab action, which gets a snapshot from the camera. When the camera has sent the snapshot, the action AfterInspect will be trigged. In AfterInspect we'll call the KickResuscitator function, which then only is trigged if the camera is working properly. In sytem state idle, we won't check if the camera is operating correctly, and call the KickResuscitator function directly. We will use Scorpion actions and events to enable this. For more information on Scorpion actions and events, klick here

This example implements the strategy above by defining two actions in the actions tab, and one event in the scheduler: CameraTrigger and AfterInspect. After inspect is a system defined event, and should be filled with one new command; command = Script, parameters= KickResuscitator('Scorpion',' resuscitator.ini'). In the camera trigger action we have added two new commands. The first one has the command=Grab and a guard=running. The second one has command = Script, parameters= KickResuscitator('Scorpion',' resuscitator.ini'), and guard = Inverted running. In the scheduler create a new Event. Give it the following attributes; name: nextImage, command: cameraTrigger, frequency: 'every nth millisecond', period: 200

Resuscitator setup:

Place a shortcut to Resuscitator in the startup group, edit the properties:

  Target : C:\Program Files\Tordivel AS\Resuscitator for NT\FindResuscitator.exe
  Start in: "C:\Program Files\Tordivel AS\Scorpion 7\Test Prosilica Watchdog


 

In the Resuscitator program press configure button, and edit the properties for each application:

Under configure for applications: Shutdown
  Program path: C:\Program Files\TORDIVEL AS\Resuscitator for NT\SHUTDOWN.EXE
  Start in: C:\Program Files\TORDIVEL AS\Resuscitator for NT
  Select checkbox: Run at shutdown only


Under configure for applications: Server control parameters
  Program path: C:\Program Files\Tordivel AS\Resuscitator for NT\FindResuscitator.exe
  Parameters: -topmost
  Select checkbox: Watch this program




Under configure for applications: Scorpion
  Program path: C:\Program Files\TORDIVEL AS\Scorpion 6\Scorpion.exe
  Parameters: system="Test Prosilica Watchdog" #This is the profile we want to open with scorpion
  Start in: C:\Program Files\TORDIVEL AS\Scorpion 6\
  Select checkbox: Watch this Program
  Select checkbox: Alive check


For further information of the Resuscitator program, please refer to the Resuscitator help files on the Scorpion CD.

 

 

 

Scorpion Vision Version XII : Build 646 - Date: 20170225
Scorpion Vision Software® is a registered trademark of Tordivel AS.
Copyright © 2000 - 2017 Tordivel AS.