Distributed State,                 Events and Commands                 :: with OpenSplice DDSOpenSplice DDS               ...
OpenSplice DDS        Foundations
Defining a System                                                      Cyber/Physical.                                     ...
Defining a Distributed System                                                      Cyber/Physical.                         ...
State in a Distributed System                 ¨   The State of a distributed system                      is the collectio...
Stimulus in a Distributed System                                                                         Cyber/Physical.  ...
State vs Stimulus                                                        Temp            State%                           ...
Are Commands Different?                                                            Cyber/Phisycal                       Sy...
State Events andOpenSplice DDS                 Commands in DDS
OpenSplice DDS           State in DDS
Distributed State with DDS                                                                            Copyright	  2010,	  ...
State’s DDS QoS                 Topics representing state should have the following QoS Settings                          ...
Soft-State’s DDS QoS                 Topics representing soft-state, meaning state that is periodically                   ...
Accessing State in DDS                 ¨   The DataReader.read operation should be used to                               ...
Example            [1/3]                                                                         Copyright	  2010,	  Prism...
Example               [2/3]                      The Topic and DataReader would be constructed as                         ...
Example               [3/3]                                                                      Copyright	  2010,	  Prism...
OpenSplice DDS           Events in DDS
Distributed Events with DDS                                                                            Copyright	  2010,	 ...
Events’ DDS QoS                 Events should have the following QoS Settings                                             ...
Events’ DDS QoS                 Events should have the following QoS Settings                                             ...
Accessing Events in DDS                 ¨   The DataReader.take operation should be used to                              ...
Example            [1/3]                                                                            Copyright	  2010,	  Pr...
Example               [2/3]                      The Topic and DataReader would be constructed as                         ...
OpenSplice DDS                                                                      ¨                                    ...
Commands in DDSOpenSplice DDS
Commands in DDS                 ¨   As explained earlier commands are just a kind of                                     ...
OpenSplice RMI                 ¨   Enhances OpenSplice with the ability of defining distributed                          ...
Example                  [1/2]                                                            struct Region {                 ...
Example                [2/2]                                                        struct Region {                       ...
OpenSplice DDS                                                                                  Using DDS RMI         Copy...
OpenSplice DDS           Demo
Autonomous Robots                                         [1/2]                 ¨   Let’s build a system in which        ...
State, Event, Commands                                            Copyright	  2010,	  PrismTech	  –	  	  All	  Rights	  Re...
Demo in ActionOpenSplice DDS
Summing Up                 ¨   All Distributed Systems can be decomposed into State and                                  ...
References                                                                       Copyright	  2010,	  PrismTech	  –	  	  Al...
:: Connect with Us ::                   ¥ opensplice.com         ¥ forums.opensplice.org                                ...
Upcoming SlideShare
Loading in …5
×

Distributed Events, State and Commands

1,993 views

Published on

Distributed Systems can be thought of as a collection of computations evolving a distributed state in response to stimuli. These stimuli can be events triggered by certain states or by external entities, such as physical entities like sensors, operators, etc.

The Data Distribution Service (DDS) provides first-class support for representing distributed states as well as asynchronous event distribution. Recently, OpenSplice DDS has added a new feature that simplifies synchronous interactions by means of a Remote Method Invocation (RMI) infrastructure implemented directly over DDS.
In this presentation we will first explain the difference between state, events and commands and how these concepts can be used to structure distributed systems. Then we will show the key idioms for implementing distributed state, events and commands with OpenSplice DDS.

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,993
On SlideShare
0
From Embeds
0
Number of Embeds
11
Actions
Shares
0
Downloads
90
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Distributed Events, State and Commands

  1. 1. Distributed State, Events and Commands :: with OpenSplice DDSOpenSplice DDS Angelo CORSARO, Ph.D. Chief Technology Officer OMG DDS Sig Co-Chair PrismTech angelo.corsaro@prismtech.com
  2. 2. OpenSplice DDS Foundations
  3. 3. Defining a System Cyber/Physical. Copyright  2010,  PrismTech  –    All  Rights  Reserved. World. ¨ A set of interacting System. or interdependent Input& !  State& Output& parts forming an !  Transi"ons&OpenSplice DDS integrated whole s"mulus& (events/commands)&&
  4. 4. Defining a Distributed System Cyber/Physical. Copyright  2010,  PrismTech  –    All  Rights  Reserved. World. ¨ A Distributed System Distributed. is a System whose Input& System. Output& !  State& parts can only !  Transi"ons& interact byOpenSplice DDS communicating over s"mulus& a network (events/commands)&&
  5. 5. State in a Distributed System ¨ The State of a distributed system is the collection of the states of its Cyber/Physical. Copyright  2010,  PrismTech  –    All  Rights  Reserved. parts plus the stimulus currently World. propagating through the system Distributed. ¨ As Distributed Systems don’t System. Input& Output& share memory, one problem to !  State&OpenSplice DDS !  Transi"ons& address is how to access arbitrary subsets of its state (or of its parts) s"mulus& ¨ The other problem is the (events/commands)&& consistency of this state...
  6. 6. Stimulus in a Distributed System Cyber/Physical. Copyright  2010,  PrismTech  –    All  Rights  Reserved. ¨ Internal and Environmental World. Stimuli in a distributed system are used to Distributed. System. ¨ evolve the system state Input& Output& !  State&OpenSplice DDS (commands, i.e. do something) !  Transi"ons& ¨ notify particular condition on the state (events, i.e. something happened) s"mulus& (events/commands)&&
  7. 7. State vs Stimulus Temp State% Copyright  2010,  PrismTech  –    All  Rights  Reserved. ¨ The state of a system is always defined to have a value timeOpenSplice DDS OverheatAlarm S&mulus% ¨ A Stimulus only exists at a particular point in time time
  8. 8. Are Commands Different? Cyber/Phisycal System ¨ Commands are a kind of stimulus World Do Something that express the need for the Copyright  2010,  PrismTech  –    All  Rights  Reserved. system to do something Done ¨ As commands have the “do something” connotation, it is often Asynchronous* useful to synchronously beOpenSplice DDS informed that the “command” has Cyber/Phisycal World System been executed DoSomething ¨ However systems can be built with both synchronous as well as Done asynchronous commands Synchronous*
  9. 9. State Events andOpenSplice DDS Commands in DDS
  10. 10. OpenSplice DDS State in DDS
  11. 11. Distributed State with DDS Copyright  2010,  PrismTech  –    All  Rights  Reserved. ¨ The “public” state of the elements making the distributed system can easily be captured via topic definitions Representing state with topics is more a matter ofOpenSplice DDS ¨ discipline w.r.t. to the QoS being used and the way in which it is accessed
  12. 12. State’s DDS QoS Topics representing state should have the following QoS Settings Copyright  2010,  PrismTech  –    All  Rights  Reserved. ¨ RELIABILITY = RELIABLE ¨ HISTORY = KEEP_LAST(1) DURABILITY = (TRANSIENT |PERSISTENT)OpenSplice DDS ¨ ¨ OWNERSHIP = EXCLUSIVE ¨ DESTINATION_ORDER = SOURCE_TIMESTAMP
  13. 13. Soft-State’s DDS QoS Topics representing soft-state, meaning state that is periodically Copyright  2010,  PrismTech  –    All  Rights  Reserved. updated, should have the following QoS Settings ¨ RELIABILITY = BEST_EFFORT ¨ HISTORY = KEEP_LAST(1)OpenSplice DDS ¨ DURABILITY = VOLATILE ¨ OWNERSHIP = EXCLUSIVE ¨ DESTINATION_ORDER = SOURCE_TIMESTAMP
  14. 14. Accessing State in DDS ¨ The DataReader.read operation should be used to Copyright  2010,  PrismTech  –    All  Rights  Reserved. access topics representing state ¨ This ensures that the last value for the state will be kept in DDS and will be readable again and again ¨ The DataReader data should be accessed with theOpenSplice DDS following flags: ¨ ANY_SAMPLE_STATE ¨ ALIVE_INSTANCE_STATE ¨ ANY_VIEW_STATE
  15. 15. Example [1/3] Copyright  2010,  PrismTech  –    All  Rights  Reserved. ¨ A Robot Position in 2D is an example of state ¨ Let’s assume that the Robot only update position when it movesOpenSplice DDS ¨ Topic Type: struct RobotPosition { @key long rid; long x; long y; };
  16. 16. Example [2/3] The Topic and DataReader would be constructed as Copyright  2010,  PrismTech  –    All  Rights  Reserved. ¨ follows // Create Topic Qos val tQos = TopicQos() <= KeepLastHistory(1) <= Reliable() <= TransientDurability()OpenSplice DDS <= ExclusiveOwnership() <= SourceTimestamp(); // Create Topic val rpt = Topic[RobotPosition](“RobotPosition”,topicQos) // Create DataReader val rpdr = DataReader[RobotPosition](rpt, DataReaderQos(tqos))
  17. 17. Example [3/3] Copyright  2010,  PrismTech  –    All  Rights  Reserved. ¨ Data can be read as follows // Read data val data = rpdr.read(ReadState.AllData) // Or specific to Escalier val data = rpdr.historyOpenSplice DDS
  18. 18. OpenSplice DDS Events in DDS
  19. 19. Distributed Events with DDS Copyright  2010,  PrismTech  –    All  Rights  Reserved. ¨ Events raised by a distributed system can be easily captured via topic definitions ¨ Representing events with topics is more a matter of discipline w.r.t. to the QoS being used and the wayOpenSplice DDS in which it is accessed ¨ Event topics are often keyless
  20. 20. Events’ DDS QoS Events should have the following QoS Settings Copyright  2010,  PrismTech  –    All  Rights  Reserved. ¨ RELIABILITY = RELIABLE ¨ HISTORY = KEEP_ALL DURABILITY = VOLATILEOpenSplice DDS ¨ ¨ OWNERSHIP = SHARED ¨ DESTINATION_ORDER = SOURCE_TIMESTAMP
  21. 21. Events’ DDS QoS Events should have the following QoS Settings Copyright  2010,  PrismTech  –    All  Rights  Reserved. ¨ RELIABILITY = RELIABLE ¨ HISTORY = KEEP_ALL DURABILITY = VOLATILEOpenSplice DDS ¨ ¨ OWNERSHIP = SHARED ¨ DESTINATION_ORDER = SOURCE_TIMESTAMP
  22. 22. Accessing Events in DDS ¨ The DataReader.take operation should be used to Copyright  2010,  PrismTech  –    All  Rights  Reserved. access topics representing events ¨ This ensures that the DDS cache is always freed by available events ¨ The DataReader data should be accessed with theOpenSplice DDS following flags: ¨ NEW_SAMPLE_STATE ¨ ALIVE_INSTANCE_STATE ¨ ANY_VIEW_STATE
  23. 23. Example [1/3] Copyright  2010,  PrismTech  –    All  Rights  Reserved. ¨ A CollisionEvent could be raised by a Robot when it is colliding (or about to collide) with somethingOpenSplice DDS ¨ Topic Type: struct CollisionEvent { long detectingRobotId; long collidingRobotId; long xe; long ye; };
  24. 24. Example [2/3] The Topic and DataReader would be constructed as Copyright  2010,  PrismTech  –    All  Rights  Reserved. ¨ follows // Create Topic Qos val tQos = TopicQos() <= KeepAll() <= Reliable() <= VolatileDurability()OpenSplice DDS <= SharedOwnership() <= SourceTimestamp(); // Create Topic val cet = Topic[CollisionEvent](“CollisionEvent”,topicQos) // Create DataReader val cedr = DataReader[CollisionEvent](cet, DataReaderQos(tqos))
  25. 25. OpenSplice DDS ¨ // Take data Example [3/3] val data = cedr.take() Data can be read as follows Copyright  2010,  PrismTech  –    All  Rights  Reserved.
  26. 26. Commands in DDSOpenSplice DDS
  27. 27. Commands in DDS ¨ As explained earlier commands are just a kind of Copyright  2010,  PrismTech  –    All  Rights  Reserved. stimulus ¨ As such could be represented as pairs of events one for the “command request” and the other for the “command reply”OpenSplice DDS ¨ However many people like to deal with commands synchronously, this is why OpenSplice provides now an RMI Framework!
  28. 28. OpenSplice RMI ¨ Enhances OpenSplice with the ability of defining distributed Copyright  2010,  PrismTech  –    All  Rights  Reserved. Services implementing a well defined service interface ¨ Interfaces are specified in IDL and are fully interoperable with DDS typesOpenSplice DDS ¨ Uses DDS mechanism to invoke services ¨ Takes advantage of DDS mechanism for discovery, fault tolerance, one-to-many invocations, etc.
  29. 29. Example [1/2] struct Region { long x0; ¨ Suppose our System is composed long y0; Copyright  2010,  PrismTech  –    All  Rights  Reserved. long width; by a set of cooperating Robots }; long height; that are inspecting some local interface RobotCommands : ::DDS_RMI::Services { assigned region for surveillance, void start(); or detecting chemicals, void stop(); radioactivity, etc. void setSpeed(in long s); long getSpeed();OpenSplice DDS void setSize(in long s); ¨ DDS RMI gives us a way of long getSize(); defining the set of interfaces that void setRegion(in Region r); constitute the relevant Region getRegion(); commands and invoke them as string getColor(); traditional RMI }; string getShape();
  30. 30. Example [2/2] struct Region { long x0; long y0; Copyright  2010,  PrismTech  –    All  Rights  Reserved. long width; long height; }; ¨ Under the hood, appropriate local interface RobotCommands : ::DDS_RMI::Services { topics are generated by the void start(); infrastructure void stop(); void setSpeed(in long s); long getSpeed(); QoS can be associated toOpenSplice DDS ¨ void setSize(in long s); individual methods via an XML long getSize(); file so to further control the void setRegion(in Region r); semantics of methods invocation Region getRegion(); string getColor(); string getShape(); };
  31. 31. OpenSplice DDS Using DDS RMI Copyright  2010,  PrismTech  –    All  Rights  Reserved.
  32. 32. OpenSplice DDS Demo
  33. 33. Autonomous Robots [1/2] ¨ Let’s build a system in which Copyright  2010,  PrismTech  –    All  Rights  Reserved. ¨ robots move autonomously on an assigned region ¨ look actively for some specified target and raise event when the target is at reach Along with autonomous robots the system will have:OpenSplice DDS ¨ ¨ A GUI showing the position of the robots and highlighting the places where something was detected ¨ A control application for issuing commands to robots
  34. 34. State, Event, Commands Copyright  2010,  PrismTech  –    All  Rights  Reserved. ¨ State ¨ Robot Position ¨ Events ¨ TargetDetectedOpenSplice DDS ¨ Commands ¨ Robot Control
  35. 35. Demo in ActionOpenSplice DDS
  36. 36. Summing Up ¨ All Distributed Systems can be decomposed into State and Copyright  2010,  PrismTech  –    All  Rights  Reserved. Stimulus, where typical stimulus are Events and Commands ¨ DDS provides first class support for both Distributed State and Event With DDS RMI now OpenSplice also provide first classOpenSplice DDS ¨ support for Commands! ¨ DDS RMI is built on DDS taking advantage both in terms of performance, fault-tolerance and flexibility.
  37. 37. References Copyright  2010,  PrismTech  –    All  Rights  Reserved. ¨ Article comparing performance of Remote Method Invocation using ZeroC ICE and DDS ¨ http://bit.ly/nCs66EOpenSplice DDS ¨ DDS RMI Draft RFP ¨ http://bit.ly/owCRgK
  38. 38. :: Connect with Us :: ¥ opensplice.com ¥ forums.opensplice.org ¥ @acorsaro ¥ opensplice.org ¥ opensplicedds@prismtech.com ¥ @prismtechOpenSplice DDS ¥ crc@prismtech.com ¥ sales@prismtech.com ¥ youtube.com/opensplicetube ¥ slideshare.net/angelo.corsaro

×