Software Design Document TheraWii Tim Chagnon Joe Kokinda Andrew Meinert Don Naegely April 7, 2009 Revision 7

SRS Revisions Date 2/1/2009 2/1/2009 2/2/2009 2/2/2009 2/3/2009 2/3/2009 2/3/2009 2/3/2009 4/6/2009 4/6/2009 4/6/2009

Description Created the document Added Profile & UI UML Added Storage UML & Text Added Architecture Diagram Added wiiuse, Therapy UML Added Controller, State, Game Data Storage, Model Methods Formatting GUI Task Editing Sequence Diagram

Revision 0 1 2 3 4 5 6 7 8 9 10

i

Editor Tim Chagnon Andrew Meinert Joe Kokinda Tim Chagnon Tim Chagnon Don Nagely Joe Kokinda Tim Chagnon Andrew Meinert Tim Chagnon Joe Kokinda

Contents 1 Introduction 1.1 Purpose . . . . . . . . . . . . . . . . . 1.2 Scope . . . . . . . . . . . . . . . . . . 1.3 Definitions, Acronyms, Abbreviations . 1.3.1 Physical Therapy . . . . . . . . 1.3.2 Nintendo Wii . . . . . . . . . . 1.3.3 Software . . . . . . . . . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

1 1 1 1 1 1 1

2 Design Overview 2.1 Description of Problem 2.2 Technologies Used . . 2.3 System Architecture . 2.4 System Operation . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

1 1 2 2 2

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

3 Requirements Traceability

3

4 Therapist Interface

3

5 Game Interface

6

6 Input Devices Subsystem

6

7 Data Model and Storage 7.1 Data_Storage . . . . . 7.1.1 Attributes . . . 7.1.2 Methods . . . . 7.2 Data_Model . . . . . 7.2.1 Attributes . . . 7.2.2 Methods . . . . 7.3 DSxml . . . . . . . . . 7.3.1 Attributes . . . 7.3.2 Methods . . . . 7.4 DScsv . . . . . . . . . 7.4.1 Attributes . . . 7.4.2 Methods . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

8 References

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

7 10 10 10 11 11 11 12 12 12 13 13 13 15

ii

Software Design Document

1 1.1

TheraWii

Introduction Purpose

The purpose of this document is to describe the implementation of the TheraWii Software described in the TheraWii Business Requirments. The TheraWii Software is designed to create and perform physical therapy activities.

1.2

Scope

This document describes the implementation details of the TheraWii Software. The software will consist of a two major functions. First to design therapies that are made up of tasks, and the second to perform the therapies. This document will not specify any actual therapies or the testing of the software.

1.3 1.3.1

Definitions, Acronyms, Abbreviations Physical Therapy

Posture The orientation of any body segment relative to the gravitational vector. It is an angular measure from the vertical [1]. Balance The dynamics of body posture that prevents falling. It is related to the inertial forces acting on the body and the inertial characteristics of body segments [1]. Center of Mass (COM) A specific point at which the system’s mass behaves as if it were concentrated [1]. Center of Pressure (COP) The point location of the vertical ground reaction force vector. It represents a weighted average of all the pressures over the surface of the area that is in contact with the ground. It is also called the Center of Balance (COB) [1]. 1.3.2

Nintendo Wii

Wii Remote Device that communicates through Bluetooth wireless protocol to the Nintendo Wii Gaming System. Data communicated includes button press and releases, accelerometer readings, and an Infrared (IR) LED pointing system. Wii Balance Board Device that communicates the COP through Bluetooth wireless protocol to the Nintendo Wii Gaming System. 1.3.3

Software

Therapy A series of tasks that is completed in one session. Session A given time in which a user completes a therapy. Task A subunit of a therapy that has an objective with success and fail criteria.

2 2.1

Design Overview Description of Problem

Traditional physical therapy techniques are often limited to activities that provide little to no statical feedback and technologies that provide this type of feedback are normally expensive. The TheraWii Software will use Nintendo Wii technology to provide physical therapists with data in a economical and efficient approach.

April 7, 2009

1

Software Design Document

2.2

TheraWii

Technologies Used

