Window Manager Programmer Notes

The window manager is used to make all the different control station modules to appear to be one application. Any application within the control station system uses the window manager engine to open windows, update menus and configure window placement.

Group Name: g_wm

Development Path: vc_proj/RTSX/cs/ECI/g_wmwm/

Group Id: g_wm

Contents

Form Information
File Menu = wmFileM
Display Menu = wmDisplayM
Arm Menu = wmArmM
DMS Menu = wmDmsM
PMU Menu = wmPmuM
BM Menu = wmBmM
Utility Menu = wmUtilM
Window Manager Standards
Form Codes
Linking to the WindowManger
Adding an Window to the Window Manager
Linking to the Window Manager Utilities

Form Infomation


File Menu = wmFileM

This button brings up the File Menu, Figure 2. This menu allows you to load and save window configurations. The window manager remembers the set up of the user's control station upon termination. That set up is automatically loaded on restart of the control station; all windows are placed in the same location as listed in the window configuration file. Alternative window configurations can be saved and accessed.

 Form Name: wmFileM

Label: N/A

Form Id: N/A

 

Objects
wmFileMLabelObj
[0] File
 
wmFileMCmdObj
[0] Load Window Config ... Button -> wm_fileMenuButtonCB(0)
[1] Save Window Config ... Button -> wm_fileMenuButtonCB(1)
[2] Clean Up Desktop Button -> wm_fileMenuButtonCB(2)
[3] Close Window Button -> wm_fileMenuButtonCB(3)
[4] Quit Module Button -> wm_fileMenuButtonCB(4)
[5] Quit All Button -> wm_fileMenuButtonCB(5)


Display Menu = wmDisplayM

This menu is connected to the window manager and allows the user to access any window.

 Form Name: wmDisplayM

Label: N/A

Form Id: N/A

 

Objects
wmDisplayMLabelObj
[0] Display
 
wmDisplayMCmdObj
[0] DXL -> wm_displayMenuButtonCB(0)
[1] DXR -> wm_displayMenuButtonCB(1)
[2] PXL -> wm_displayMenuButtonCB(2)
[3] VID -> wm_displayMenuButtonCB(3)
[4] DMU -> wm_displayMenuButtonCB(4)
[5] PMU-> wm_displayMenuButtonCB(5)
[6] BM -> wm_displayMenuButtonCB(6)
[7] Utility-> wm_displayMenuButtonCB(7)


Arm Menu = wmArmM

This menu is activated when one of the arms is selected from the Display Menu. It will allow the operator to open/reopen the chosen arm form.

 Form Name: wmArmM

Label: N/A

Form Id: N/A

 

Objects
wmArmMLabelObj
[0] ARM
[1] Overall Control
[2] Diagnostics
[3] Remote Terminals
[4] Bus 1553
 
wmArmMCmdObj
[0] Raw Mode -> wm_subMenuButtonCB(1)
[1] Joint Torque Control -> wm_subMenuButtonCB(2)
[2] Cartesian Control -> wm_subMenuButtonCB(3)
[3] IO Control -> wm_subMenuButtonCB(4)
[4] IO Control -> wm_subMenuButtonCB(5)
 
[5] Force/Torque Sensor -> wm_subMenuButtonCB(11)
[6] Gains -> wm_subMenuButtonCB(12)
[7] Temperature -> wm_subMenuButtonCB(13)
[8] Torque -> wm_subMenuButtonCB(14)
[9] Encoder Control -> wm_subMenuButtonCB(15)
[10] Encoder Offsets -> wm_subMenuButtonCB(16)
[11] Joint Telemetry -> wm_subMenuButtonCB(17)
 
[12] RT State -> wm_subMenuButtonCB(31)
[13] RT Statistics On -> wm_subMenuButtonCB(32)
[14] RT Voltage -> wm_subMenuButtonCB(33)
 
[15] Statistics -> wm_subMenuButtonCB(46)
[16] SubAddress 0-15 -> wm_subMenuButtonCB(47)
[17] SubAddress 16-31 -> wm_subMenuButtonCB(48)
 


