Microsoft Robotics Studio (Zeddy Iskandar)

download Microsoft Robotics Studio (Zeddy Iskandar)

of 81

Transcript of Microsoft Robotics Studio (Zeddy Iskandar)

  • 8/3/2019 Microsoft Robotics Studio (Zeddy Iskandar)

    1/81

    Microsoft Robotics Studio

    Runtime, Simulation & VPL

  • 8/3/2019 Microsoft Robotics Studio (Zeddy Iskandar)

    2/81

    Microsoft Robotics Studio

    Runtime, Simulation & VPLOverview

    Zeddy Iskandar

    Academic DeveloperMicrosoft Indonesia

  • 8/3/2019 Microsoft Robotics Studio (Zeddy Iskandar)

    3/81

    Presentation Outline

    Microsoft Robotics Studio RuntimeOverview, Components and Concepts

    Decentralized Software Services (DSS)

    A lightweight, service oriented application modelbased around state manipulation

    Concurrency and Coordination Runtime(CCR)

    A message based model enabling fine grainedconcurrency and coordination without resorting tothreads, locks while avoiding traditionalasynchronous programming pitfalls

  • 8/3/2019 Microsoft Robotics Studio (Zeddy Iskandar)

    4/81

    Highly Diverse Market

    http://store.irobot.com/product/index.jsp?productId=2586252&cp=2591511&parentPage=familyhttp://www.yujinrobot.com/english/index.phphttp://www.robotbits.com/displayimage.php?album=lastup&cat=0&pos=4
  • 8/3/2019 Microsoft Robotics Studio (Zeddy Iskandar)

    5/81

    Shared ChallengesInput from industry, hobbyists, academia, research,

    Configuring sensors and actuators in running system

    Coordinating sensors and actuators asynchronously

    Starting and stopping components dynamicallyMonitoring/Interacting/Debugging running system

    Development when access to robot is limited

    Span multiple compute unitsRe-use of components across hardware platforms and

    devices

  • 8/3/2019 Microsoft Robotics Studio (Zeddy Iskandar)

    6/81

    Overall Runtime Goals

    Distributed Application Model (DSS)Simple, flexible, and service oriented

    Coarse grained and loosely coupled

    Compatible with existing Web infrastructure

    Concurrent Programming Model (CCR)

    Focus on coordination of messages

    Hide traditional threads and locks primitivesEnable non thread blocking sequentialexecution between I/O, avoidingnesting/callback chains

  • 8/3/2019 Microsoft Robotics Studio (Zeddy Iskandar)

    7/81

    DSS Application Model

    The definition of a Robotics application

  • 8/3/2019 Microsoft Robotics Studio (Zeddy Iskandar)

    8/81

    What is a Robotics Application?

    An application is a composition of loosely-coupled components concurrently executing

    Orchestration of sensors/actuatorsUser interface

    Controlled/Autonomous behavior

    A service is the unit of orchestration

    MotorBumper 1(Sensor)

    Orchestrator

    MotorBumper 2(Sensor)

    Infrareddetector(Sensor)

    MessageBox

    (Actuator)

  • 8/3/2019 Microsoft Robotics Studio (Zeddy Iskandar)

    9/81

    Service PropertiesIdentityStructured State

    Composition throughpartnering

    Uniform BehaviorState retrieval andmanipulation

    Service creation &

    TerminationEvent notifications

    Anatomy of a Service

    Port

    State

    Handlers

    Service

    FIFO

  • 8/3/2019 Microsoft Robotics Studio (Zeddy Iskandar)

    10/81

    Service Abstraction

    Services can represent any computationHardware: Sensors, actuators,

    Software: UI, Storage,

    Aggregation: Sensor fusion, mash-ups,

    Reuse through composition

    Separate State from Behavior (dont hide

    state!)

  • 8/3/2019 Microsoft Robotics Studio (Zeddy Iskandar)

    11/81

    Sample Bumper Service

    Structured State

    Non-structured state handled out of band

    Uniform Operations

    Define operations over the state

    GET, QUERY, UPDATE, DELETE, DROP,

    SUBSCRIBE

  • 8/3/2019 Microsoft Robotics Studio (Zeddy Iskandar)

    12/81

    Sample Partner Relationship

    Orchestrator Service subscribes to

    bumper Service waiting for sensor input

    A service can partner with arbitrarynumber of other services

    MotorBumper 1(Sensor)

    Orchestrator

    MotorBumper 2(Sensor)

    Infrareddetector(Sensor)

    MessageBox

    (Actuator)

  • 8/3/2019 Microsoft Robotics Studio (Zeddy Iskandar)

    13/81

    Service Interactions

    Runtime, Hosting Environment, and

    System Services

  • 8/3/2019 Microsoft Robotics Studio (Zeddy Iskandar)

    14/81

    Service Interaction

    Service Interaction happens throughprotocols

    HTTP is available for interactions from

    Web browser and for providing UIEnables deep integration with existing Webinfrastructure

    DSSP is a SOAP-based protocol availablefor inter-service communication

    Augments HTTP model with structured datamanipulation and event notifications

  • 8/3/2019 Microsoft Robotics Studio (Zeddy Iskandar)

    15/81

    Distributed Applications

    Services can rundirectly on a singlerobot

    Services can run on

    swarms ofcollaborating robots

    Services can run oncomputers in the

    networkApplicationstypically a mix

  • 8/3/2019 Microsoft Robotics Studio (Zeddy Iskandar)

    16/81

    Runtime Performance

    Service-to-Service message throughput:Same process (with full cloning): 50,000msgs/second

    Cross node,cross machine: 3,000 msgs/secNumbers from dual core 1.8GHz, 2GB RAM

    Performance allows consistent use ofservice model for both local and distributedcase

  • 8/3/2019 Microsoft Robotics Studio (Zeddy Iskandar)

    17/81

    CCR Programming

    The foundation for writing Robotics

    Applications

  • 8/3/2019 Microsoft Robotics Studio (Zeddy Iskandar)

    18/81

  • 8/3/2019 Microsoft Robotics Studio (Zeddy Iskandar)

    19/81

    Messages, Ports, and Arbiters

    Messages are sent to PortsPort myPort = new Port() ;myPort.Post (42) ;

    Ports contain

    A FIFO data-structure holding values in a portA list of continuations that can be executed pendingmessage arrival and arbitration

    A continuation is represented by a C# delegate

    Can either be named or anonymous

    ArbitersImplement common concurrency constructs like joinpatterns and interleaved calculations

  • 8/3/2019 Microsoft Robotics Studio (Zeddy Iskandar)

    20/81

    Example: Iterators make adifference

    IEnumerator MultistageIterator()

    {

    bool result = false;

    Port port = new Port();

    // Stage A, send requestport.Post(true);

    yield return Arbiter.Receive(false, port, delegate(bool b) {result=b; });

    // Stage B, received first result, send second request

    port.Post(result);yield return Arbiter.Receive(false, port, delegate(bool b) {result=b; });

    // Stage C, received second result, print it

    Console.WriteLine(result);

    }

  • 8/3/2019 Microsoft Robotics Studio (Zeddy Iskandar)

    21/81

    Example: ChoicePortSet port = new PortSet();

    Activate(Arbiter.Choice(port, MyIntHandler, MyStringHandler)

    );

    void MyIntHandler(int i){

    Console.WriteLine("Received: " + i);

    }

    void MyStringHandler(string s){

    Console.WriteLine("Received: " + s);

    }

  • 8/3/2019 Microsoft Robotics Studio (Zeddy Iskandar)

    22/81

    Example: Dynamic JoinPortSet resultsPort =

    new PortSet();

    // parallel computation by posting requestsFor (int i=0;i

  • 8/3/2019 Microsoft Robotics Studio (Zeddy Iskandar)

    23/81

    [ServiceHandler(ServiceHandlerBehavior.Concurrent)]public IEnumerator GetHandler(Get get){

    get.ResponsePort.Post(_state);yield break;

    }

    [ServiceHandler(ServiceHandlerBehavior.Exclusive)]public IEnumerator UpdateHandler(Update update){

    _state.CurrentResult += update.Body.Value;update.ResponsePort.Post(new UpdateResponse());yield break;

    }

    Declarative Coordination forServices

  • 8/3/2019 Microsoft Robotics Studio (Zeddy Iskandar)

    24/81

  • 8/3/2019 Microsoft Robotics Studio (Zeddy Iskandar)

    25/81

    Why a Simulator?

    Robotics hardware isexpensive

    Hardware can bedifficult to debug

    Hard for a team towork concurrentlywith limited hardware

  • 8/3/2019 Microsoft Robotics Studio (Zeddy Iskandar)

    26/81

  • 8/3/2019 Microsoft Robotics Studio (Zeddy Iskandar)

    27/81

  • 8/3/2019 Microsoft Robotics Studio (Zeddy Iskandar)

    28/81

    Simulator ArchitectureThe Simulator Engine Service

    Implemented as a service

    Maintains world state

    Manages input devices3D rendering using XNA

    Ageia Physics Simulation

    Graphical User Interface

    Editor for modeling anddebugging

    SimulationEngine

    Service

    XNA

    GraphicsLibrary

    DisplayHardware

    AgeiaPhysicsEngine

    User Interface / Editor

  • 8/3/2019 Microsoft Robotics Studio (Zeddy Iskandar)

    29/81

    Visual Programming

    Language

    Rapid Robot Prototyping

  • 8/3/2019 Microsoft Robotics Studio (Zeddy Iskandar)

    30/81

    MicrosoftVisual Programming Language

    Visual programming environmentSimple programming with drag and drop

    Application are diagrams

    Blocks

    Connections

    Integrated into Microsoft Robotics Studio

  • 8/3/2019 Microsoft Robotics Studio (Zeddy Iskandar)

    31/81

    Guided Tour

  • 8/3/2019 Microsoft Robotics Studio (Zeddy Iskandar)

    32/81

    Hello, World!

  • 8/3/2019 Microsoft Robotics Studio (Zeddy Iskandar)

    33/81

    How does it work?

    Exchange of messages between activitiesActivities

    Perform an action on input message

    Send result of the action as output message

    Connections

    Make output of one activity input of second

    Input message Output message

  • 8/3/2019 Microsoft Robotics Studio (Zeddy Iskandar)

    34/81

    How does it work?

    Exchange of messages between activitiesActivities

    Perform an action on input message

    Send result of the action as output message

    Connections

    Make output of one activity input of second

    Input message

  • 8/3/2019 Microsoft Robotics Studio (Zeddy Iskandar)

    35/81

    Data Activity

    Output message is a new data valueIgnores content of input message

    Different types of data

    int, string, double, bool,

  • 8/3/2019 Microsoft Robotics Studio (Zeddy Iskandar)

    36/81

    Service Activities

    SimpleDialog is a DSS ServiceAll DSS services are activities in VPL

    Provide access robot hardware, input devices,

    behavior You can add your own activities!

  • 8/3/2019 Microsoft Robotics Studio (Zeddy Iskandar)

    37/81

    Service Activities

    Services can have multiple actions, e.g.AlertDialog, PromptDialog, ConfirmDialog

    Most actions have two output messages

    Success may contain output valuesFault action could not complete

  • 8/3/2019 Microsoft Robotics Studio (Zeddy Iskandar)

    38/81

    Selecting Services

    Services appear inthe Servicestoolbox

    Use the search box toquickly find services.

  • 8/3/2019 Microsoft Robotics Studio (Zeddy Iskandar)

    39/81

    Making Connections

    Drag output message of first activity

  • 8/3/2019 Microsoft Robotics Studio (Zeddy Iskandar)

    40/81

    Making Connections

    to second activityPossible targets are highlighted

  • 8/3/2019 Microsoft Robotics Studio (Zeddy Iskandar)

    41/81

    Selecting Actions

    When connecting an activity with multipleactions, select the desired action.

    Selects theaction to which

    to send themessage.

    Selects theoutput messagethat is used as

    input messagefor the action.

  • 8/3/2019 Microsoft Robotics Studio (Zeddy Iskandar)

    42/81

    Data Connections

    Service actions define format required forinput message

    Data Connections format messages

    AlertDialog

    requires aninput valuecalled AlertText.

    Selects the part

    of the inputmessage that isused for thetarget.

  • 8/3/2019 Microsoft Robotics Studio (Zeddy Iskandar)

    43/81

    H ll W ld! R i i d

  • 8/3/2019 Microsoft Robotics Studio (Zeddy Iskandar)

    44/81

    Hello, World! Revisited

    Not connected.Automaticallyreceives anempty inputmessage.

    Value:

    H ll W ld! R i i d

  • 8/3/2019 Microsoft Robotics Studio (Zeddy Iskandar)

    45/81

    Hello, World! Revisited

    Value:Hello, World!(string)

    H ll W ld! R i i d

  • 8/3/2019 Microsoft Robotics Studio (Zeddy Iskandar)

    46/81

    Hello, World! Revisited

    Value:Hello, World!(string)

    H ll W ld! R i i d

  • 8/3/2019 Microsoft Robotics Studio (Zeddy Iskandar)

    47/81

    Hello, World! Revisited

    Data connectionsformats the inputmessage before itis sent to theactivity

    Value:AlertText = Hello, World!(AlertText string)

    H ll W ld! R i it d

  • 8/3/2019 Microsoft Robotics Studio (Zeddy Iskandar)

    48/81

    Hello, World! Revisited

    Not connected.Output message isignored.

    Value:Empty

    (Success)

    E l 1

  • 8/3/2019 Microsoft Robotics Studio (Zeddy Iskandar)

    49/81

    Example 1

    Create a new activity that translates thethumb-stick value of the XBox360controller to left and right power values ofa differential drive.

    User defined activities

    XB 360 C t ll

  • 8/3/2019 Microsoft Robotics Studio (Zeddy Iskandar)

    50/81

    XBox360 Controller

    ThumbsticksChangenotification

    X, Y coordinates forboth thumb-sticks:

    LeftX, LeftY

    RightX, RightY

    float

    X

    Y

    1.0-1.0

    -1.0

    1.0

    G i Diff ti l D i

  • 8/3/2019 Microsoft Robotics Studio (Zeddy Iskandar)

    51/81

    Generic Differential Drive

    Very simple drive systemControlled by applying different power to leftand right motor

    SetDrivePowerActionLeftWheelPower, RightWheelPower:values between -1.0 and 1.0 (double)

  • 8/3/2019 Microsoft Robotics Studio (Zeddy Iskandar)

    52/81

    U A ti iti

  • 8/3/2019 Microsoft Robotics Studio (Zeddy Iskandar)

    53/81

    User Activities

    Similar to service activitiesMultiple actions

    Can send notifications

    Have their own state

    I l ti A ti

  • 8/3/2019 Microsoft Robotics Studio (Zeddy Iskandar)

    54/81

    Implementing ActionsInside an Activity

    I l ti A ti

  • 8/3/2019 Microsoft Robotics Studio (Zeddy Iskandar)

    55/81

    Implementing ActionsInside an Activity

    Double-click opensthe activity andshows its

    implementation.

    I l ti A ti

  • 8/3/2019 Microsoft Robotics Studio (Zeddy Iskandar)

    56/81

    Implementing ActionsInside an Activity

    Implementing Actions

  • 8/3/2019 Microsoft Robotics Studio (Zeddy Iskandar)

    57/81

    Selects the currentaction that is shown.

    Implementing ActionsInside an Activity

    Implementing Actions

  • 8/3/2019 Microsoft Robotics Studio (Zeddy Iskandar)

    58/81

    Implementing ActionsInside an Activity

    Input message ofthe action.

    Output messageof the action.

    Implementing Actions

  • 8/3/2019 Microsoft Robotics Studio (Zeddy Iskandar)

    59/81

    Implementing ActionsInside an Activity

    Input message ofthe action.

    Output messageof the action.

    Implementing Actions

  • 8/3/2019 Microsoft Robotics Studio (Zeddy Iskandar)

    60/81

    Implementing ActionsAction Properties

    Input message ofthe action.

    Output messageof the action.

    Implementing Actions

  • 8/3/2019 Microsoft Robotics Studio (Zeddy Iskandar)

    61/81

    Implementing ActionsAction Properties

    Shows more properties of theaction and allows to add anddelete actions.

    Implementing Actions

  • 8/3/2019 Microsoft Robotics Studio (Zeddy Iskandar)

    62/81

    Shows more properties of theaction and allows to add anddelete actions.

    List of actions in theactivity.

    Implementing ActionsAction Properties

    Implementing Actions

  • 8/3/2019 Microsoft Robotics Studio (Zeddy Iskandar)

    63/81

    Implementing ActionsAction Properties

    Change name anddescription tosomething useful.

    Implementing Actions

  • 8/3/2019 Microsoft Robotics Studio (Zeddy Iskandar)

    64/81

    Implementing ActionsAction Properties

    Add input values forthe thumb-stickcoordinates.

  • 8/3/2019 Microsoft Robotics Studio (Zeddy Iskandar)

    65/81

    Implementing Actions

  • 8/3/2019 Microsoft Robotics Studio (Zeddy Iskandar)

    66/81

    Implementing ActionsConnecting the Input Message

    Use the inputmessage like anyother message.

    Implementing Actions

  • 8/3/2019 Microsoft Robotics Studio (Zeddy Iskandar)

    67/81

    Implementing ActionsConnecting the Input Message

    Input values becomepart of the message.

    Implementing Actions

  • 8/3/2019 Microsoft Robotics Studio (Zeddy Iskandar)

    68/81

    Implementing ActionsConnecting the Input Message

    Implementing Actions

  • 8/3/2019 Microsoft Robotics Studio (Zeddy Iskandar)

    69/81

    Implementing ActionsCreating the Output Message

    Must put twomessage into onemessage.

    Must put twomessages intoone message.

    Implementing Actions

  • 8/3/2019 Microsoft Robotics Studio (Zeddy Iskandar)

    70/81

    Implementing ActionsCreating the Output Message

    Join combinestwo or moremessages.

  • 8/3/2019 Microsoft Robotics Studio (Zeddy Iskandar)

    71/81

    Implementing Actions

  • 8/3/2019 Microsoft Robotics Studio (Zeddy Iskandar)

    72/81

    Implementing ActionsCreating the Output Message

    Value:Left = 0.3251Right = -0.73(Leftfloat, Right Float)

    Join only creates the

    output message ifthere are two inputmessages.

    Implementing Actions

  • 8/3/2019 Microsoft Robotics Studio (Zeddy Iskandar)

    73/81

    Implementing ActionsSending the Output Message

    Connect theresult message tothe right border.

    Implementing Actions

  • 8/3/2019 Microsoft Robotics Studio (Zeddy Iskandar)

    74/81

    Implementing ActionsSending the Output Message

    Implementing Actions

  • 8/3/2019 Microsoft Robotics Studio (Zeddy Iskandar)

    75/81

    Implementing ActionsSending the Output Message

    Conversion Activity

  • 8/3/2019 Microsoft Robotics Studio (Zeddy Iskandar)

    76/81

    Conversion Activity

    ?

    Using your Activity

  • 8/3/2019 Microsoft Robotics Studio (Zeddy Iskandar)

    77/81

    Using your Activity

  • 8/3/2019 Microsoft Robotics Studio (Zeddy Iskandar)

    78/81

    Control Robot with

    Wiimote

  • 8/3/2019 Microsoft Robotics Studio (Zeddy Iskandar)

    79/81

    Control Robot with

    Speech

    Additional Resources

  • 8/3/2019 Microsoft Robotics Studio (Zeddy Iskandar)

    80/81

    Additional Resources

    Web sitehttp://www.microsoft.com/robotics

    Community Newsgroup

    http://msdn.microsoft.com/robotics/Princeton MSRS Page

    http://pave.princeton.edu/main/urban-

    challenge/msrs/

    http://www.microsoft.com/roboticshttp://msdn.microsoft.com/robotics/http://pave.princeton.edu/main/urban-challenge/msrs/http://pave.princeton.edu/main/urban-challenge/msrs/http://pave.princeton.edu/main/urban-challenge/msrs/http://pave.princeton.edu/main/urban-challenge/msrs/http://pave.princeton.edu/main/urban-challenge/msrs/http://msdn.microsoft.com/robotics/http://www.microsoft.com/robotics
  • 8/3/2019 Microsoft Robotics Studio (Zeddy Iskandar)

    81/81

    2006 Microsoft Corporation. All rights reserved. Microsoft, W indows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.