The CISST Software Package Peter Kazanzides Johns Hopkins

  • Slides: 25
Download presentation
The CISST Software Package Peter Kazanzides Johns Hopkins University www. cisst. org November 16,

The CISST Software Package Peter Kazanzides Johns Hopkins University www. cisst. org November 16, 2005 Copyright © CISST ERC, 2005 NSF Engineering Research Center for Computer Integrated Surgical Systems and Technology

Outline • Background and Motivation • Where are we going? • CISST Libraries –

Outline • Background and Motivation • Where are we going? • CISST Libraries – Foundation libraries – Real time support • Development process and tools • Tour of web site Copyright © CISST ERC, 2005 NSF Engineering Research Center for Computer Integrated Surgical Systems and Technology

Historical Background • ERC-developed software was captured in: – CIS library • • Common

Historical Background • ERC-developed software was captured in: – CIS library • • Common tools, such as logging Vectors, matrices, transformations Interface to tracking systems Numerical methods, registration, … – MRC library • Common interface to different robots • Essentially a “wrapper” around API for hardware that provides low-level control Copyright © CISST ERC, 2005 NSF Engineering Research Center for Computer Integrated Surgical Systems and Technology

Robot Controller Architecture Supervisory/Trajectory Control (~100 Hz) Servo Control (~1000 Hz) Application Read Sensors

Robot Controller Architecture Supervisory/Trajectory Control (~100 Hz) Servo Control (~1000 Hz) Application Read Sensors API Compute Goal on Trajectory Interpolate Setpoint Compute Joint Goals Compute Control Hardware Application (non-real-time) cisst. MRC Copyright © CISST ERC, 2005 NSF Engineering Research Center for Computer Integrated Surgical Systems and Technology

Motivation for CISST Package • Improve process, design, testing, portability, maintainability for open source

Motivation for CISST Package • Improve process, design, testing, portability, maintainability for open source release and to facilitate clinical use: – – – Programming standards Design reviews Portable build tools Automated testing User documentation • Enable the development of real-time software for physical devices such as robots and trackers Copyright © CISST ERC, 2005 NSF Engineering Research Center for Computer Integrated Surgical Systems and Technology