DMS Menu = wmDmsM

This menu is activated when the DMS option is selected from the Display Menu. It will allow the operator to open/reopen the chosen DMS form.

 Form Name: wmDmsM

Label: N/A

Form Id: N/A

 

Objects
wmDmsMLabelObj
[0] DMS
[1] Bus 1553
 
wmDmsMCmdObj
[0] Summary -> wm_subMenuButtonCB(31)
[1] Command Authority -> wm_subMenuButtonCB(32)
[2] Error Handler -> wm_subMenuButtonCB(33)
[3] Error Statistics -> wm_subMenuButtonCB(34)
[4] Channel Statistics -> wm_subMenuButtonCB(35)
[5] Message statistics -> wm_subMenuButtonCB(36)
[6] Logging manager -> wm_subMenuButtonCB(37)
[7] Diagnos...Commands -> wm_subMenuButtonCB(38)
[8] All Safe -> wm_subMenuButtonCB(39)
[9] Rates -> wm_subMenuButtonCB(40)
[10] Bus Frame Statistics -> wm_subMenuButtonCB(45)


PMU Menu = wmPmuM

This menu is activated when the PMU option is selected from the Display Menu. It will allow the operator to open/reopen the chosen PMU form.

 Form Name: wmPmuM

Label: N/A

Form Id: N/A

 

Objects
wmPmuMLabelObj
[0] PMS
[1] Bus 1553
 
wmPmuMCmdObj
[0] PMS State -> wm_subMenuButtonCB(51)
[1] PMS A/D -> wm_subMenuButtonCB(52)
[3] Statistics -> wm_subMenuButtonCB(46)
[4] SubAddress 0-15 -> wm_subMenuButtonCB(47)
[5] SubAddress 16-31-> wm_subMenuButtonCB(48)


BM Menu = wmBmM

This menu is activated when the BM option is selected from the Display Menu. It will allow the operator to open/reopen the chosen BM form.

 Form Name: wmBmM

Label: N/A

Form Id: N/A

 

Objects
wmBmMLabelObj
[0] BM
 
wmBmMCmdObj
[0] DXL Cartesian Position -> wm_subMenuButtonCB(11)
[1] DXR Cartesian Position -> wm_subMenuButtonCB(12)
[2] PXL Cartesian Position -> wm_subMenuButtonCB(13)
[3] VID Cartesian Position -> wm_subMenuButtonCB(14)
[4] End Effector/Task -> wm_subMenuButtonCB(12)
[5] BM Point Info 0-9 -> wm_subMenuButtonCB(22)
[6] BM Point Info 10-19 -> wm_subMenuButtonCB(23)


Utility Menu = wmUtilM

This menu is activated when the Utility option is selected from the Display Menu. It will allow the operator to open/reopen the chosen Utility form.

 Form Name: wmUtilM

Label: N/A

Form Id: N/A

 

Objects
wmUtilMLabelObj
[0] Utility
 
wmUtilMCmdObj
[0] Application Load -> wm_subMenuButtonCB(61)
[1] Input Display -> wm_subMenuButtonCB(62)
[2] UDP Messages -> wm_subMenuButtonCB(63)

Window Manager Standards

Window Sizes

Small Windows (1x1) have an internal size of 310 x 220 pixels.

Large Windows (2x2) have an internal size of 630 x480 pixels.

(2 x 3) have an internal size of 630 x 740 pixels.

(4 x 2) have an internal size of 1260 x 480 pixels.

Menus

Menus should be 140 pixels wide,
Each button on the menu is a lightbutton 20 pixels high, 130 pixels wide, Flat boxtype
 
Color

Color is used to provide information to the operator in a compact space. The color of objects can be used to determine the type of object. In the figure below is an example of a form showing three types of objects: command objects, output objects, and inactive command objects. In general objects which colored gray, are command objects and can be manipulated and used to control some function. If the label on that object is black it's currently active. A gray label indicates that the specific object is inactive. Objects which are not gray, generally are colored the same as the background, are output displays only and can not be manipulated.

