<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" version="2.0">
  <channel>
    <title>Gokulnath's weBLOG - Robotics</title>
    <link>http://blogs.gokulnath.com//</link>
    <description>learned/learning/to learn</description>
    <language>en-us</language>
    <copyright>Gokulnath</copyright>
    <lastBuildDate>Mon, 27 Jun 2011 00:27:09 GMT</lastBuildDate>
    <generator>newtelligence dasBlog 2.3.9074.18820</generator>
    <managingEditor>mailme@gokulnath.com</managingEditor>
    <webMaster>mailme@gokulnath.com</webMaster>
    <item>
      <trackback:ping>http://blogs.gokulnath.com//Trackback.aspx?guid=bc44d0d9-550c-425b-84d3-42d5e3fcc508</trackback:ping>
      <pingback:server>http://blogs.gokulnath.com//pingback.aspx</pingback:server>
      <pingback:target>http://blogs.gokulnath.com//PermaLink,guid,bc44d0d9-550c-425b-84d3-42d5e3fcc508.aspx</pingback:target>
      <dc:creator>Gokulnath</dc:creator>
      <wfw:comment>http://blogs.gokulnath.com//CommentView,guid,bc44d0d9-550c-425b-84d3-42d5e3fcc508.aspx</wfw:comment>
      <wfw:commentRss>http://blogs.gokulnath.com//SyndicationService.asmx/GetEntryCommentsRss?guid=bc44d0d9-550c-425b-84d3-42d5e3fcc508</wfw:commentRss>
      <title>Lego Hexapod Controlled using Microsoft Robotics Developer Studio (MRDS)</title>
      <guid isPermaLink="false">http://blogs.gokulnath.com//PermaLink,guid,bc44d0d9-550c-425b-84d3-42d5e3fcc508.aspx</guid>
      <link>http://blogs.gokulnath.com//2011/06/27/LegoHexapodControlledUsingMicrosoftRoboticsDeveloperStudioMRDS.aspx</link>
      <pubDate>Mon, 27 Jun 2011 00:27:09 GMT</pubDate>
      <description>&lt;p&gt;
At last got some time to complete coding my hexapod to make it walk and sense obstacles. &lt;a href="http://blogs.gokulnath.com//content/binary/MyHexaPodService.zip"&gt;Click
here&lt;/a&gt; to download the source code.&lt;br&gt;
&lt;br&gt;
&lt;/p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:5737277B-5D6D-4f48-ABFC-DD9C333F4C5D:029c3ed0-5161-4769-81f2-b23827dd2518" class="wlWriterEditableSmartContent"&gt;
&lt;div id="b896bbe3-f2b4-4ab1-a47b-212b3d417083" style="margin: 0px; padding: 0px; display: inline;"&gt;
&lt;div&gt;&lt;a href="http://www.youtube.com/watch?v=wgWyWG2s7wk" target="_new"&gt;&lt;img src="http://blogs.gokulnath.com//content/binary/Windows-Live-Writer/aff5fd2174d2_112B7/video8bdf730d3051.jpg" style="border-style: none" galleryimg="no" onload="var downlevelDiv = document.getElementById('b896bbe3-f2b4-4ab1-a47b-212b3d417083'); downlevelDiv.innerHTML = &amp;quot;&lt;div&gt;&lt;object width=\&amp;quot;448\&amp;quot; height=\&amp;quot;252\&amp;quot;&gt;&lt;param name=\&amp;quot;movie\&amp;quot; value=\&amp;quot;http://www.youtube.com/v/wgWyWG2s7wk?hl=en&amp;amp;hd=1\&amp;quot;&gt;&lt;\/param&gt;&lt;embed src=\&amp;quot;http://www.youtube.com/v/wgWyWG2s7wk?hl=en&amp;amp;hd=1\&amp;quot; type=\&amp;quot;application/x-shockwave-flash\&amp;quot; width=\&amp;quot;448\&amp;quot; height=\&amp;quot;252\&amp;quot;&gt;&lt;\/embed&gt;&lt;\/object&gt;&lt;\/div&gt;&amp;quot;;" alt=""&gt;&lt;/a&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;br&gt;
&lt;br&gt;
If you are beginner, and want to use MRDS to control your Lego Mindstorms NXT 2.0,
refer to my previous posts:&lt;br&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
1. &lt;a href="http://blogs.gokulnath.com//2010/09/04/MicrosoftRoboticsServiceForLEGONXT20.aspx"&gt;Learn
how to create DSS Service and use Manifest Editor&lt;/a&gt;
&lt;br&gt;
2. &lt;a href="http://blogs.gokulnath.com//2010/11/05/MyLegoBot.aspx"&gt;Lego Bot controlled
using MRDS&lt;/a&gt;
&lt;br&gt;
&lt;br&gt;
Feel free to contact me if you have any questions or suggestions.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blogs.gokulnath.com//aggbug.ashx?id=bc44d0d9-550c-425b-84d3-42d5e3fcc508" /&gt;</description>
      <comments>http://blogs.gokulnath.com//CommentView,guid,bc44d0d9-550c-425b-84d3-42d5e3fcc508.aspx</comments>
      <category>.NET</category>
      <category>Robotics</category>
    </item>
    <item>
      <trackback:ping>http://blogs.gokulnath.com//Trackback.aspx?guid=0670d4dd-14a7-44ba-a7ac-a91cae10f3e1</trackback:ping>
      <pingback:server>http://blogs.gokulnath.com//pingback.aspx</pingback:server>
      <pingback:target>http://blogs.gokulnath.com//PermaLink,guid,0670d4dd-14a7-44ba-a7ac-a91cae10f3e1.aspx</pingback:target>
      <dc:creator>Gokulnath</dc:creator>
      <wfw:comment>http://blogs.gokulnath.com//CommentView,guid,0670d4dd-14a7-44ba-a7ac-a91cae10f3e1.aspx</wfw:comment>
      <wfw:commentRss>http://blogs.gokulnath.com//SyndicationService.asmx/GetEntryCommentsRss?guid=0670d4dd-14a7-44ba-a7ac-a91cae10f3e1</wfw:commentRss>
      <slash:comments>2</slash:comments>
      <title>My Lego Bot</title>
      <guid isPermaLink="false">http://blogs.gokulnath.com//PermaLink,guid,0670d4dd-14a7-44ba-a7ac-a91cae10f3e1.aspx</guid>
      <link>http://blogs.gokulnath.com//2010/11/05/MyLegoBot.aspx</link>
      <pubDate>Fri, 05 Nov 2010 16:08:10 GMT</pubDate>
      <description>&lt;p&gt;