Motivation for Real Time Support • Motivated by transition from motion controller boards (with

Motivation for Real Time Support • Motivated by transition from motion controller boards (with processor and vendor’s software) to I/O boards (no processor) and research software I/O Boards (non-intelligent) Motion Controller Boards (intelligent hardware) Copyright © CISST ERC, 2005 NSF Engineering Research Center for Computer Integrated Surgical Systems and Technology

Example: Teleoperation of Snake Robot Control PC (RTAI/Linux) I/O and Amps Master Robots Lo.

Example: Teleoperation of Snake Robot Control PC (RTAI/Linux) I/O and Amps Master Robots Lo. Po. Mo. Co Control PC (RTAI/Linux) Slave Robots I/O and Amps Lo. Po. Mo. Co Copyright © CISST ERC, 2005 NSF Engineering Research Center for Computer Integrated Surgical Systems and Technology

Example: Image-Guided Robot for Rodent Research PC (Windows) 3 D Slicer Copyright © CISST

Example: Image-Guided Robot for Rodent Research PC (Windows) 3 D Slicer Copyright © CISST ERC, 2005 Servo Control and Amps (Galil) DMC-2143 Robot NSF Engineering Research Center for Computer Integrated Surgical Systems and Technology

Where are we going? C++ Software Libraries • cisst libraries • other libraries Distributed

Where are we going? C++ Software Libraries • cisst libraries • other libraries Distributed Interface static linking Frameworks dynamic loading • Based on system complexity • Component of larger system Copyright © CISST ERC, 2005 frozen spots hot spots Binary components • hardware interfaces • research algorithms NSF Engineering Research Center for Computer Integrated Surgical Systems and Technology

CISST Libraries Foundation libraries – Open source* Sept 2005 cisst. Common cisst. Vector cisst.

CISST Libraries Foundation libraries – Open source* Sept 2005 cisst. Common cisst. Vector cisst. Numerical cisst. Interactive • cisst. Interactive ~Nov 2005 Real Time Support cisst. OSAbstraction cisst. Device. Interface cisst. Realtime Interventional Devices cisst. Tracker cisst. MRC • (Mostly) Stable • Beta version – Open source ~Jan 2006 • Work in process – cisst. Tracker ~Jan 2006 – cisst. MRC ~June 2006 … *www. cisst. org, current license based on Slicer 2. x, goal is Slicer 3. 0 Copyright © CISST ERC, 2005 NSF Engineering Research Center for Computer Integrated Surgical Systems and Technology

cisst. Vector • Vectors, Matrices and Transformations • Extensive use of C++ templates (metaprogramming)

cisst. Vector • Vectors, Matrices and Transformations • Extensive use of C++ templates (metaprogramming) • Fixed size and dynamic – Fixed size especially suited for real-time code • Operations on slices and sub-regions • References to vectors and matrices – Improves interoperability with other libraries • Matrices in row-major or column-major format • C++ wrapping of Net. Lib (numerical methods, including CLAPACK, MINPACK) Copyright © CISST ERC, 2005 NSF Engineering Research Center for Computer Integrated Surgical Systems and Technology

Fixed Size Vectors and Matrices • Templated by: – Element type (int, double, etc.

Fixed Size Vectors and Matrices • Templated by: – Element type (int, double, etc. ) – Dimension (number of rows, columns, etc. ) • Efficiency considerations (for templated dimension): – Loop is easy, but not efficient for small vectors: int Sum() { sum = 0 for (i=0; i < _size; i++) sum += data[i]; return sum; } – Recursive function also not efficient: int Recursive. Sum(int size){ return (size == 1) ? data[0] : Recursive. Sum(size-1) + data[size-1]; } int Sum() { return Recursive. Sum(_size); } – Recursive template (template metaprogramming) is efficient: • Compiler “unwraps” recursive template into straight-line code Copyright © CISST ERC, 2005 NSF Engineering Research Center for Computer Integrated Surgical Systems and Technology

Fixed Size Vectors and Matrices • Operations provided by “recursive engines”: – Classify operations

Fixed Size Vectors and Matrices • Operations provided by “recursive engines”: – Classify operations by: • • Number of operands Type of result Storage location for result – Small number of engines handle all operations • Example: same engine for addition, subtraction, … Copyright © CISST ERC, 2005 NSF Engineering Research Center for Computer Integrated Surgical Systems and Technology

cisst. Numerical • C++ Interface to Net. Lib code (Fortran) • Versions for fixed

cisst. Numerical • C++ Interface to Net. Lib code (Fortran) • Versions for fixed size and dynamic operands • Can pre-allocate solution object – More efficient if multiple calls made vct. Dynamic. Matrix<double> A(rows, cols, VCT_COL_MAJOR); nmr. SVDSolution. Dynamic solution; solution. Allocate(A); while (1) { vct. Random(A, 0. 0, 10. 0); nmr. SVD(A, solution); // A = U*S*V’ cout << solution. Get. U() << … } Copyright © CISST ERC, 2005 NSF Engineering Research Center for Computer Integrated Surgical Systems and Technology

cisst vs. VNL • cisst. Vector/cisst. Numerical benefits: – More efficient fixed size vectors

cisst vs. VNL • cisst. Vector/cisst. Numerical benefits: – More efficient fixed size vectors (few loops) – Stride allows operations on slices (e. g. , can access matrix columns as vectors) – Matrices can be in column-major format (more efficient with Net. Lib) • VNL benefits: – Mature package, larger development community – More features (polynomials, Matlab file I/O, …) – Support for more compilers Copyright © CISST ERC, 2005 NSF Engineering Research Center for Computer Integrated Surgical Systems and Technology

Python Interface • • • Automatic wrapping of C++ for Python (Swig) Object registry

Python Interface • • • Automatic wrapping of C++ for Python (Swig) Object registry to share objects between languages Can load cisst libraries into Python shell Can start Python shell from C++ program GUI features provided by cisst. Interactive (using wx. Widgets) Copyright © CISST ERC, 2005 NSF Engineering Research Center for Computer Integrated Surgical Systems and Technology

Device Interface • Device Hierarchies: Can lead to complexity! Tracker Tool Get. Position Robot

Device Interface • Device Hierarchies: Can lead to complexity! Tracker Tool Get. Position Robot Tool Get. Position Move. To. Position Should be able to use robot in place of a tracker Copyright © CISST ERC, 2005 NSF Engineering Research Center for Computer Integrated Surgical Systems and Technology

Device Interface • Our solution: query with string to obtain command object (Command Pattern)

Device Interface • Our solution: query with string to obtain command object (Command Pattern) Initialize (e. g. , from XML) ddi. Device. Interface Abstract Base Class Return list of implemented operations (strings) Configure Provides Get. Method. By. Name Tracker Tool Robot Tool Provides { “Get. Position” } Copyright © CISST ERC, 2005 Return command object for specified operation (string) … { “Get. Position”, “Move. To. Position” } NSF Engineering Research Center for Computer Integrated Surgical Systems and Technology

Device Interface class my. Task : public rts. Task { private: ddi. Device. Interface*

Device Interface class my. Task : public rts. Task { private: ddi. Device. Interface* dev; ddi. Command* cmd; public: void Startup(); ··· Non-real-time dev = ptr to device dev Configure(…); cmd = dev Get. Method. By. Name(“Get. Position”); ··· void Run(); }; Copyright © CISST ERC, 2005 ··· cmd Execute(data); Real-time ··· NSF Engineering Research Center for Computer Integrated Surgical Systems and Technology

Real Time Support 1. Devices and Tasks should be interchangeable: – – Example: Servo

Real Time Support 1. Devices and Tasks should be interchangeable: – – Example: Servo control via an intelligent device or via a software task Solution: Task class derived from device class, but also includes a device ddi. Device. Interface rts. Task Copyright © CISST ERC, 2005 NSF Engineering Research Center for Computer Integrated Surgical Systems and Technology

Real Time Support 2. Maintain time history of important state data – State Data

Real Time Support 2. Maintain time history of important state data – State Data Table (SDT), indexed by time and data id 3. Task communication with Command Pattern: – – – Read from Task SDT or Device Write to Task Mailbox or Device Command object can handle remote communications High-level task (low frequency) Low-level task (high frequency) mailbox SDT Copyright © CISST ERC, 2005 Command objects SDT Command objects Device Interface Hardware NSF Engineering Research Center for Computer Integrated Surgical Systems and Technology

cisst. Real. Time ddi. Device. Interface map <string, ddi. Command. Base *> Operations rts.

cisst. Real. Time ddi. Device. Interface map <string, ddi. Command. Base *> Operations rts. Time. Index osa. Thread Device Index. Reader Index. Writer â â State. Data. Table Ticks vector < rts. Time. Ticks > rts. State. Data. Table State. Vector. Data. Names Legend: Member of Inherits from Instance of (snapshot) State. Vector ddi. Command. Base _device* bool (_device: : *)() Copyright © CISST ERC, 2005 Position Mail. Boxes vector <osa. Mail. Box > rts. Task Thread. Buddy osa. Thread. Buddy Output Desired Voltage Position vector <string> vector < rts. State. Data. Array. Base *> [0] [1] [2] rts. State. Data. Array. Base Device template<_device> template<_type> ddi. Command rts. State. Data. Array Data vector <_type> Action NSF Engineering Research Center for Computer Integrated Surgical Systems and Technology

CMake Build Instructions Documentation Development Tools Build Environment CMake (e. g. , VC++, gcc/make)

CMake Build Instructions Documentation Development Tools Build Environment CMake (e. g. , VC++, gcc/make) La. Te. X Formatted Documentation (e. g. , pdf, html) Doxygen Libraries CVS Repository SWIG Wrapped Source Library Binaries Compile (static & dynamic, e. g. , cisst. Vector, cisst. Common) (source control) Test Applications Compile Cpp. Unit Link Py. Unit Link Test Results CTest Dart 2 (dashboard) Test Programs Applications Optional Interpreter (IRE) Scripts CVSTrac (bug/feature requests) Copyright © CISST ERC, 2005 NSF Engineering Research Center for Computer Integrated Surgical Systems and Technology

Quick Tour of the Web Site www. cisst. org/resources/software Copyright © CISST ERC, 2005

Quick Tour of the Web Site www. cisst. org/resources/software Copyright © CISST ERC, 2005 NSF Engineering Research Center for Computer Integrated Surgical Systems and Technology

Development Summary • Tools adequately manage implementation, (unit) testing and maintenance phases of development

Development Summary • Tools adequately manage implementation, (unit) testing and maintenance phases of development – Automated testing will be hard for physical devices • Much documentation is manually created (not enforced by the process) – Requirements, risk analysis, (high-level) design, validation – User guide, tutorial, quickstart • We needed Dart sooner than we expected! – gcc is getting pickier! – Windows static/shared libraries (dll export) Copyright © CISST ERC, 2005 NSF Engineering Research Center for Computer Integrated Surgical Systems and Technology