Many buttons and display indicators use color to convey the current status of the process represented. Below is a chart of the colors used to display information along with definitions used for generic and specific functions.

 Color

 Color Definition

 Generic Definition

 Command Status

Command Authority

 Software Process

 Green

 MOD_RUNNING_COL

 Confirmed On

Command On Confirmed

Authority Given

 Running

 Blue

 MOD_PENDING_COL

 Pending On

Command On given, but not Confirmed

Authority Pending

 Pending On

 Gray

 MOD_DEFAULT_COL

 Confirmed Off

 Command Off Confirmed

No Authority, But Allowed

 Off

 Yellow

 MOD_PENDINGOFF_COL

 Pending Off

 Command Off given, but not Confirmed

Authority Removal Pending

 Pending Off

 Red

 MOD_CRASHED_COL

 Error

 Error

Authority Removed

 Crashed

 Black

 MOD_CANT_COL

 Not Allowed

 N/A

 No Authority, Not Allowed

 N/A

 Dark Gray

MOD_DEACTIVATE_COL

Deactivated Object

 

 

 

 Background Blue

MOD_BACKGROUND_COL

Telemetry Object

 N/A

 N/A

 N/A

The last two colors defined in the table above are used to indicate that an object can not be used to command. When a label of a button or other object is not black, but a dark gray, than that object is inactive. This typically occurs when not in a proper control mode or if no command authority exist. Objects which are the color of the background color can not command either, they are used to monitor output data from the project.

In the figure above there are several sliders in the center of the form. Half of them are colored blue, they represent the commanded data to the vehicle. Since it is not know if that data will make it to the vehicle, it is considered pending. The other sliders are colored green, they represent information from the vehicle, which is confirmed.

Input Fields

Input fields are small boxes that either display text or allow the operator to type in text. There is a minimum size required so that the text can be displayed, the table below shows the height and width according to font size, input box type, and number of characters displayed.

 Helvetica Font Size

Input Field Boxtype

Input Height Pixels

Input Width Pixels

 8

FL_FRAME_BOX

16
18 Bold
6 digits = 40
9 digits = 55

 8

 FL_DOWN_BOX

18

6 digits = 42
9 digits = 58
10 digits = 62

 10

FL_FRAME BOX

22

 

 10

 FL_DOWN_BOX

24

 


Form Codes

The window manager connects all the forms within the control system. One form can open any form. The status of each form is known by the whole system. This ability is done by using individual codes distinguishing each form. These codes are used in many ways and are listed below.

BNF definitions

<a> ::= <armSubsystemID>

<armSubsystemID> ::= "1" | "2" | "3" | "4"
<b? ::= <busSubsytemID>
<busSubsystemID> ::= "0" | "1" | "2" | "3" | "4"
according to subsystem Id for each arm, currently (DXL = 1, DXR = 2, PXL = 3, VID = 4)

 Code

Form/Group Label

Form/Group Name

 

g_armControl

Arm Control

<a>01

ARM Raw Mode

armRawMode

<a>02

ARM Joint Torque Control

armJTC

<a>03

ARM Cartesian Control

armRCC

<a>04

ARM IO Control

armIOC

 

 

 

 

ARM Diagnostic

g_armDiag

<a>11

ARM Force/Torque Sensor

armFT

<a>12

ARM Gains

armGains

<a>13

ARM Temperature

armTemp

<a>14

ARM Torque

armTorque

<a>15

ARM Encoder Control

armEC

<a>16

ARM Encoder Offsets

armOff

<a>17

ARM Joint Telemetry

armJTTel

 

 

 

 

ARM Remote Terminal

g_armRT

<a>31

ARM RT State

armRTState

<a>32

ARM RT Statistcs On

armRTStatOn

<a>33

ARM RT Voltage

armRTVolt

 

 

 

 

Boundary Management

g_bm

1<a>

ARM Cartesian Position

bmarmCP

21

BM End Effector/Task

bmGrip

22

BM Point Info 0-9

bmPT1

23

BM Point Info 10-19

bmPT2

 

 

 

 

Data Management Unit

g_dms

31

DMU Summary

