Microsoft Robotics Developer Studio 2008 provides a low barrier to entry into robotics development with powerful programming, simulation and runtime technology. This presentation provides a brief overview as part of the Windows Embedded & Robotics European Campus Tour
11. DispatcherDispatcherPort
Dispatcher
Queues
ThreadsArbiterArbiter
HandlerHandler
Arbiter is attached to portArbiter is attached to port
Arbiter is activated on queueArbiter is activated on queue
Dispatcher schedules items
from its queues round-robin
to run in its threads
Dispatcher schedules items
from its queues round-robin
to run in its threadsPost places a message
on the port
Post places a message
on the port
Arbiter checks whether it
can consume the message
Arbiter checks whether it
can consume the message
Creates work item from
message and handler
Creates work item from
message and handler
Enqueue work itemEnqueue work item
Thread calls handler
with message as arg
Thread calls handler
with message as arg
Scheduler picks next
work item to execute
Scheduler picks next
work item to execute
13. var dispatcher = new Dispatcher(0,”default”);
var queue = new DispatcherQueue(dispatcher);
var port = new Port<string>();
port.Post("Hello, World!");
Arbiter.Activate(queue,
port.Receive(message => Console.WriteLine(message)
)
);
Port: Building block for
sending and receiving
messages
Port: Building block for
sending and receiving
messages
Post: Queues a messagePost: Queues a message
Task: Delegate that
handles the message
(message is consumed)
Task: Delegate that
handles the message
(message is consumed)
Receive coordination
primitive
Receive coordination
primitive
Dispatcher uses fixed
number of threads,
schedules from queues
in round-robin
Dispatcher uses fixed
number of threads,
schedules from queues
in round-robin
Port on which to
receive the message
Port on which to
receive the message
14. void Start()
{
var queue = new DispatcherQueue();
var port = new Port<string>();
port.Post("Hello"); port.Post(“World”);
Arbiter.Activate(queue,
new IterativeTask(() => Hello(port) )
);
}
IEnumerator<ITask> Hello(Port<string> port)
{
for(var i=0; i<5; i++)
{
yield return port.Receive();
var message = (string)port;
Console.WriteLine(message);
}
Schedule iterative taskSchedule iterative task
Lambda captures
arguments for iterator
Lambda captures
arguments for iterator
Yield execution until
receive is satisfied
Yield execution until
receive is satisfied
Item retrieved
after yield
Item retrieved
after yield
Loops around
asynchronous
operations are easy
Loops around
asynchronous
operations are easy
23. [Contract(Contract.Identifier)]
class RecordKeeperService : DsspServiceBase
{
[Partner(“PeopleLookup”,
Policy = PartnerCreationPolicy.UseExistingOrCreate,
Optional = false)]
peopleLookup.OperationsPort _peopleLookupPort =
peopleLookup.OperationsPort();
[ServicePort(“/recordkeeper”,AllowMultipleInstances = true]
OperationsPort _mainPort;
protected override void Start()
{
base.Start();
}
}
Declarative, dynamic
composition, annotations
picked up by visual editor
Declarative, dynamic
composition, annotations
picked up by visual editor
Attach handlers to operation
port, publish instance URI in
service directory
Attach handlers to operation
port, publish instance URI in
service directory
24. [ServiceHandler(ServiceHandlerBehavior.Concurrent)]
public IEnumerator<ITask> QueryHandler(Query queryOp)
{
var response = FindItem(queryOp.Body);
queryOp.ResponsePort.Post(response);
yield break;
}
[ServiceHandler(ServiceHandlerBehavior.Exclusive)]
public IEnumerator<ITask> UpdateHandler(Update updateOp)
{
QueryAge queryAgeOp;
yield return _peopleLookupPort.Query(out queryAgeOp);
int age = (int) queryAgeOp.ResponsePort;
UpdateRecord(age, updateOp.Body.Name);
updateOp.ResponsePort.Post(new UpdateResponse());
CCR Interleave is iterator-aware,
guaranteeing atomicity across
asynchronous steps
CCR Interleave is iterator-aware,
guaranteeing atomicity across
asynchronous steps
25. Create causality at root
of execution graph
Create causality at root
of execution graph
Failure occurs on one
of the side branches
Failure occurs on one
of the side branchesDeal with error as
message at origin
of execution
Deal with error as
message at origin
of execution
35. MRDS 2008 Licensing
Academic Edition Researchers and Students. Free unlimited runtime
distribution. Via Academic Portal.
Standard Edition Professional Developers. Free unlimited runtime
distribution $499
Express Edition Hobbyists. Not permitted to distribute runtime $Free
More information at http://microsoft.com/robotics
36. • http://imaginecup.com/
• Robotics and Algorithm challenge
– Interpreting, solution design, best algorithm
– Robotics in a virtual environment
• 2009 Worldwide Finals: Egypt
– The robots are real!
37. Summary:
– Simpler concurrency and distributed computing
– Reusable components and standardization
– Lower barrier to entry
– All of these advantages are now available for
mobile, embedded, desktop and server
platforms.
The object of the Robotics and Algorithm Competition is to test the competitors on their knowledge and skills for interpreting, designing a solution, and coding the best algorithms that will address the challenges of each Round of the Invitational. Robotics will be the virtual environment for the competitors until the moment they reach the Worldwide Finals when they will have to code the real ones.
SESSION SUMMARY. PROVIDE A SUMMARY FOR YOUR SESSION. REVIEW COVERED TOPICS WITH AUDIENCE.