&lt;font size="2" face="Tahoma"&gt;In this article I’m going to explain about creating a
fully computer controlled Lego Mindstorms NXT 2.0 Bot (with camera mounted on it)
using Microsoft Robotics Developer Studio (MRDS). My previous article &lt;/font&gt;&lt;a href="http://blogs.gokulnath.com//2010/09/04/MicrosoftRoboticsServiceForLEGONXT20.aspx" target="_blank"&gt;&lt;font size="2" face="Tahoma"&gt;Microsoft
Robotics Service for LEGO NXT 2.0&lt;/font&gt;&lt;/a&gt;&lt;font size="2" face="Tahoma"&gt; should be
useful if you haven’t created any service using the Studio.&lt;br&gt;
&lt;br&gt;
&lt;/font&gt;&lt;strong&gt;&lt;font size="2" face="Tahoma"&gt;Requirements:&lt;br&gt;
&lt;/font&gt;&lt;/strong&gt;&lt;a href="http://mindstorms.lego.com/en-us/Default.aspx" target="_blank"&gt;&lt;font size="2" face="Tahoma"&gt;Lego
Mindstorms NXT 2.0 Kit&lt;/font&gt;&lt;/a&gt;
&lt;br&gt;
&lt;a href="http://www.microsoft.com/robotics/" target="_blank"&gt;&lt;font size="2" face="Tahoma"&gt;Microsoft
Robotics Developer Studio&lt;/font&gt;&lt;/a&gt;
&lt;br&gt;
&lt;font size="2" face="Tahoma"&gt;Network/IP Camera (I used my iPhone with WiFi Camera
app installed on it)&lt;br&gt;
&lt;/font&gt;&lt;a href="http://dashboarding.codeplex.com/" target="_blank"&gt;&lt;font size="2" face="Tahoma"&gt;WPF
Dashboard Controls&lt;/font&gt;&lt;/a&gt;
&lt;br&gt;
&lt;br&gt;
&lt;font face="Tahoma"&gt;&lt;font size="2"&gt;&lt;strong&gt;Download Source Code&lt;/strong&gt;:&lt;br&gt;
&lt;/font&gt;&lt;/font&gt;&lt;a href="content/binary/MyLegoCar.zip"&gt;MyLegoCar.zip (388.43 KB)&lt;/a&gt;
&lt;br&gt;
&lt;font face="Tahoma"&gt;&lt;font size="2"&gt;
&lt;br&gt;
Create a MRDS Service and add the partners - NxtDrive and NxtBattery.&amp;nbsp; Adding
the partners will automatically declare and instantiate an object for BatteryOperations
and an object for DriveOperations. Please add one more for DriveOperations as the
code mentioned below. &lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;&lt;font face="Tahoma"&gt; &lt;span class="rem"&gt;///
&amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font face="Tahoma"&gt; &lt;span class="rem"&gt;///
NxtBattery partner&lt;/span&gt;&lt;/font&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;font face="Tahoma"&gt; &lt;span class="rem"&gt;///
&amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font face="Tahoma"&gt; [Partner(&lt;span class="str"&gt;"NxtBattery"&lt;/span&gt;,
Contract = battery.Contract.Identifier, CreationPolicy = PartnerCreationPolicy.UseExistingOrCreate)]&lt;/font&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;font face="Tahoma"&gt; battery.BatteryOperations
_nxtBatteryPort = &lt;span class="kwrd"&gt;new&lt;/span&gt; battery.BatteryOperations();&lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font face="Tahoma"&gt;&amp;nbsp;&lt;/font&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;font face="Tahoma"&gt; &lt;span class="rem"&gt;///
&amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font face="Tahoma"&gt; &lt;span class="rem"&gt;///
NxtDrive partner&lt;/span&gt;&lt;/font&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;font face="Tahoma"&gt; &lt;span class="rem"&gt;///
&amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font face="Tahoma"&gt; [Partner(&lt;span class="str"&gt;"NxtDrive"&lt;/span&gt;,
Contract = drive.Contract.Identifier, CreationPolicy = PartnerCreationPolicy.UseExistingOrCreate)]&lt;/font&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;font face="Tahoma"&gt; drive.DriveOperations
_nxtDrivePort = &lt;span class="kwrd"&gt;new&lt;/span&gt; drive.DriveOperations();&lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font face="Tahoma"&gt; drive.DriveOperations
_nxtDriveNotify = &lt;span class="kwrd"&gt;new&lt;/span&gt; drive.DriveOperations();&lt;/font&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
&lt;/style&gt;
&lt;p&gt;
&lt;font size="2" face="Tahoma"&gt;Add a new class library project to the solution, and
add an interface to it. This project needs to be referenced in the MRDS Service and
the WPF UI projects (will explain the UI project later). 
&lt;br&gt;
&lt;br&gt;
&lt;/font&gt;
&lt;/p&gt;
&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;&lt;font face="Tahoma"&gt; &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;interface&lt;/span&gt; IMyLegoCarService&lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font face="Tahoma"&gt; {&lt;/font&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;font face="Tahoma"&gt; &lt;span class="kwrd"&gt;double&lt;/span&gt; GearPower
{ get; set; }&lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font face="Tahoma"&gt; &lt;/font&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;font face="Tahoma"&gt; &lt;span class="kwrd"&gt;long&lt;/span&gt; LeftEncoderCurrent
{ get; set; }&lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font face="Tahoma"&gt; &lt;span class="kwrd"&gt;long&lt;/span&gt; RightEncoderCurrent
{ get; set; }&lt;/font&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;font face="Tahoma"&gt;&amp;nbsp;&lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font face="Tahoma"&gt; &lt;span class="kwrd"&gt;double&lt;/span&gt; LeftPowerCurrent
{ get; set; }&lt;/font&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;font face="Tahoma"&gt; &lt;span class="kwrd"&gt;double&lt;/span&gt; RightPowerCurrent
{ get; set; }&lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font face="Tahoma"&gt;&amp;nbsp;&lt;/font&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;font face="Tahoma"&gt; &lt;span class="kwrd"&gt;double&lt;/span&gt; BatteryPower
{ get; set; }&lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font face="Tahoma"&gt;&amp;nbsp;&lt;/font&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;font face="Tahoma"&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Drive(DriveAction
driveDirection);&lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font face="Tahoma"&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; StopEngine();&lt;/font&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;font face="Tahoma"&gt; }&lt;/font&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
&lt;/style&gt;
&lt;p&gt;
&lt;font size="2" face="Tahoma"&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font size="2" face="Tahoma"&gt;Change the MRDS Service in such a way that it implements
this interface. Values for all the properties but the first property (GearPower) will
be set in the service, and they will be retrieved and used in the UI layer. 
&lt;br&gt;
&lt;br&gt;
&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font size="2" face="Tahoma"&gt;Now, add a new WPF project. VS will choose x86 as the
targeted platform by default, change it to "&lt;b&gt;Any CPU&lt;/b&gt;". Declare a property named
Service of type IMyLegoCarService, and add a constructor, something like this. 
&lt;br&gt;
&lt;br&gt;
&lt;/font&gt;
&lt;/p&gt;
&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;&lt;font face="Tahoma"&gt; &lt;span class="kwrd"&gt;public&lt;/span&gt; Dashboard(IMyLegoCarService
service) : &lt;span class="kwrd"&gt;this&lt;/span&gt;()&lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font face="Tahoma"&gt; {&lt;/font&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;font face="Tahoma"&gt; Service
= service;&lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font face="Tahoma"&gt; Service.GearPower = 0;&lt;/font&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;font face="Tahoma"&gt; brsr_ipcamera.Navigate(&lt;span class="kwrd"&gt;new&lt;/span&gt; Uri(&lt;span class="str"&gt;"http://ipoftheiphoneorthewebserver/iphonecamera/index.htm"&lt;/span&gt;));&lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font face="Tahoma"&gt;&amp;nbsp;&lt;/font&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;font face="Tahoma"&gt; UpdateInitialOdometer();&lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font face="Tahoma"&gt;&amp;nbsp;&lt;/font&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;font face="Tahoma"&gt; uiTimer
= &lt;span class="kwrd"&gt;new&lt;/span&gt; DispatcherTimer();&lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font face="Tahoma"&gt; uiTimer.Interval
= TimeSpan.FromSeconds(1);&lt;/font&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;font face="Tahoma"&gt; uiTimer.Tick
+= uiTimer_Tick;&lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font face="Tahoma"&gt; uiTimer.Start();&lt;/font&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;font face="Tahoma"&gt; }&lt;/font&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
&lt;/style&gt;
&lt;br&gt;
&lt;font face="Tahoma"&gt;&lt;font size="2"&gt;This constructor should be called from the Service’s
constructor, so that the service and the UI will be on the same thread. Here “brsr_ipcamera”
is the web browser control to display the ip camera’s image/video (in my case my iphone).
I added an html page to my webserver displaying only the video from the camera. Add
a timer control to display the information retrieved from the service periodically.
Here I’ve used WPF Dashboard Controls’ dial controls as speedometers (for left motor
front, left motor reverse, right motor front and right motor reverse), odometer control
as odometer and progress bar control as fuel gauge.&amp;nbsp; Left/Right Power Current
properties were used to initialize the speedometers. Left/Right Encoder properties
were used to initialize the odometer, these properties basically give us the degrees
that the servo motors rotated. Using the formula: &lt;font color="#0000ff"&gt;distance =
Convert.ToInt32(Math.Abs(currentEncoderCurrent) / 360 * 2 * 3.14 * 0.75, &lt;font color="#000000"&gt;we
can calculate the distance covered. Here, pi = 3.14 and 0.75 is the radius of the
wheels.&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt; 
&lt;p&gt;
&lt;a href="http://blogs.gokulnath.com//content/binary/Windows-Live-Writer/My-Lego-Bot_7C14/CropperCapture%5B5%5D_2.jpg"&gt;&lt;font size="2" face="Tahoma"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="CropperCapture[5]" alt="CropperCapture[5]" src="http://blogs.gokulnath.com//content/binary/Windows-Live-Writer/My-Lego-Bot_7C14/CropperCapture%5B5%5D_thumb.jpg" width="720" border="0" height="553"&gt;&lt;/font&gt;&lt;/a&gt;
&lt;br&gt;
&lt;br&gt;
&lt;font size="2" face="Tahoma"&gt;Coming back to the service. Declare and/or instantiate
the following classes.&lt;br&gt;
&lt;br&gt;
&lt;/font&gt;
&lt;/p&gt;
&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;&lt;font face="Tahoma"&gt; wpf.WpfServicePort _wpfServicePort;&lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font face="Tahoma"&gt; drive.SetDriveRequest
_nxtSetDriveRequest = &lt;span class="kwrd"&gt;new&lt;/span&gt; drive.SetDriveRequest();&lt;/font&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;font face="Tahoma"&gt; battery.BatteryState
_nxtBatteryState;&lt;/font&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;br&gt;
&lt;font size="2" face="Tahoma"&gt;WpfServicePort is used toinvoke the WPF UI, SetDriveRequest
to rotate the motors and the BatteryState to get the battery information. 
&lt;br&gt;
&lt;style type="text/css"&gt;.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
&lt;/style&gt;
&lt;br&gt;
Add a port named “TimerTick” to the service types similar to the automatically created
ports “Get”, “Subscribe” etc. Now your serviceoperations class declaration will be
something like this - 
&lt;br&gt;
&lt;br&gt;
&lt;/font&gt; 
&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;&lt;font face="Tahoma"&gt; [ServicePort]&lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font face="Tahoma"&gt; &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; MyLegoCarServiceOperations
: PortSet&amp;lt;DsspDefaultLookup, DsspDefaultDrop, Get, Subscribe, &lt;strong&gt;TimerTick&lt;/strong&gt;&amp;gt;&lt;/font&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;font face="Tahoma"&gt; {&lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font face="Tahoma"&gt; }&lt;/font&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
&lt;/style&gt;
&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;&lt;font face="Tahoma"&gt; &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; TimerTick
: Update&amp;lt;TimerTickRequest, PortSet&amp;lt;DefaultUpdateResponseType, Fault&amp;gt;&amp;gt;&lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font face="Tahoma"&gt; {&lt;/font&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;font face="Tahoma"&gt; &lt;span class="kwrd"&gt;public&lt;/span&gt; TimerTick()&lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font face="Tahoma"&gt; : &lt;span class="kwrd"&gt;base&lt;/span&gt;(&lt;span class="kwrd"&gt;new&lt;/span&gt; TimerTickRequest())&lt;/font&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;font face="Tahoma"&gt; {&lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font face="Tahoma"&gt; }&lt;/font&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;font face="Tahoma"&gt; }&lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font face="Tahoma"&gt;&amp;nbsp;&lt;/font&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;font face="Tahoma"&gt;&amp;nbsp;&lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font face="Tahoma"&gt; [DataContract]&lt;/font&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;font face="Tahoma"&gt; &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; TimerTickRequest&lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font face="Tahoma"&gt; {&lt;/font&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;font face="Tahoma"&gt; }&lt;/font&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
&lt;/style&gt;
&lt;br&gt;
&lt;font size="2" face="Tahoma"&gt;Modify the service’s start method something like this
- 
&lt;br&gt;
&lt;/font&gt; 
&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;&lt;font face="Tahoma"&gt; &lt;span class="kwrd"&gt;protected&lt;/span&gt; &lt;span class="kwrd"&gt;override&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Start()&lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font face="Tahoma"&gt; {&lt;/font&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;font face="Tahoma"&gt; SpawnIterator(DoStart); &lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font face="Tahoma"&gt; }&lt;/font&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;font face="Tahoma"&gt;&amp;nbsp;&lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font face="Tahoma"&gt; &lt;span class="kwrd"&gt;private&lt;/span&gt; IEnumerator&amp;lt;ITask&amp;gt;
DoStart()&lt;/font&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;font face="Tahoma"&gt; {&lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font face="Tahoma"&gt; DispatcherQueue
queue = &lt;span class="kwrd"&gt;new&lt;/span&gt; DispatcherQueue();&lt;/font&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;font face="Tahoma"&gt;&amp;nbsp;&lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font face="Tahoma"&gt; &lt;span class="kwrd"&gt;this&lt;/span&gt;._wpfServicePort
= wpf.WpfAdapter.Create(queue);&lt;/font&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;font face="Tahoma"&gt;&amp;nbsp;&lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font face="Tahoma"&gt; &lt;span class="rem"&gt;//
invoke the UI&lt;/span&gt;&lt;/font&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;font face="Tahoma"&gt; var runWindow
= &lt;span class="kwrd"&gt;this&lt;/span&gt;._wpfServicePort.RunWindow(() =&amp;gt; (Window)&lt;span class="kwrd"&gt;new&lt;/span&gt; Dashboard(&lt;span class="kwrd"&gt;this&lt;/span&gt;));&lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font face="Tahoma"&gt; &lt;span class="kwrd"&gt;yield&lt;/span&gt; &lt;span class="kwrd"&gt;return&lt;/span&gt; (Choice)runWindow;&lt;/font&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;font face="Tahoma"&gt;&amp;nbsp;&lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font face="Tahoma"&gt; var
exception = (Exception)runWindow;&lt;/font&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;font face="Tahoma"&gt; &lt;span class="kwrd"&gt;if&lt;/span&gt; (exception
!= &lt;span class="kwrd"&gt;null&lt;/span&gt;)&lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font face="Tahoma"&gt; {&lt;/font&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;font face="Tahoma"&gt; LogError(exception);&lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font face="Tahoma"&gt; StartFailed();&lt;/font&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;font face="Tahoma"&gt; &lt;span class="kwrd"&gt;yield&lt;/span&gt; &lt;span class="kwrd"&gt;break&lt;/span&gt;;&lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font face="Tahoma"&gt; } &lt;/font&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;font face="Tahoma"&gt;&amp;nbsp;&lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font face="Tahoma"&gt; &lt;span class="rem"&gt;//
Subscribe to partners &lt;/span&gt;&lt;/font&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;font face="Tahoma"&gt; var
subscribe1 = &lt;span class="kwrd"&gt;this&lt;/span&gt;._nxtDrivePort.Subscribe(_nxtDriveNotify);&lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font face="Tahoma"&gt; &lt;span class="kwrd"&gt;yield&lt;/span&gt; &lt;span class="kwrd"&gt;return&lt;/span&gt; (Choice)subscribe1;&lt;/font&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;font face="Tahoma"&gt;&amp;nbsp;&lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font face="Tahoma"&gt; _timerPort.Post(DateTime.Now);&lt;/font&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;font face="Tahoma"&gt; &lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font face="Tahoma"&gt; &lt;span class="rem"&gt;//
Activate independent tasks&lt;/span&gt;&lt;/font&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;font face="Tahoma"&gt; Activate&amp;lt;ITask&amp;gt;(&lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font face="Tahoma"&gt; Arbiter.Receive&amp;lt;drive.DriveEncodersUpdate&amp;gt;(&lt;span class="kwrd"&gt;true&lt;/span&gt;,
_nxtDriveNotify, DriveEncoderHandler),&lt;/font&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;font face="Tahoma"&gt; Arbiter.Receive(&lt;span class="kwrd"&gt;true&lt;/span&gt;,
_timerPort, TimerHandler)&lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font face="Tahoma"&gt; );&lt;/font&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;font face="Tahoma"&gt;&amp;nbsp;&lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font face="Tahoma"&gt; &lt;span class="rem"&gt;//
Start operation handlers and insert into directory service.&lt;/span&gt;&lt;/font&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;font face="Tahoma"&gt; StartHandlers(); &lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font face="Tahoma"&gt; }&lt;/font&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;font face="Tahoma"&gt;&amp;nbsp;&lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font face="Tahoma"&gt; &lt;span class="kwrd"&gt;private&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; StartHandlers()&lt;/font&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;font face="Tahoma"&gt; {&lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font face="Tahoma"&gt; &lt;span class="rem"&gt;//
Activate message handlers for this service and insert into the directory.&lt;/span&gt;&lt;/font&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;font face="Tahoma"&gt; &lt;span class="kwrd"&gt;base&lt;/span&gt;.Start();&lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font face="Tahoma"&gt;&amp;nbsp;&lt;/font&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;font face="Tahoma"&gt; }&lt;/font&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
&lt;/style&gt;
&lt;p&gt;
&lt;font size="2" face="Tahoma"&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font size="2" face="Tahoma"&gt;Timerport is used to retrieve the battery information
periodically.&lt;br&gt;
&lt;br&gt;
&lt;/font&gt;
&lt;/p&gt;
&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;&lt;font face="Tahoma"&gt; [ServiceHandler(ServiceHandlerBehavior.Exclusive)]&lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font face="Tahoma"&gt; &lt;span class="kwrd"&gt;public&lt;/span&gt; IEnumerator&amp;lt;ITask&amp;gt;
TimerTickHandler(TimerTick incrementTick)&lt;/font&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;font face="Tahoma"&gt; {&lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font face="Tahoma"&gt; incrementTick.ResponsePort.Post(DefaultUpdateResponseType.Instance);&lt;/font&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;font face="Tahoma"&gt;&amp;nbsp;&lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font face="Tahoma"&gt; battery.Get
batteryGet;&lt;/font&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;font face="Tahoma"&gt; &lt;span class="kwrd"&gt;yield&lt;/span&gt; &lt;span class="kwrd"&gt;return&lt;/span&gt; _nxtBatteryPort.Get(GetRequestType.Instance, &lt;span class="kwrd"&gt;out&lt;/span&gt; batteryGet);&lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font face="Tahoma"&gt; _nxtBatteryState
= batteryGet.ResponsePort;&lt;/font&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;font face="Tahoma"&gt; &lt;span class="kwrd"&gt;if&lt;/span&gt; (_nxtBatteryState
!= &lt;span class="kwrd"&gt;null&lt;/span&gt;)&lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font face="Tahoma"&gt; {&lt;/font&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;font face="Tahoma"&gt; BatteryPower
= _nxtBatteryState.PercentBatteryPower; &lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font face="Tahoma"&gt; } &lt;/font&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;font face="Tahoma"&gt;&amp;nbsp;&lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font face="Tahoma"&gt; &lt;span class="kwrd"&gt;yield&lt;/span&gt; &lt;span class="kwrd"&gt;break&lt;/span&gt;;&lt;/font&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;font face="Tahoma"&gt; }&lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font face="Tahoma"&gt;&amp;nbsp;&lt;/font&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;font face="Tahoma"&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; TimerHandler(DateTime
signal)&lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font face="Tahoma"&gt; {&lt;/font&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;font face="Tahoma"&gt; _mainPort.Post(&lt;span class="kwrd"&gt;new&lt;/span&gt; TimerTick());&lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font face="Tahoma"&gt; Activate(&lt;/font&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;font face="Tahoma"&gt; Arbiter.Receive(&lt;span class="kwrd"&gt;false&lt;/span&gt;,
TimeoutPort(3000),&lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font face="Tahoma"&gt; &lt;span class="kwrd"&gt;delegate&lt;/span&gt;(DateTime
time)&lt;/font&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;font face="Tahoma"&gt; {&lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font face="Tahoma"&gt; _timerPort.Post(time);&lt;/font&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;font face="Tahoma"&gt; }&lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font face="Tahoma"&gt; )&lt;/font&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;font face="Tahoma"&gt; );&lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font face="Tahoma"&gt; }&lt;/font&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
&lt;/style&gt;
&lt;p&gt;
&lt;font size="2" face="Tahoma"&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font size="2" face="Tahoma"&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font size="2" face="Tahoma"&gt;DriveEncoderUpdate to retrieve the information from the
servo motors.&lt;br&gt;
&lt;br&gt;
&lt;/font&gt;
&lt;/p&gt;
&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;&lt;font face="Tahoma"&gt; &lt;span class="kwrd"&gt;private&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; DriveEncoderHandler(drive.DriveEncodersUpdate
statistics)&lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font face="Tahoma"&gt; {&lt;/font&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;font face="Tahoma"&gt; LeftEncoderCurrent
= statistics.Body.LeftEncoderCurrent;&lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font face="Tahoma"&gt; RightEncoderCurrent
= statistics.Body.RightEncoderCurrent;&lt;/font&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;font face="Tahoma"&gt; LeftPowerCurrent
= statistics.Body.LeftPowerCurrent;&lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font face="Tahoma"&gt; RightPowerCurrent
= statistics.Body.RightPowerCurrent;&lt;/font&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;font face="Tahoma"&gt;&amp;nbsp;&lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font face="Tahoma"&gt; }&lt;/font&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
&lt;/style&gt;
&lt;br&gt;
&lt;font size="2" face="Tahoma"&gt;Create an enum named “DriveAction” in the common class
library project. This is to handle the keyboard or the click events from the UI Layer.&lt;br&gt;
&lt;/font&gt; 
&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;&lt;font face="Tahoma"&gt; &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;enum&lt;/span&gt; DriveAction&lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font face="Tahoma"&gt; {&lt;/font&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;font face="Tahoma"&gt; Front,&lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font face="Tahoma"&gt; Back,&lt;/font&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;font face="Tahoma"&gt; Left,&lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font face="Tahoma"&gt; Right,&lt;/font&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;font face="Tahoma"&gt; Stop&lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font face="Tahoma"&gt; }&lt;/font&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
&lt;/style&gt;
&lt;br&gt;
&lt;font size="2" face="Tahoma"&gt;Implement the Drive method in the service.&lt;br&gt;
&lt;/font&gt; 
&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;&lt;font face="Tahoma"&gt; &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Drive(DriveAction
driveAction)&lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font face="Tahoma"&gt; {&lt;/font&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;font face="Tahoma"&gt; &lt;span class="kwrd"&gt;switch&lt;/span&gt; (driveAction)&lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font face="Tahoma"&gt; {&lt;/font&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;font face="Tahoma"&gt; &lt;span class="kwrd"&gt;case&lt;/span&gt; DriveAction.Front:&lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font face="Tahoma"&gt; _nxtSetDriveRequest.LeftPower
= -GearPower;&lt;/font&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;font face="Tahoma"&gt; _nxtSetDriveRequest.RightPower
= -GearPower;&lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font face="Tahoma"&gt; _nxtDrivePort.DriveDistance(_nxtSetDriveRequest);&lt;/font&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;font face="Tahoma"&gt;&amp;nbsp;&lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font face="Tahoma"&gt; &lt;span class="kwrd"&gt;break&lt;/span&gt;;&lt;/font&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;font face="Tahoma"&gt; &lt;span class="kwrd"&gt;case&lt;/span&gt; DriveAction.Back:&lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font face="Tahoma"&gt; _nxtSetDriveRequest.LeftPower
= GearPower;&lt;/font&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;font face="Tahoma"&gt; _nxtSetDriveRequest.RightPower
= GearPower;&lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font face="Tahoma"&gt; _nxtDrivePort.DriveDistance(_nxtSetDriveRequest);&lt;/font&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;font face="Tahoma"&gt; &lt;span class="kwrd"&gt;break&lt;/span&gt;;&lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font face="Tahoma"&gt; &lt;span class="kwrd"&gt;case&lt;/span&gt; DriveAction.Left:&lt;/font&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;font face="Tahoma"&gt; _nxtSetDriveRequest.LeftPower
= -.4;&lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font face="Tahoma"&gt; _nxtSetDriveRequest.RightPower = .4;&lt;/font&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;font face="Tahoma"&gt; _nxtDrivePort.DriveDistance(_nxtSetDriveRequest);&lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font face="Tahoma"&gt;&amp;nbsp;&lt;/font&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;font face="Tahoma"&gt; &lt;span class="kwrd"&gt;break&lt;/span&gt;;&lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font face="Tahoma"&gt; &lt;span class="kwrd"&gt;case&lt;/span&gt; DriveAction.Right:&lt;/font&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;font face="Tahoma"&gt; _nxtSetDriveRequest.LeftPower
= .4;&lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font face="Tahoma"&gt; _nxtSetDriveRequest.RightPower = -.4;&lt;/font&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;font face="Tahoma"&gt; _nxtDrivePort.DriveDistance(_nxtSetDriveRequest);&lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font face="Tahoma"&gt; &lt;span class="kwrd"&gt;break&lt;/span&gt;;&lt;/font&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;font face="Tahoma"&gt; &lt;span class="kwrd"&gt;case&lt;/span&gt; DriveAction.Stop:&lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font face="Tahoma"&gt; _nxtDrivePort.AllStop(MotorStopState.Coast);&lt;/font&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;font face="Tahoma"&gt; &lt;span class="kwrd"&gt;break&lt;/span&gt;;&lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font face="Tahoma"&gt; &lt;span class="kwrd"&gt;default&lt;/span&gt;:&lt;/font&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;font face="Tahoma"&gt; &lt;span class="kwrd"&gt;break&lt;/span&gt;;&lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font face="Tahoma"&gt; }&lt;/font&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;font face="Tahoma"&gt; }&lt;/font&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
&lt;/style&gt;
&lt;p&gt;
&lt;font size="2" face="Tahoma"&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;br&gt;
&lt;font size="2" face="Tahoma"&gt;I suppose I’ve explained most of the important parts
in the service. Please let me know if you have any questions.&lt;br&gt;
&lt;br&gt;
My bot in action:&lt;br&gt;
&lt;/font&gt;
&lt;/p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:5737277B-5D6D-4f48-ABFC-DD9C333F4C5D:f6e9c234-c48c-42d2-b875-c43e33b88ce5" class="wlWriterEditableSmartContent"&gt;
&lt;div id="3ea6e71a-f181-4ec8-a093-b18585a95d64" style="margin: 0px; padding: 0px; display: inline;"&gt;
&lt;div&gt;&lt;font size="2" face="Tahoma"&gt;&lt;a href="http://www.youtube.com/watch?v=YUXAIZXGfQk" target="_new"&gt;&lt;img src="http://blogs.gokulnath.com//content/binary/Windows-Live-Writer/My-Lego-Bot_7C14/video103d9a381a84.jpg" style="border-style: none" galleryimg="no" onload="var downlevelDiv = document.getElementById('3ea6e71a-f181-4ec8-a093-b18585a95d64'); downlevelDiv.innerHTML = &amp;quot;&lt;div&gt;&lt;object width=\&amp;quot;448\&amp;quot; height=\&amp;quot;252\&amp;quot;&gt;&lt;param name=\&amp;quot;movie\&amp;quot; value=\&amp;quot;http://www.youtube.com/v/YUXAIZXGfQk?hl=en&amp;amp;hd=1\&amp;quot;&gt;&lt;\/param&gt;&lt;embed src=\&amp;quot;http://www.youtube.com/v/YUXAIZXGfQk?hl=en&amp;amp;hd=1\&amp;quot; type=\&amp;quot;application/x-shockwave-flash\&amp;quot; width=\&amp;quot;448\&amp;quot; height=\&amp;quot;252\&amp;quot;&gt;&lt;\/embed&gt;&lt;\/object&gt;&lt;\/div&gt;&amp;quot;;" alt=""&gt;&lt;/a&gt;&lt;/font&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div style="width:448px;clear:both;font-size:.8em"&gt;&lt;font size="2" face="Tahoma"&gt;demo&lt;/font&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blogs.gokulnath.com//aggbug.ashx?id=0670d4dd-14a7-44ba-a7ac-a91cae10f3e1" /&gt;</description>
      <comments>http://blogs.gokulnath.com//CommentView,guid,0670d4dd-14a7-44ba-a7ac-a91cae10f3e1.aspx</comments>
      <category>.NET</category>
      <category>Robotics</category>
    </item>
    <item>
      <trackback:ping>http://blogs.gokulnath.com//Trackback.aspx?guid=4831ceeb-722c-4872-8d31-275b773c9e8a</trackback:ping>
      <pingback:server>http://blogs.gokulnath.com//pingback.aspx</pingback:server>
      <pingback:target>http://blogs.gokulnath.com//PermaLink,guid,4831ceeb-722c-4872-8d31-275b773c9e8a.aspx</pingback:target>
      <dc:creator>Gokulnath</dc:creator>
      <wfw:comment>http://blogs.gokulnath.com//CommentView,guid,4831ceeb-722c-4872-8d31-275b773c9e8a.aspx</wfw:comment>
      <wfw:commentRss>http://blogs.gokulnath.com//SyndicationService.asmx/GetEntryCommentsRss?guid=4831ceeb-722c-4872-8d31-275b773c9e8a</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <font size="2" face="Tahoma">I’ve explained here about creating Microsoft Robotics
Service for LEGO NXT 2.0 and configuring its manifest. When I wanted to create my
first robotics service, I had many difficulties and found very few resources over
the internet for LEGO NXT 2.0 using Microsoft Robotics, so just thought of blogging
about this.<br /><br /></font>
          <font size="2">
            <font face="Tahoma">
              <strong>Requirements<br /></strong>Microsoft Robotics Studio – </font>
          </font>
          <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=c185a802-5bbe-4f28-b448-aefe63a7eff7&amp;displaylang=en" target="_blank">
            <font size="2" face="Tahoma">Click
here</font>
          </a>
          <font size="2" face="Tahoma"> to download. </font>
          <a href="http://www.microsoft.com/robotics/#Product" target="_blank">
            <font size="2" face="Tahoma">Click
here</font>
          </a>
          <font size="2" face="Tahoma"> to know more about the studio.<br />
LEGO NXT 2.0<br /><br /></font>
          <font face="Tahoma">
            <font size="2">
              <strong>Installation<br /></strong>Microsoft Robotics Studio can be used as a stand-alone development environment
or </font>
            <font size="2">it can be used with any of the Visual Studio 2008 or 2010
Editions, including the Express Editions.</font>
          </font>
        </p>
        <p>
          <font size="2">
            <font face="Tahoma">
              <strong>How to create DSS Service?<br /></strong>1. After Installing Microsoft Robotics Studio, open Visual Studio IDE (I’m
using 2010).<br />
2. Click File/New Project, you should be able to see Microsoft Robotics under C# like
this - 
<br /><br /><a href="http://blogs.gokulnath.com//content/binary/WindowsLiveWriter/MicrosoftRoboticsServiceforLEGONXT2.0_12E39/CropperCapture%5B2%5D_2.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="CropperCapture[2]" border="0" alt="CropperCapture[2]" src="http://blogs.gokulnath.com//content/binary/WindowsLiveWriter/MicrosoftRoboticsServiceforLEGONXT2.0_12E39/CropperCapture%5B2%5D_thumb.jpg" width="590" height="409" /></a><br /><br />
3. Create the project under Microsoft Robotics Studio installation folder (it will
be mostly in c:\user\username\microsoft robotics dev studio 2008 r3\), so that the
common robotics dlls will be referenced properly.<br />
4. Click OK and you will be allowed to enter your service name, namespace and other
details. The most important thing is – you will be allowed to choose your partners
from here - 
<br /><br /><a href="http://blogs.gokulnath.com//content/binary/WindowsLiveWriter/MicrosoftRoboticsServiceforLEGONXT2.0_12E39/CropperCapture%5B5%5D_2.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="CropperCapture[5]" border="0" alt="CropperCapture[5]" src="http://blogs.gokulnath.com//content/binary/WindowsLiveWriter/MicrosoftRoboticsServiceforLEGONXT2.0_12E39/CropperCapture%5B5%5D_thumb.jpg" width="596" height="436" /></a><br /><br />
5. Choose the partners one by one from the list and click “Add as partner”. Check
the “Add notification port” checkbox and leave the Creation Policy as it is. Lego
NXT Brick (v2) should be selected as one of the partners, and the other partners can
be selected based on the sensors that you will be using. In case if you want to edit
or delete any of the added partners, you can choose the partner from the partner dropdown
and perform your actions. Once all the partners are selected, click OK.<br />
6. You should be able to see the auto-generated code now. Build your solution.<br /><br /><strong>How to create manifest using DSS Manifest Editor?</strong><br /></font>
          </font>
          <font size="2">
            <font face="Tahoma">1. Open DSS Manifest Editor.<br />
2. Choose your service from the left, drag and drop it on the editor. You should be
able to see this - 
<br /><br /><a href="http://blogs.gokulnath.com//content/binary/WindowsLiveWriter/MicrosoftRoboticsServiceforLEGONXT2.0_12E39/CropperCapture%5B6%5D_2.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="CropperCapture[6]" border="0" alt="CropperCapture[6]" src="http://blogs.gokulnath.com//content/binary/WindowsLiveWriter/MicrosoftRoboticsServiceforLEGONXT2.0_12E39/CropperCapture%5B6%5D_thumb.jpg" width="597" height="352" /></a><br /><br />
3. Search for your partners on the left, drag and drop on “Use service’s partner definition
(UseExistingOrCreate)” boxes appropriately.<br />
4. As the sensors in turn use the nxtbrick as their partner, another set of “Use service’s
partner definition (UseExistingOrCreate)” boxes will be created for the brick.<br />
5. You need to select nxtbrick service again and drop it on the boxes. If you see
a pop like the one below, choose the already created service and NOT “Add a new instance”.<br /><br /><a href="http://blogs.gokulnath.com//content/binary/WindowsLiveWriter/MicrosoftRoboticsServiceforLEGONXT2.0_12E39/CropperCapture%5B7%5D_2.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="CropperCapture[7]" border="0" alt="CropperCapture[7]" src="http://blogs.gokulnath.com//content/binary/WindowsLiveWriter/MicrosoftRoboticsServiceforLEGONXT2.0_12E39/CropperCapture%5B7%5D_thumb.jpg" width="338" height="252" /></a> <br /><br />
6. To configure the service, click it and then press “Create Initial State” button
on the properties window. For the NxtBrick, you need to set the serial port number
used for bluetooth connection. For the sensors, you need to set the ports appropriately.<br />
7. Replace this manifest with the manifest created by the service.<br />
8. To start the service execute <strong>dsshost /port:50000 /manifest:"C:\Users\username\Microsoft
Robotics Dev Studio 2008 R3\MyDemoService\MyDemoService.manifest.xml”</strong> in
DSS Command Prompt.<br />
9. You can also start the service from the DSS Control Panel. In order to view the
control panel, start DSS Node and then go to <a href="http://localhost:50000">http://localhost:50000</a> (default
port is 50000, if you’ve changed it use it accordingly).<br />
10. Switch ON your LEGO NXT 2.0 and then start the service. If everything is configured
properly, you should be able to hear connecting sound from the NXT Brick.<br /><br />
This is it for now, in the next blog post, I’ll be explaining about adding handlers
to the sensors and using the motors.<br /></font>
          </font>
        </p>
        <img width="0" height="0" src="http://blogs.gokulnath.com//aggbug.ashx?id=4831ceeb-722c-4872-8d31-275b773c9e8a" />
      </body>
      <title>Microsoft Robotics Service for LEGO NXT 2.0</title>
      <guid isPermaLink="false">http://blogs.gokulnath.com//PermaLink,guid,4831ceeb-722c-4872-8d31-275b773c9e8a.aspx</guid>
      <link>http://blogs.gokulnath.com//2010/09/04/MicrosoftRoboticsServiceForLEGONXT20.aspx</link>
      <pubDate>Sat, 04 Sep 2010 03:51:21 GMT</pubDate>
      <description>&lt;p&gt;
