Upload
letram
View
230
Download
0
Embed Size (px)
Citation preview
Microsoft TechDays 2007 - Lisboa 21/03/2007 1:26 PM
2007 Microsoft Corporation. All rights reserved.
This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary. 1
DEV003
Programação e Simulação de Robots usando Robotics StudioJon [email protected], Robotics and Automation Group, CoroWare Inc.
Patrocinadores Agenda
Introduction to Microsoft Robotics StudioRationale
Design
Architectural Overview
Programming Model
Demonstrations of Robotics Studio Technologies
HTTP Interaction with Services
Simulation
Visual Programming
Microsoft TechDays 2007 - Lisboa 21/03/2007 1:26 PM
2007 Microsoft Corporation. All rights reserved.
This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary. 2
Introduction - Rationale
Robotics is hard because
There is a lack of reusable components
No standard hardware or hardware abstractions exist
Concurrent and distributed programming is hard and inherent in virtually all robotics software projects.
Testing in the real-world is excessively costly and simulation is costly or overly complex
High barrier to entry
Introduction - RationaleThe ‘hot buttons’ from Industry, hobbyists, academia and researchers:
Static and dynamic device configuration
Coordinating asynchronous device input
Starting and stopping components dynamically and independently
Monitoring and interacting with running systems
Improved development cycle, particularly with limited access to robot hardware
Spanning multiple compute units
Reuse of software, particularly across different hardware
Introduction - RationaleMicrosoft Robotics Studio addresses:
Reusable components: Introduces a paradigm that facilitates reuse
Standardization: Introduces a hardware abstraction paradigm
Concurrency and distributed computing: Introduces CCR and DSS to greatly simplify these tasks
Simulation: Introduces a high-fidelity, extensible virtual world
Barrier to Entry: Introduces a Visual Programming Language to make the advanced features more accessible to newcomers.
What is a Robotics Application?
A composition of loosely-coupled and concurrently executing components providing:
Orchestration of sensors and actuators
User Interaction
Control or Behavior logic
Introduction - Design
User Exp (UI)
Actuators
Orchestration
Behavior
Sensors
Microsoft TechDays 2007 - Lisboa 21/03/2007 1:26 PM
2007 Microsoft Corporation. All rights reserved.
This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary. 3
Introduction - Design
Addressing the Challenges
Runtime built on CLR 2.0
Concurrency and Coordination
Services for Hosting, Activation, Discovery and Debugging
HTTP Integration
Concurrency Library
Distribution
Infrastructure
Development
Environment
.Net Languages (C#, VB, Python, etc)
JScript, Ajax
Visual Programming
Simulation
Architecture
Architecture
Services are the basic building block
Structured state
Behavior
Partner services
Contract
Operations
Create and Terminate
State retrieval and manipulation
Subscription and Notification
Architecture
ServicesCan be used to abstract hardware
Can be composed and provide aggregated functionality (sensor fusion, for example)
Are inherently remotable and participate in distributed operations
Restartable and mobile (state transfer)
Must be inherently asynchronous
Microsoft TechDays 2007 - Lisboa 21/03/2007 1:26 PM
2007 Microsoft Corporation. All rights reserved.
This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary. 4
Architecture
But asynchronous programming is hard!
Sequential applications
Flat or incremental performance
Potentially poor responsiveness
Explicitly threaded apps
Hardwired number of threads prefer K processors for a given workload
Can penalize < K processors and fail to scale to > K processors
Hard to write and even harder to debug
Deadlock, livelock, and race conditions
Architecture
Scalable concurrent apps
Workload is decomposed into a ‘sea’ of heterogeneous concurrent work items
Lots of latent concurrency that can be dynamically mapped to available computational resources
Architecture
Coordinating asynchronous tasks
Architecture
Coordinating asynchronous tasks
Microsoft TechDays 2007 - Lisboa 21/03/2007 1:26 PM
2007 Microsoft Corporation. All rights reserved.
This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary. 5
Architecture
Coordinating asynchronous tasks
Architecture
Concurrencyand coordination
runtime
Runtime
Activation
Discovery
Diagnostics
Monitoring
UX
Storage
DecentralizedSystem
Services
Algorithms
…
Sensors
Actuators
ReferenceServices
Services
Simulation
Visualization
AuthoringServices
Sensors Actuators
Custom/Application Services
Orchestration Control
Architecture
Reference Services
Guidance on Implementation
Runtime discovery through simple queries
Abstraction from hardware
Shipped as source code and binaries
Algorithms
…
Sensors
Actuators
ReferenceServices
Services
Simulation
Visualization
AuthoringServices
Programming Model
Microsoft TechDays 2007 - Lisboa 21/03/2007 1:26 PM
2007 Microsoft Corporation. All rights reserved.
This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary. 6
Declaring your Service State and Operations
public sealed class Contract {public const String Identifier = "http://schemas.coroware.com/2006/10/machinedirectory.html";}
[DataContract()]
public class MachineDirectoryState {[DataMember]public List<ServiceInfoType> Services =
new List<ServiceInfoType>();}
public class MachineDirectoryOperations : PortSet<DsspDefaultLookup, DsspDefaultDrop, Get, Replace> {}
public class Get : Get<GetRequestType, PortSet<MachineDirectoryState, Fault>> { }
public class Replace : Replace<MachineDirectoryState, PortSet<DefaultReplaceResponseType, Fault>> { }
Programming Model Programming Model
Declaring a Service Port[ServicePort("/machinedirectory",
AllowMultipleInstances=false)]
private MachineDirectoryOperations _mainPort = new
MachineDirectoryOperations();
Defining Partnerships[Partner("NodeDirectory",
Contract=nds.Contract.Identifier,CreationPolicy =PartnerCreationPolicy.UseExistingOrCreate)]
private nds.NodeDirectoryOperations _nds = new nds.NodeDirectoryOperations();
Programming Model
Coordinating Asynchronous Tasks - A compositional, declarative pattern
protected override void Start() {
ActivateDsspOperationHandlers();
}
[ServiceHandler(ServiceHandlerBehavior.Concurrent)]
public virtual IEnumerator<ITask> GetHandler(Get get) {
get.ResponsePort.Post(_state);
yield break;
}
[ServiceHandler(ServiceHandlerBehavior.Exclusive)]
public virtual IEnumerator<ITask> ReplaceHandler(Replace replace) {
_state = replace.Body;
replace.ResponsePort.Post(DefaultReplaceResponseType.Instance);
yield break;
}
Programming Model
Example: Choice// Subscribe to the local node directory service
nds.Subscribe sub = new nds.Subscribe();
sub.NotificationPort = _ndsNotify;
_nds.Post(sub);
Activate(
Arbiter.Choice<SubscribeResponseType,Fault>(
sub.ResponsePort,
delegate(SubscribeResponseType resp)
{ LogInfo("Successfully subscribed to node directory"); },
delegate(Fault fault)
{ _mainPort.Post(new DsspDefaultDrop()); })
);
Microsoft TechDays 2007 - Lisboa 21/03/2007 1:26 PM
2007 Microsoft Corporation. All rights reserved.
This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary. 7
Programming Model
Example: Interleave
ActivateDsspOperationHandlers().CombineWith(
Arbiter.Interleave(
new TeardownReceiverGroup(),
new ExclusiveReceiverGroup( Arbiter.Receive<nds.InsertLocalHostNotification>(
true, _ndsNotify, NdsInsertHostHandler),Arbiter.Receive<nds.DeleteLocalHostNotification>(
true, _ndsNotify, NdsDeleteHostHandler),Arbiter.Receive<dir.Insert>(
true, _dirNotify, DirInsertHandler), Arbiter.Receive<dir.Delete>(true, _dirNotify,
DirDeleteHandler)
),
new ConcurrentReceiverGroup()
));
Technologies
Technologies
Services run within an execution context called a ‘node’
Nodes expose http and SOAP/TCP endpoints
Technologies
HTTP Interaction with Services
Service state for all services is available by HTTP
Default response to GET is service state as XML
Services can expose richer data representations through xsl transformations
Microsoft TechDays 2007 - Lisboa 21/03/2007 1:26 PM
2007 Microsoft Corporation. All rights reserved.
This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary. 8
HTTP Interactions with Services
Technologies
Visual Programming Language
Create joins, choices and data pathways
Define partnerships with external services
All Services (regardless of language) are available on the diagram surface
Visual Programming
Technologies
Simulation
Cost effective
High-fidelity
Fast, incremental prototyping
Ageia PhyXMicrosoft XNASimulation Engine
Service
EntitiesApplication Services
Microsoft TechDays 2007 - Lisboa 21/03/2007 1:26 PM
2007 Microsoft Corporation. All rights reserved.
This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary. 9
Technologies
Simulation
Entities consist of:
A graphical representation of your object
Geometric shape
Complex mesh with materials and textures
A physics representation
Shape, Mass, CM, friction, joints
Physical shape (hull) can be automatically derived from geometric shapes and complex meshes
An entity can have both, either or neither representation(s)
Technologies
Simulation
Simulation services
Communicate with entities to effect changes in entity state (change position, orientation, physics attributes like torques and forces)
Communicate with application services through a service interface
This service interface should mimic the interface used for the real device on the real robot
Application services
Your application code
Should be identical code for simulation or real-world use
Simulation
Extending the Simulation Environment
Microsoft TechDays 2007 - Lisboa 21/03/2007 1:26 PM
2007 Microsoft Corporation. All rights reserved.
This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary. 10
Real-World Applications SummaryMicrosoft Robotics Studio addresses:
Reusable components: Introduces a paradigm that facilitates reuse
Standardization: Introduces a hardware abstraction paradigm
Concurrency and distributed computing: Introduces CCR and DSS to greatly simplify these tasks
Simulation: Introduces a high-fidelity, extensible virtual world
Barrier to Entry: Introduces a Visual Programming Language to make the advanced features more accessible to newcomers.
Call to ActionDownload version 1.0!
Run your first robot in the simulator - in the first hour
Write a VPL program and run it in the simulator - in the second hour
Get real: Get a BOEbot, Lego NXT, CoroWare robot, Roomba, or any one of many other robot models.
How many program systems look like robots but aren’t?
Home automation
P2P applications
SOA applications
Resources
Microsoft Robotics
http://www.microsoft.com/robotics
The team Blog, product downloads and community-support newsgroup are linked from this main page
Sandbox at http://channel9.msdn.microsoft.com
CoroWare, Inc.
Corporate: http://www.coroware.com
PlusPack extensions: http://downloads.coroware.com/pluspack.aspx
Microsoft TechDays 2007 - Lisboa 21/03/2007 1:26 PM
2007 Microsoft Corporation. All rights reserved.
This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary. 11
Questionário de AvaliaçãoPassatempo!
Complete o questionário de avaliação e devolva-o no balcão da recepção.
Habilite-se a ganhar uma Xbox 360 por dia!
Dev 003
Programação e Simulação de Robots usando Robotics Studio
© 2007 Microsoft Corporation. All rights reserved.This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.