FIRST Robot Simulator - ByteMonitorObject


What Is Performed

ByteMonitorObject provides monitoring of variables. It does not simulate any functions of the robot. Instead, its purpose is to assist in debug.


Where Used

ByteMonitorObject.tcl will typically be sourced in TheSimulationPanel.tcl. The declaration for ByteMonitor_new will then also be created in TheSimulationPanel.tcl.


GUI View

The name and value of the chosen variable are displayed.


Programmers View

There are two proc[edures] in ByteMonitorObject.tcl. The first few lines of each proc lists the parameters required.

  proc ByteMonitor_New { {ByteObjName} {NameOnCanv} {variable} \
			 {FgCol} {BgCol} } \
  {
    # ByteObjName = Unique name for the byte object.
    # variable = The name of the variable being monitored,
    #		generally in ::name form.
    # FgCol and BgCol = Foreground and Background colors.
  
  proc ByteMonitor_Update { {ByteObjName} } \
  {
  

Typically ByteMonitor will be managed by CanvasObject. If so, there is no need to explicitly call ByteMonitor_Update.


Example

We can put a group of bytemonitors inside a canvas object using code like this:

  source {ByteMonitorObject.tcl}

  set Fg {#000000}
  set Bg {#9f8f9f}
  set canvasname [Canvas_new byte .byteCanvas $Bg $Fg  {Byte Monitor}]
  # ByteMonitor_New {ByteObjName} {NameOnCanv} {var} {FgCol} {BgCol}
  set labelname [Canvas_IncludeObject byte ByteMonitor_Update pwm01_bmon]
  ByteMonitor_New {pwm01_bmon}   $labelname {::pwm01}   $Fg $Bg
  pack $labelname -side top
  # repeat the last three lines for as many variables as you want to monitor.
  pack .byteCanvas -side top
  

The declaration above is in TheSimulationPanel.tcl. The double colons in front of each variable name makes them operate at the root namespace of the Tcl program. Notice that the call to Canvas_IncludeObject passes the ByteMonitor_Update call with the name of the ByteMonitor object.

Since the byte monitor is considered a standard object for the robot system, its Canvas_update is in RoboSystem.tcl. However, if you are creating an additional byte monitor canvas, you should place its update in Updates.tcl.

  Canvas_UpdateAll byte
  

Caveats



Last modified 10 Dec 2006
http://brown.armoredpenguin.com/~abrown/contact.html
http://brown.armoredpenguin.com/~abrown/first/first2005/Simulator2005/ByteMonitorObject.html