The TheraWii Software will communicate with input devices designed for the Nintendo Wii. The required devices include the Wii Balance Board, the Wii Remote, and the Wii Nunchuck. These devices will communicate with the software through Bluetooth wireless protocol. The target platform will be Microsoft Windows, and the development environment is Microsoft Visual Studio 2008. The therapies will be implemented in the Microsoft XNA game development framework.

2.3

System Architecture

Figure 1 depicts the high-level system architecture. The system will be constructed from multiple distinct components: • Therapist Interface — The windowed interface for constructing and editing Therapies, and viewing or exporting profiles. • Game Interface — The simple game-like environment for executing Therapies and collecting data. • Wii Library — The interface for maintaining Bluetooth connections to Wii input devices and generating input events. • Data Model — The classes needed to organize Therapies, Tasks, Profiles, Sessions, etc. • Data Storage — The interface for storing, importing and exporting the data model and raw collected data.

Figure 1: TheraWii Architecture

2.4

System Operation

Figure 2 is the typical sequence of events that occur during a TheraWii session.

April 7, 2009

2

Software Design Document

TheraWii

Figure 2: TheraWii Sequence Diagram

3

Requirements Traceability

Requirement [r1.*] [r3.*] [r4.*] [r5.*] [r6.*] [r7.*] [r8.*] [r9.*]

4

Description Inputs Menus Therapy Editing Task Editing Profiles Exporting Session Details Therapy Execution

Design §6 §4, Fig. §4, Fig. §4, Fig. §4, Fig. §7 §4, Fig. §5

Reference 3 3 4 5 5

Therapist Interface

Figure 3 depicts the UML model for the Therapist Interface. Figure 4 depicts the UML model for each of the task editing forms. Figure 5 depicts the UML model for the Profile interface. Most of the methods in these class diagrams represent callback functions for user input events.

April 7, 2009

3

Software Design Document

TheraWii

Figure 3: Main Therapist Interface

April 7, 2009

4

Software Design Document

TheraWii

Figure 4: Task Editing Forms

April 7, 2009

5

Software Design Document

TheraWii

Figure 5: Profile Forms

5

Game Interface

Figure 6 depicts the UML model for the Game class.

Figure 6: Game UML

6

Input Devices Subsystem

Figure 7 depicts the UML model for the WiiController Interface.

April 7, 2009

6

Software Design Document

TheraWii

Figure 7: WiiController UML Figure 8 depicts the UML model for the WiiControllerState Interface.

Figure 8: WiiControllerState UML

7

Data Model and Storage

The Data Model and Storage classes control loading and saving the profile and therapy information. The Data Model holds the in-memory data while the Data_Storage class makes it possible to save the information in XML and CSV formats. Figure 9 depicts the UML model for the Profiles/Sessions Data Model.

April 7, 2009

7

Software Design Document

TheraWii

Figure 9: Profile/Session Data Model Figure 10 depicts the UML model for the Therapy/Task Data Model.

April 7, 2009

8

Software Design Document

TheraWii

Figure 10: Therapy/Task Data Model Figure 11 depicts the UML model for the Data Storage.

April 7, 2009

9

Software Design Document

TheraWii

Figure 11: Data Storage

7.1 7.1.1

Data_Storage Attributes Name dataPath

7.1.2

Type String

Description Contains the main directory for the storage of Profiles and Therapies

Methods

Vector getTherapies(String dataPath) Input: Output: Description:

Vector getProfiles(String dataPath) Input: Output: Description:

April 7, 2009

A String that contains a file or directory of Therapies A vector of objects of the Therapy Class loaded from the given directory or file Method returns a vector of Therapy objects from the given directory or file

A String that contains a file or directory of Profiles A vector of objects of the Profile Class loaded from the given directory or file Method returns a vector of Profiles objects from the given directory or file

10

Software Design Document

TheraWii

String getDataPath() Input: Output:

Void A String that contains the main directory for the storage of Profiles and Therapies Method returns the data path of the main storage directory

Description:

Void getDataPath(String dataPath) Input: Output: Description:

7.2 7.2.1

Data_Model Attributes Name therapies profiles tasks

7.2.2

A String that represents the main directory that contains Profiles and Therapies Void Method sets the main directory that contains Profiles and Therapies

