RobotStudio event

GTPU debugging tool

Options

GTPUDebug.zip

Here is a VB class that I have written to assist with debugging on the physical GTPU. What this class does is create a new "Debug listener" object that redirects debug messages to a text file.

Presently, if you use debug messages, i.e. System.Diagnostics.Debug.Writeline, these messages will be written and displayed to the WinCE console application that lives on the GTPU, which is in theory nice.

Unfortunately, it is not possible to resize the console window and it takes up the entire screen, so one cannot interact with their application while it is running. Until someone figures out how to control the size of the console window, this was the only alternative I could come up with.

One possibility for using this tool is to  use it to write to a special debug window within your application. I have included some VB sample code for setting up the class below:


Public
Sub PrepareGTPUDebugListener()
'####################################################################
'
' Name: PrepareGTPUDebugListener()
'
' Abstract: This sub will hide the default listener, add our custom
' listener class, and initialize the location variables
' where files will be created and saved
'
' Parameters: none
'
' Returns: none
'
' Notes: You must declare an instance of the GTPUDebug class, for example
' "Public GTDB As New GTPUDebug", before trying to use it, and have a
' reference to a controller, i.e. "ctrl" as shown below, declared
' prior to calling this sub.
'
' To stop logging debug messages to this text file, call
' GTPUDebug.Close() elsewhere in your program.
'
' You will probably need the following Imports statement:
' "Imports System.Diagnostics.TraceListenerCollection"
'
' Revisions: Created 6/1/2005 3:06:58 PM
'
'####################################################################
'note: we remove the default listener otherwise messages will be written to
'the WinCE console window as well, which cannot be resized and can only be closed
'the default listener is accessed as "Default"
'comment this next line out to allow messages to be written to console
System.Diagnostics.Debug.Listeners.Remove("Default")
'we add our an instance of our listener class to the collection
System.Diagnostics.Debug.Listeners.Add(GTDB)
'get the location on the GTPU where the file will be created
strLocalDir = ctrl.FileSystem.LocalDirectory()
'get the location on the controller where the file will be saved
strRobotCtrlDir = ctrl.FileSystem.RemoteDirectory()
'open our listener class by giving it a directory parameter
GTDB.Open(strLocalDir)
End Sub

###########################################

Sample Usage of Debug.Writeline


System.Diagnostics.Debug.WriteLine("Start init at " & Now.ToLongTimeString())
RussD38505,2528125
Russell Drown