dmsSum

32

DMU Command Authority

dmsCA

33

DMU Error Handler

dmsError

34

DMU Error Statistics

dmsErrStat

35

DMU Channel Statistics

dmsChanStat

36

DMU Message Statistics

dmsMsgStat

37

DMU Logging manager

dmsLogMgr

38

DMU Diagnostic Commands

dmsDC

39

DMU All Safe

dmsSafe

40

DMU Rates

dmsRates

 

 

 

 

Power Management Unit

g_pmu

51

PMS State

pmuState

52

PMS A/D

pmuAD

 

 

 

 

Utility

g_util

61

ECI Application Load

utilLoad

62

Input Display

utilIO

63

UDP Messages

utilUDP

 

 

 

 

 Bus 1553

g_bus

45 

 Bus Frame Statistics

busFrame

 <b>46

 BUS RT Statistcs

busRTStats

 <b>47

 BUS SubAddress 0-15

 busAddr1

 <b>48

 BUS SubAddress 16-31

 busAddr2



Linking to the Window Manager

The following notes are to be used by a programmer to link a new control station module to the window manager. When these changes have been made, the entire control station system should be remade, then all the applications can interface with the new module.

Development Path: ACS/csWindowManager

Files Required

 headers

wm_extern.h

wm_standards.h - when using the standards macros

 files

wm_forms.c - functions which create the window menus

wm_CB.c - holds most functions

 libraries

libforms.a

libforms.so - needed at run time

API Functions

 Function Prototype:

void wm_setupWm(int argc, char *argv[])

 Description:

This function performs the many initialization operations required to run the window manager

 Notes:

Call after fl_initialize()

 Function Prototype:

void wm_checkToOpenWindow (void)

 Description:

This function reads the shared memory segment to determine if any windows of this module require showing or hiding. It the performs the appropriate steps.

 Notes:

 Call in main event loop

 Function Prototype:

void wm_updateMenu (void)

 Description:

This function reads the shared memory segment to determine the status of all windows for all modules in the application. The menus are updated to indicate the windows' staus.

 Notes:

Call infrequently in main event loop

 Function Prototype:

void programQuitCB(void)

 Description:

This function allows the programmer to clean up the local application. This could include freeing memory, closing a file, or terminating additional processes.

 Notes:

Must use the flag -DPROGRAMQUITCB in Makefile to be able to use the function. This fuction will then automatically be called when the application is terminated.


Adding an Application to the Window Manager

wm.c, wm.h

Use forms designer, fdesign, to create new menu item on an exsisting menu or create a new menu.

1) Eg. Adding a button to the Arm Menu, wmArmM

Name: wmArmMCmdObj[i]
where i is unique from all other menu option on that menu
 
CB: wm_subMenuButtonCB(x)
where x is the form code listed.

wmCB.c

wm_init_moduleInfo(void)

If a module was added or the bounds for formIds changed, it must be reflected here.

The <module>Forms[] array definitions should be modified to reflect and additions or modifications to the formId # for each module.

wm_getFormInfoFromId

Add each new form to the switch table, used to identify formNames and labels with their unique id. Remember to do each arm if a new arm form is added.

wm_getIdFromForm

Add each new form to the if block table, used to identify formNames and labels with their unique id. Remember to do each arm if a new arm form is added.

wm_formsFunctions.h

Each from has three functions described above. These function should be prototyped in this file.

void <new form>_init(void);
void <new form>_activate(short activate);
void <new form>_DG(void);

Remember each instance of an arm form should be represented.

<new form>.c

Each new panel must have an associated .c file to hold that panels callback functions. Also three function are included for all forms, which must be added..

void <new form>_init(void)

This function initializes the objects on the form. Setting default values, colors, states, etc.

void <new form>_activate(short activate)

This function changes the state of objects as command authority changes. Command objects are deactivated and dimmed when authority is not granted.

void <new form>_DG(void)

This function updates the values of the objects on the form.

./Makefile

Must add <new form>.c to the FUNC_FILES to the Makefile script in the local directory

RTSX/cs/ECI/main/Makefile