&lt;font size="2" face="Tahoma"&gt;I’ve explained here about creating Microsoft Robotics
Service for LEGO NXT 2.0 and configuring its manifest. When I wanted to create my
first robotics service, I had many difficulties and found very few resources over
the internet for LEGO NXT 2.0 using Microsoft Robotics, so just thought of blogging
about this.&lt;br&gt;
&lt;br&gt;
&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Tahoma"&gt;&lt;strong&gt;Requirements&lt;br&gt;
&lt;/strong&gt;Microsoft Robotics Studio – &lt;/font&gt;&lt;/font&gt;&lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=c185a802-5bbe-4f28-b448-aefe63a7eff7&amp;amp;displaylang=en" target="_blank"&gt;&lt;font size="2" face="Tahoma"&gt;Click
here&lt;/font&gt;&lt;/a&gt;&lt;font size="2" face="Tahoma"&gt; to download. &lt;/font&gt;&lt;a href="http://www.microsoft.com/robotics/#Product" target="_blank"&gt;&lt;font size="2" face="Tahoma"&gt;Click
here&lt;/font&gt;&lt;/a&gt;&lt;font size="2" face="Tahoma"&gt; to know more about the studio.&lt;br&gt;
LEGO NXT 2.0&lt;br&gt;
&lt;br&gt;
&lt;/font&gt;&lt;font face="Tahoma"&gt;&lt;font size="2"&gt;&lt;strong&gt;Installation&lt;br&gt;
&lt;/strong&gt;Microsoft Robotics Studio can be used as a stand-alone development environment
or &lt;/font&gt;&lt;font size="2"&gt;it can be used with any of the Visual Studio 2008 or 2010
Editions, including the Express Editions.&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font size="2"&gt;&lt;font face="Tahoma"&gt;&lt;strong&gt;How to create DSS Service?&lt;br&gt;
&lt;/strong&gt;1. After Installing Microsoft Robotics Studio, open Visual Studio IDE (I’m
using 2010).&lt;br&gt;
2. Click File/New Project, you should be able to see Microsoft Robotics under C# like
this - 
&lt;br&gt;
&lt;br&gt;
&lt;a href="http://blogs.gokulnath.com//content/binary/WindowsLiveWriter/MicrosoftRoboticsServiceforLEGONXT2.0_12E39/CropperCapture%5B2%5D_2.jpg"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="CropperCapture[2]" border="0" alt="CropperCapture[2]" src="http://blogs.gokulnath.com//content/binary/WindowsLiveWriter/MicrosoftRoboticsServiceforLEGONXT2.0_12E39/CropperCapture%5B2%5D_thumb.jpg" width="590" height="409"&gt;&lt;/a&gt; 
&lt;br&gt;
&lt;br&gt;
3. Create the project under Microsoft Robotics Studio installation folder (it will
be mostly in c:\user\username\microsoft robotics dev studio 2008 r3\), so that the
common robotics dlls will be referenced properly.&lt;br&gt;
4. Click OK and you will be allowed to enter your service name, namespace and other
details. The most important thing is – you will be allowed to choose your partners
from here - 
&lt;br&gt;
&lt;br&gt;
&lt;a href="http://blogs.gokulnath.com//content/binary/WindowsLiveWriter/MicrosoftRoboticsServiceforLEGONXT2.0_12E39/CropperCapture%5B5%5D_2.jpg"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="CropperCapture[5]" border="0" alt="CropperCapture[5]" src="http://blogs.gokulnath.com//content/binary/WindowsLiveWriter/MicrosoftRoboticsServiceforLEGONXT2.0_12E39/CropperCapture%5B5%5D_thumb.jpg" width="596" height="436"&gt;&lt;/a&gt; 
&lt;br&gt;
&lt;br&gt;
5. Choose the partners one by one from the list and click “Add as partner”. Check
the “Add notification port” checkbox and leave the Creation Policy as it is. Lego
NXT Brick (v2) should be selected as one of the partners, and the other partners can
be selected based on the sensors that you will be using. In case if you want to edit
or delete any of the added partners, you can choose the partner from the partner dropdown
and perform your actions. Once all the partners are selected, click OK.&lt;br&gt;
6. You should be able to see the auto-generated code now. Build your solution.&lt;br&gt;
&lt;br&gt;
&lt;strong&gt;How to create manifest using DSS Manifest Editor?&lt;/strong&gt;
&lt;br&gt;
&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Tahoma"&gt;1. Open DSS Manifest Editor.&lt;br&gt;
2. Choose your service from the left, drag and drop it on the editor. You should be
able to see this - 
&lt;br&gt;
&lt;br&gt;
&lt;a href="http://blogs.gokulnath.com//content/binary/WindowsLiveWriter/MicrosoftRoboticsServiceforLEGONXT2.0_12E39/CropperCapture%5B6%5D_2.jpg"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="CropperCapture[6]" border="0" alt="CropperCapture[6]" src="http://blogs.gokulnath.com//content/binary/WindowsLiveWriter/MicrosoftRoboticsServiceforLEGONXT2.0_12E39/CropperCapture%5B6%5D_thumb.jpg" width="597" height="352"&gt;&lt;/a&gt; 
&lt;br&gt;
&lt;br&gt;
3. Search for your partners on the left, drag and drop on “Use service’s partner definition
(UseExistingOrCreate)” boxes appropriately.&lt;br&gt;
4. As the sensors in turn use the nxtbrick as their partner, another set of “Use service’s
partner definition (UseExistingOrCreate)” boxes will be created for the brick.&lt;br&gt;
5. You need to select nxtbrick service again and drop it on the boxes. If you see
a pop like the one below, choose the already created service and NOT “Add a new instance”.&lt;br&gt;
&lt;br&gt;
&lt;a href="http://blogs.gokulnath.com//content/binary/WindowsLiveWriter/MicrosoftRoboticsServiceforLEGONXT2.0_12E39/CropperCapture%5B7%5D_2.jpg"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="CropperCapture[7]" border="0" alt="CropperCapture[7]" src="http://blogs.gokulnath.com//content/binary/WindowsLiveWriter/MicrosoftRoboticsServiceforLEGONXT2.0_12E39/CropperCapture%5B7%5D_thumb.jpg" width="338" height="252"&gt;&lt;/a&gt;&amp;nbsp;&lt;br&gt;
&lt;br&gt;
6. To configure the service, click it and then press “Create Initial State” button
on the properties window. For the NxtBrick, you need to set the serial port number
used for bluetooth connection. For the sensors, you need to set the ports appropriately.&lt;br&gt;
7. Replace this manifest with the manifest created by the service.&lt;br&gt;
8. To start the service execute &lt;strong&gt;dsshost /port:50000 /manifest:"C:\Users\username\Microsoft
Robotics Dev Studio 2008 R3\MyDemoService\MyDemoService.manifest.xml”&lt;/strong&gt; in
DSS Command Prompt.&lt;br&gt;
9. You can also start the service from the DSS Control Panel. In order to view the
control panel, start DSS Node and then go to &lt;a href="http://localhost:50000"&gt;http://localhost:50000&lt;/a&gt; (default
port is 50000, if you’ve changed it use it accordingly).&lt;br&gt;
10. Switch ON your LEGO NXT 2.0 and then start the service. If everything is configured
properly, you should be able to hear connecting sound from the NXT Brick.&lt;br&gt;
&lt;br&gt;
This is it for now, in the next blog post, I’ll be explaining about adding handlers
to the sensors and using the motors.&lt;br&gt;
&lt;/font&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blogs.gokulnath.com//aggbug.ashx?id=4831ceeb-722c-4872-8d31-275b773c9e8a" /&gt;</description>
      <comments>http://blogs.gokulnath.com//CommentView,guid,4831ceeb-722c-4872-8d31-275b773c9e8a.aspx</comments>
      <category>.NET</category>
      <category>Robotics</category>
    </item>
  </channel>
</rss>