How to Create and Simulate a Microsoft Robotics Studio Service

Install the Microsoft Robotic Studio., Create a new blank service Create a blank service from Start, Programs, Microsoft Robotics Studio (1.5) Run MSRS Command Prompt Type ‘md My’ to create a new directory for your projects Type ‘cd My’ to move into...

9 Steps 3 min read Medium

Step-by-Step Guide

  1. Step 1: Install the Microsoft Robotic Studio.

    Go to Microsoft Download Search for robotics Download Microsoft Robotics Studio
    1.5 Download Runtime and Tools Update for Microsoft Robotics Studio (1.5) Nov 2007 Install both of them
  2. Step 2: Create a new blank service Create a blank service from Start

    , It allows the _drivePort to be free as often as possible , So, add ‘_drivePort.Subscribe(_driveNotify);’ below ‘base.Start();’ in the Start function.

    Now we need to add a function to listen to messages that come in on the _driveNotify port.

    The code we add is complex for the simple concept we want to achieve.

    But it allows the runtime to synchronize the processing better (from what I understand of it at least) Code Block 1 We made reference in that block of code to a function named DriveUpdateHandler.

    Here’s the implementation.

    All it does is to set the robot into a wide circle.

    This is NOT the best way to do this.

    But it gives you a quick understanding of how everything gets wired up.

    Code Block 2 Build the project.

    It should compile and build just fine. , We didn’t specifically state that we’re connecting to the simulation environment in our code.

    So we have to do it somewhere else.

    That place is in the manifest file.

    The one for this project is called Simplest.manifest.xml.

    We want to open it in the manifest editor.

    From Start, Programs, Microsoft Robotics Studio (1.5) run Microsoft Dss Manifest Editor.

    Click File, Open, choose your manifest file C:\Microsoft Robotics Studio (1.5)\My\Simplest\Simplest.manifest.xml Find the Simulation Engine service from the list of services on the left.

    Add it to your manifest.

    With the SimulationEngine selected IN your manifest, Click the Import Initial State button in the properties window.

    Change to the samples\config folder (C:\Microsoft Robotics Studio (1.5)\samples\Config) Change the file type to Any XML File Choose iRobot.Create.Simulation.xml This will load a bunch of standard entities (blocks and such) as well as the iRobot Create entity.

    It is named IRobotCreateMotorBase Now we choose the simplest service in the manifest editor Then find Simulated Generic Differential Drive in the list of services on the left Add it to the manifest diagram by dragging it ON TOP OF the simplest drive entry in the manifest.

    This will do two things.

    Add the SimulatedGenericDifferentialDrive service AND associate it with the simplest drive service.

    This is why we chose PartnerCreationPolicy.UsePartnerListEntry in the declaration in our code.

    The only thing left is to associate the SimulatedGenericDifferentialDrive service to an actual entity in the SimulationEngine configuration.

    So, click on the Entity reference under SimulatedDifferentialDrive and set the Simulation Entity property to ‘http://localhost/IRobotCreateMotorBase’. , I am by no means an expert.

    It has taken me a couple weeks to figure this stuff out.

    And since these parts finally clicked I decided to post them for everyone’s benefit.
  3. Step 3: Programs

  4. Step 4: Microsoft Robotics Studio (1.5) Run MSRS Command Prompt Type ‘md My’ to create a new directory for your projects Type ‘cd My’ to move into that directory Type ‘dssnewservice /service:Simplest’

  5. Step 5: Add some basic handling to your project so we will reference a drive partner Type ‘cd Simplest’ to move into your new services’ directory Type ‘Simplest.sln’ to open your service in Visual Studio C# Open the Solution Explorer (ctrl-w

  6. Step 6: s) Add a reference to RoboticsCommon.proxy Open the file Simplest.cs from the Solution Explorer Add a new using statement at the top ‘using drive = Microsoft.Robotics.Services.Drive.Proxy;’ Add a partner reference below _mainPort declaration ‘’ Add a port for this partner just below the line you just added ‘private drive.DriveOperations _drivePort = new drive.DriveOperations();’ Add another port just below that one ‘private drive.DriveOperations _driveNotify = new drive.DriveOperations();’ This port will be what we use to actually handle notifications that are sent to us.

  7. Step 7: Now let’s listen to this partners notification messages We want the _driveNotify port to get messages sent to the _drivePort.

  8. Step 8: Now that we’re wired up with the partner so it will listen for the update message we want to connect to the simulation environment.

  9. Step 9: Push F5.

Detailed Guide

Go to Microsoft Download Search for robotics Download Microsoft Robotics Studio
1.5 Download Runtime and Tools Update for Microsoft Robotics Studio (1.5) Nov 2007 Install both of them

, It allows the _drivePort to be free as often as possible , So, add ‘_drivePort.Subscribe(_driveNotify);’ below ‘base.Start();’ in the Start function.

Now we need to add a function to listen to messages that come in on the _driveNotify port.

The code we add is complex for the simple concept we want to achieve.

But it allows the runtime to synchronize the processing better (from what I understand of it at least) Code Block 1 We made reference in that block of code to a function named DriveUpdateHandler.

Here’s the implementation.

All it does is to set the robot into a wide circle.

This is NOT the best way to do this.

But it gives you a quick understanding of how everything gets wired up.

Code Block 2 Build the project.

It should compile and build just fine. , We didn’t specifically state that we’re connecting to the simulation environment in our code.

So we have to do it somewhere else.

That place is in the manifest file.

The one for this project is called Simplest.manifest.xml.

We want to open it in the manifest editor.

From Start, Programs, Microsoft Robotics Studio (1.5) run Microsoft Dss Manifest Editor.

Click File, Open, choose your manifest file C:\Microsoft Robotics Studio (1.5)\My\Simplest\Simplest.manifest.xml Find the Simulation Engine service from the list of services on the left.

Add it to your manifest.

With the SimulationEngine selected IN your manifest, Click the Import Initial State button in the properties window.

Change to the samples\config folder (C:\Microsoft Robotics Studio (1.5)\samples\Config) Change the file type to Any XML File Choose iRobot.Create.Simulation.xml This will load a bunch of standard entities (blocks and such) as well as the iRobot Create entity.

It is named IRobotCreateMotorBase Now we choose the simplest service in the manifest editor Then find Simulated Generic Differential Drive in the list of services on the left Add it to the manifest diagram by dragging it ON TOP OF the simplest drive entry in the manifest.

This will do two things.

Add the SimulatedGenericDifferentialDrive service AND associate it with the simplest drive service.

This is why we chose PartnerCreationPolicy.UsePartnerListEntry in the declaration in our code.

The only thing left is to associate the SimulatedGenericDifferentialDrive service to an actual entity in the SimulationEngine configuration.

So, click on the Entity reference under SimulatedDifferentialDrive and set the Simulation Entity property to ‘http://localhost/IRobotCreateMotorBase’. , I am by no means an expert.

It has taken me a couple weeks to figure this stuff out.

And since these parts finally clicked I decided to post them for everyone’s benefit.

About the Author

P

Patrick Ford

Writer and educator with a focus on practical hobbies knowledge.

34 articles
View all articles

Rate This Guide

--
Loading...
5
0
4
0
3
0
2
0
1
0

How helpful was this guide? Click to rate: