Applying Drools in Assistive Technology
-
Upload
tsurdilovic -
Category
Technology
-
view
4.183 -
download
3
Transcript of Applying Drools in Assistive Technology
PowerPoint Presentation
Applying JBoss Drools in Assistive Technology
Who is Tihomir?
R&D Engineer on Drools
Contributor and committer on Seam
Agenda
Assistive Technology (AT)
Applying Drools in AT
Event Processing
Drools Fusion examples
Vision for the future
Q&A
Assistive Technology
Disability affects 15-20% of every country's population (with 10% being classified with severe motor impairments). Growing trends (aging population, severe stroke).
Categories of disabilities:
- Sensoric deficiencies reduced ability to acquire inputs from the physical world (e.g. blindness, deafness, etc.),- Expression deficiencies reduced ability to produce output to the physical world (e.g. voice, motion, etc.).
Assistive technology (AT) product, device or equipment (e.g. assistive, adaptive or rehabilitative devices) that helps individuals with disabilities to increase, maintain or improve functional capabilities (AT Act, 1998).
AT products help peoples with disabilities to achieve greater independence, enhance their quality of life and compete in the real world (inclusive society).
AT Current situation
Steadily growing market (especially for small businesses, estimation: US$ 12 billion in USA, 30 billion in Japan and 40 billion in Europe)
Modern AT industry sustainable and profitable.
The key problems:
- User View Expensive, not sufficiently flexible and adaptable devices. Slow and not responsive systems, non-transparent, difficult to use, sensitive to disturbances and errors.- Developer View Demands for highly customized products within a huge target-audience, risky business (user acceptance, competitive pricing).
AT research and development
Long term AT research (priorities in several countries).
Main focus: respond to the needs and wants of users.
Close relationships to main-stream researches, such as robotics, cognition, AI, IT, sensor technology, real time control etc.
Attractive common research focuses on:
- human enhancement,- rehabilitation robotics,- human-robot interaction (HRI),- human-computer interfaces (HCI),- brain-computer interfaces (BCI), - computer vision, etc.
AT essential distinctive problem
Extreme individual differences that characterize abilities and needs of motor-impaired people.
Keys to increase acceptance and use
High personalization and customization
Scalability and adaptivity
Improve performance over time
Acquisition/preservation of user experience and knowledge
Improve maintainability and robustness in spite of user and environmental disturbances
AT example: computer access
Computer input devices for motor-impaired people
Mouse cursor control for handicapped individuals (MCC) main operations: pointing and clicking.
Ca. 250 commercial MCC products available at the market worldwide.
Multitude of MCC concepts: switch-related systems (sip/puff switches), head pointing systems, eye tracking systems, BCI etc.
None of them provide a standardized general system for subjects with severe disabilities.
MCC AT principles
Roadmap to success
More complex systems that combine several input channels.
Use of innovative technologies, such as AI approaches, methods and tools (e.g. automated reasoning, first-order logic, fuzzy logic, neural-networks etc.).
Development of standardized HW and SW modules that can be configured for a specific user.
Example: Improve MCC by using fuzzy logic
Convenient simple input device: pneumatic dual-action input switch (sip and puff).
Indirect pointing of target items (scanning) based on Morse codes sequences of dots (sip) and dashes (puff).
Traditional line scanning.
Quite inefficient and tedious, especially for users with limited breathing or learning capabilities.
Why Fuzzy Logic?
Dealing with imperfect information natively
IF direction IS positive AND strength IS weakTHENoutput IS weak_positive
Fuzzy scanning and inference algorithms
Puff/sip define cursor motion directions.
New input air flow defines velocity of cursor moving.
Fuzzy scanning algorithms: circular scan, selection area scan, object selection, etc
Fuzzy control outcomes and limitations
Improved mouse control. Clear step-forward in comparison to the state of art.
Feasible and promising solution for development of sophisticated and adaptive MMC (HCI) systems.
Constraints: relatively good breathing control is needed. Sensitivity to disturbances.
Multi-channel inputs and action outputs (MIMO) can further improve performance and robustness, however fuzzy logic and control applications become extremely complex.
Processing large number of input events becomes problematic.
Beyond just fuzzy reasoning
Needs:production rule system
ability to combine classical predicate logic with fuzzy logic to represent the system as combination of discrete as well as continuous events.
ability to process large number of complex events through multiple input channels.
BPM capabilities
tooling and testing support
ability to embed (parts of) system
One-stop-shop solution??
Drools (1)
Business Logic integration Platform
Drools
Guvnor
Drools
Fusion
Drools
Flow
Drools
ExpertA common platform to model and govern the business logic of
the enterprise.
Expert Rule Engine side, Logic sideFlow advanced process engine, tight integration of processes and rulesFusion Even Processing , CEP integration into DroolsGuvnor - about server-side management, web stuff
Drools (2)
Business Logic integration Platform
Drools
Chance
Drools
Sema-ntics
Drools
Grid
Drools
Planner
A common platform to model and govern the business logic of the enterprise.
Expert Rule Engine side, Logic sideFlow advanced process engine, tight integration of processes and rulesFusion Even Processing , CEP integration into DroolsGuvnor - about server-side management, web stuff
Drools for AT? (1)
Fully integrated logic platform (rule engine, workflow, event processing, etc) that supports easy and frequent change of rules (adaptation to users).
Extensions of the RETE networks using set of pluggable modules.
Drools-Chance (still in development) makes Drools capable of dealing with imperfect information natively. Also adds possibility to configure behavior of the engine to reason with different type of imperfection without changing the production rules.
Tooling support
Ability to test/monitor all parts of AT system.
Ability to run/embed into OSGi environments and future AT devices.
Drools for AT? (2)
Separates applications (AT devices or computer control systems) from conditions which control the application flow.
Changing rules does not require a complete deployment of AT systems.
Provides background to build modular and scalable AT systems, such as integrate additional sensors for a specific user and develop rules, without influencing specific application (e.g. computer or assistive device control).
Rules can be modified by different group of users (technicians, physicians, end-users).
Rule language is simple to learn.
End-users can be involved to resolve conflicts and perform specific actions (improved robustness).
Efficient for frequent change of rules dependent on user experience, health state, specific needs etc.
First steps toward improvement for MCC - Event Processing
Any form of computing performing operations on events
Event: Real world: occurrence of something that has happened at a particular point in time
Comp. Systems: entity/object that represents this occurrence
1 RW Event CS Events
Raw vs. Derived Events
Complex Event: abstraction of a number of related eventsFor example a hurricane is an abstraction of a large number of natural events
Main Concepts of Event Processing
Event Processing Networks (EPN):Producers: introduce/emits events into the processing network (Sensors, Systems, Apps, Business Processes, Human Interaction, etc)
Distribution Channels: provides means of distributing events (typically one-to-many distribution, async)
Consumers: receive and act upon events (Applications, Systems, Data Stores, Business Processes, etc)
Intermediary Processing: rout / filter (raw events), produce (derived events). Consists of a number of building blocks (Agents)
IntermediaryProcessingEventProducersEvent Consumers
Event Processing Agents
Even FilteringEvent MatchingEvent Derivation
time
time
time
Building Blocks for:
Translation,Composition,Aggregation,Enrichment,Splitting,Projection,Pattern Detection,etc.
Event Processing Network (1)
Network based on the core EP building blocks
Can be described as process flows such as Drools-Flow
Event Processing Network (2)
Describing network building blocks with Drools-Flow bring good feature support to EPCustom work item handlers
Testing, debugging, monitoring (and self-monitoring/adapting)
Customizable and easily replaceable network parts
Integration with Human tasks
public class ErrorEventListener implements ProcessEventListener {
public void afterNodeLeft(ProcessNodeLeftEvent event) {ksession.getWorkingMemoryEntryPoint(entryPointName).insert(event);...}
declare ProcessNodeLeftEvent @role( event )end
rule "Number of Cursor Rotations is above threshold"whenNumber( nbProcesses : intValue > 5 ) from accumulate( e: ProcessNodeLeftEvent( nodeInstance.nodeName == "CursorRotationNode" ) over window:size(10s), count(e) )then drools.getWorkingMemory().getProcessInstance(ATDepartmentNotificationProcess).signalEvent("notify", "cursor rotation threshold exceeded");end
Event Processing - Context
Specifies conditions on a group of events so they can be processed in related ways.
Events may/may not be relevant in certain contextsExample: Left-click command can only be issued over clickable objects on screen
Types of contexts:Temporal: consists of time intervals and events within intervals
Spacial: takes account geospatial event info
State-oriented: depends on state of some external entity
Segmentation-oriented: partitions events by their attribute values (for example age >= 35)
Drools Fusion
Drools Fusion Events (1)
Representing Raw Events:
Creating Derived Events:
declare Direction@role( event )@timestamp( timestamp )@expires( 1m )end
declare Strength@role( event )@expires( 1m )end
declare DoubleClick@role( event )direction : Directionstrength : Strengthdelay : intend
rule detectDoubleClickwhen$direction : Direction( ) from entry-point "Raw-Direction-Stream"...$strength : Strength( ) from entry-point "Raw-Strength-Stream"...thenDoubleClick dc = new DoubleClick($direction, $strength, 0);entryPoints["Cursor-Control-Endpoint-Stream").insert(dc);end
Drools Fusion Events (2)
Absence of events in proper order:
Negative patterns, waiting for events to happen:
declare Click@role( event )@expires( 1m )delay : intend
declare Drag@role( event )@expires( 1m )direction : Directionstrength : Strengthdelay : intend
rule invalidDragMotionwhen$dragEvent : Drag( ) from entry-point "Cursor-Control-Endpoint-Stream"not ( Click( this before $dragEvent ) from entry-point "Cursor-Control-Endpoint-Stream" ) // click starts drag eventthen# notify user+system of invalid command...end
rule lenientDragMotionwhen$dragEvent : Drag( ) from entry-point "Cursor-Control-Endpoint-Stream"not ( Click( this before $dragEvent ) from entry-point "Cursor-Control-Endpoint-Stream" )Click( this after[0s,5s] $dragEvent ) from entry-point "Cursor-Control-Endpoint-Stream" then# allow drag motion......end
Drools Fusion Event Streams
Drools compiler gathers all entry-point declarations and exposes them through the session API.
Engine manages all scoping and synchronizations behind the scenes.
Event processing from specific streams in rules:
StatefulKnowledgeSession ksession = ......WorkingMemoryEntryPoint rawDirectionEntryPoint = ksession.getWorkingMemoryEntryPoint("Raw-Direction-Stream");WorkingMemoryEntryPoint rawStrengthEntryPoint = ksession.getWorkingMemoryEntryPoint("Raw-Strength-Stream");// Every time we get input from direction sensor do:rawDirectionEntryPoint.insert(direction);// Every time we get input from flow sensor do:rawStrengthEntryPoint.insert(strength);...
rule detectVerticalScrollingWhen...$direction : Direction( ) from entry-point "Raw-Direction-Stream"$strength : Strength( ) from entry-point "Raw-Strength-Stream"...then...
Drools Fusion - Channels
Eliminates runtime awareness of event consumers.
Dynamic registration of consumers in channels possible.
Example:a) Register Channel:
b) Channel Implementation:
Push derived events for distribution in rules:
StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession(config, null);
ksession.registerChannel("cursor-control", new CursorControlChannel()); ...
public class CursorControlChannel implements Channel {private List controlServices;
@Overridepublic void send(Object command) {for(MouseControlService service : controlServices) {service.publishCommand(command);}}...
rule detectDoubleClickwhen...thenDoubleClick dc = new DoubleClick();...channels["cursor-control"].send( dc );end
Drools Fusion Temporal Event Context (1)
Enable Temporal Context by putting engine in Stream mode:
Choose a Clock type (realtime or pseudo for testing):
...KnowledgeBaseConfiguration config = KnowledgeBaseFactory.newKnowledgeBaseConfiguration();config.setOption( EventProcessingOption.STREAM );KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase(config);...
...KnowledgeSessionConfiguration config = KnowledgeBaseFactory.newKnowledgeSessionConfiguration();config.setOption( ClockTypeOption.get("realtime") );StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession(config, null);...
Drools Fusion Temporal Event Context (2)
Stream Mode Enables:Notion of flow of time, concept of now
Automatic event lifecycle management
Support for sliding windows
Automatic rule delaying on absence of facts
Reference Clock (Session Clock) implementations:
Drools Fusion Temporal Event Context (3)
Sliding Window support allows reasoning over a window of interest:Time
Length
rule "Normalize cursor motion speed"whenCursorSpeedThreshold( $max : max )Number( doubleValue > $max) from accumulate(Strength( $val : value ) over window:length( 200 ), average( $val ))then // normalize the cursor speedend
rule Detect excessive Cursor Rotationwhen Number( intValue > 15 ) from accumulate( CursorRotation( ) over window:time(30s), count(e) )thendrools.getWorkingMemory().getProcessInstance(ATDepartmentNotificationProcess).signalEvent("notify", "cursor rotation threshold exceeded");end
Drools Fusion Temporal Context Operators
13 Temporal Operators
Drools Fusion Temporal Context Operators
What next? -AT vision architecture
Questions?
THANKS!
Project: http://www.jboss.org/drools
Reference Manual: http://www.jboss.org/drools/documentation.html
Blog: http://blog.athico.com/
Mailing Lists: http://www.jboss.org/drools/lists.html
Click to edit the title text format