Type Description Vector Contains a vector of Therapies that can be performed VectorContains a vector of Profiles of users that can perform Therapies Vector Contains a vector of Tasks that can be used to create Therapies

Methods

Vector getTherapies() Input: Output: Description:

Void addTherapy(Therapy therapy) Input: Output: Description:

Vector getProfiles() Input: Output: Description:

Void addProfile(Profile profile) Input: Output: Description:

April 7, 2009

Void Returns a vector of Therapies that are stored in memory Method returns a vector of Therapy objects that are stored in memory

A Therapy Object that has been created or loaded Void Method adds a new Therapy to the vector of therapies stored in memory

Void Returns a vector of Profiles that are stored in memory Method returns a vector of Profiles objects that are stored in memory

A Profile Object that has been created or loaded Void Method adds a new Profile to the vector of profiles stored in memory 11

Software Design Document

Therapy getTherapy(int index) Input: Output: Description:

Profile getProfile(int index) Input: Output: Description:

Vector getTasks() Input: Output: Description:

Task getTask(int index) Input: Output:

7.3 7.3.1

TheraWii

The number of the Therapy requested from the vector of Therapies Returns the Therapy that is in the index position of the vector of Therapies Method returns the Therapy that is in the index position of the vector of Therapies

The number of the Profile requested from the vector of Profiles Returns the Profile that is in the index position of the vector of Profiles Method returns the Profile that is in the index position of the vector of Profiles

Void Returns a vector of Tasks that are available to create new Therapies Method returns a vector of Tasks that are available to create new Therapies

The number of Tasks Returns the the vector of Task that is Tasks

of the Task requested from the vector Task that is in the index position of Tasks Description: Method returns the in the index position of the vector of

DSxml Attributes Name Type Description sessionDetailsFields VectorContains a vector of Strings indicating the names of the fields for a session dataPath String Contains the main directory for the storage of sessions

7.3.2

Methods

Void DScsv(String dataPath) Input: Output: Description:

April 7, 2009

String that contains the main directory for the storage of sessions Void Method sets the main directory for the storage of sessions

12

Software Design Document

Vector read(String dataPath) Input: Output: Description:

Void write(String dataPath) Input: Output: Description:

Vector getSessionDetails() Input: Output: Description:

7.4 7.4.1

TheraWii

String that contains the main directory for the storage of sessions Vector of Strings representing the data in sessions Method returns a vector of session details from the given Directory or File in csv format

String that contains the main directory for the storage of sessions Void Method writes a vector of session details to the given Directory or File in csv format

Void Vector of strings that represent the session details Method returns a vector of strings that represent the session details

DScsv Attributes Name Type Description therapyFields VectorContains a vector of Strings indicating the names of the fields for a Therapy profileFields VectorContains a vector of Strings indicating the names of the fields for a Profile dataPath String Contains the main directory for the storage of Profiles and Therapies

7.4.2

Methods

Void DSxml(String dataPath) Input: Output: Description: Vector read(String dataPath) Input: Output: Description:

April 7, 2009

String that contains the main directory for storage Void Method sets the main directory for storage

String that contains the main directory for the storage of Profiles or Therapies Vector of Strings representing the data in Profiles or Therapies Method returns a vector of strings representing Therapies or Profiles from the given Directory or File in xml format

13

Software Design Document

Void write(String dataPath) Input: Output: Description:

Vector getTasksFields() Input: Output: Description:

Void setTasksFields(vector fields) Input: Output: Description:

April 7, 2009

TheraWii

String that contains the main directory for the storage of profiles or therapies Void Method writes a vector of Profiles or Therapies to the given Directory or File in xml format

Void Vector of strings that represent the fields that create a Task Method returns a vector of strings that represent the fields that create a Task

a vector of Strings representing the fields names that make up a Task Void Method sets the vector of strings that represent the fields that create a Task

14

Software Design Document

8

TheraWii

References

[1] Winter, D. A. A. B. C. (Anatomy, Biomechanics, Control) of Balance during Standing and Walking. Waterloo Biomechanics, Waterloo, Ontario, Canada, 1995.

April 7, 2009

15