Must add <new form>.c to the sources

If a module(a group of forms) was created or changed

wm.c, wm.h

If a new menu is generated call it wm<new Name>M eg. wmArmM

Buttons of the menu called wm<newName>MCmdObj[i] with a callback of

wm_subMenuButtonCB(x)
where x is the form code listed.

Use the same convention if adding a button to exsisting menu

The new menu should be acessed from the Display Menu, wmDisplayM

Add a button wmDisplayMCmdObj[i]
And its callback should be
wm_menuButtonCB(i)
where i is unique from all other menu option on the Display menu

wmCB.c

Add the #include "<group name>.h" file created by Xforms for the new forms.

wm_initForms(void)

Add a create_forms function for the new module.

wm_initMenus(void)

Add an fl_register_raw_callback for the new display menu item.

wm_init_moduleInfo(void)

If an module was added or the bounds for formIds changed, it must be reflected here.

wm_displayMenuButtonCB

Add a case to the switch statement to handle the new i value, and open the new menu.

./Makefile

Must add create/modify a makefile script to copy any altered .c and .h files to the RTSX/cs/ECI/armSrc and RTSX/cs/ECI/armInclude folders respectively. Use one of the other g_<module name> folders to find a Makefile and change it. Note, If arms are being substituted, should copy a Makefile from one of the arm directories, g_arm<module name>.

RTSX/cs/ECI/main/Makefile

Add a line for the new module, similar to the one below. Use the other lines as a guide.

<MODULE NAME>_SOURCES = [ <new form>.c ]+


Linking to the Window Manager Utilities

The window manager utilities are extensions to the window manager engine. Although not required most control station modules use them. Two utilities are currently in these files. First timing utilities which allow the modules to run a specific loop rate, freeing up the processor for other applications. Second, a utility to fix a bug for applicaitons which monitor the command authrority of the data management system.

Development Path: ACS/csWindowManager

Files Required

 headers

wmu_CB.h

wmu_extern.h - although I haven't needed it yet

 files

wmu_CB.c

 libraries

NONE

API Functions

 Function Prototype:

void wmu_initTimer(short looprate)

 Description:

This function initiates the timer for an application. When wmu_nanosleep is called , the programwill wait until the timer has expired. This allows for a program to run at the speed of the timer, or slower.

The looprate should be passed in, units are in Hz.

 Notes:

Call during initialization and any time to change the main event loop rate.

 Function Prototype:

struct timespec wmu_nanosleep(short looprate)

 Description:

This function is called to put this process to sleep until an event wakes it up or the sleep timer has expired. If an event occurs, once that event is handled the function will put the process to sleep again for the remaining time. If the process has already spent more time than desired. This function will sleep until the end of the next cycle. For instance if a 1 sec looprate is desired, and the current cycle has lasted 2.2 seconds; this function will sleep for an additional 0.8 seconds.

This function also updates the utility preferences form. If this is not desired then compile with

#define NOUTILPREFFORM

 Inputs:

 short looprate - This is the desired looprate, in Hz.

 Outputs:

 This function returns the current time, in the following structure

struct timespec {
long tv_sec; /* number of seconds since the begining of time */
long tv_nsec;/* number of nanoseconds */
}

 Notes:

Called automatically when an alarm is generated, this could be due to the SIGALARM as set when initilaizing the timer. However other alarm messages may call this function as well.

 Function Prototype:

float wmu_getTimeDiff (struct timespec *currentTime, struct timespec lastTime)

 Description:

This function updates the current time as well as provide the number of seconds difference between the new current time and the last time provided.

 Inputs:

struct timespec *currentTime - This is a pointer which will return the current time

struct timespec lastTime - This is the last time, which will be differenced.

struct timespec {
long tv_sec; /* number of seconds since the begining of time */
long tv_nsec;/* number of nanoseconds */
}

 Outputs:

 This function returns the number of seconds (as a float) between the times given.

 Notes:

Call infrequently in main event loop

Only wmu_updateLoopRate or (wmu_forceLoopRate and wmu_sginap) are used in the program not both.