Starting

I am doing a graduate project of robot swarm simulation in Robotics Studio. I am newbie in the program, I already know C# and XML language, the simulations tutorials, etc.

I was trying to start a clean new MSRS project (I mean, not just modifying the samples), but I don't know how to start.

1) What are all the files of a MSRS project, what each one do? Can someone describe them one-by-one?

2) I already can import an OBJ file with robot design, but I couldn't describe physics structure in XML. I didn't find a tutorial with all parameters description.

Thanks a lot for your help.

[1509 byte] By [T.N.T.] at [2008-2-18]
# 1

We have information about how to create service projects at [1] and service tutorial 1 takes you through how to get started from there (see [2]). In addition, we are in the process of generating some more information about the various parts of a service so stay tuned.

Henrik

[1] http://msdn2.microsoft.com/en-us/library/bb483009.aspx

[2] http://msdn2.microsoft.com/en-us/library/bb483064.aspx

HenrikFNielsen at 2007-9-26 > top of Msdn Tech,Microsoft Robotics Studio,Microsoft Robotics - Community...
# 2

Here is a little more documentation on service projects.

* * * * *

Service projects can be created using Microsoft Visual Programming Language or various .Net languages. However, regardless of how a service project is created, it contains a common set of components as described below.

Service Project Files

For illustration we create a basic sample C# project using DSS New Service Generation Tool (DssNewService.exe) although the same would apply to other supported programming languages. Note also that you can also create a new service project directly within Visual Studio by selecting "New Project" and then pick the appropriate Microsoft Robotics Studio project template (see Creating Service Projects).

From a Microsoft Robotics Studio Command Prompt, type the following to create the sample C# service project:

DssNewService.exe /sTongue TiedimpleSample 

This creates a new directory called SimpleSample which we can inspect by typing the following

cd SimpleSample dir 

The resulting output looks similar to this (note that time stamps and size may vary)

06/03/07 10:00 674 AssemblyInfo.cs 06/03/07 10:00 2,229 SimpleSample.cs 06/03/07 10:00 5,048 SimpleSample.csproj 06/03/07 10:00 1,233 SimpleSample.csproj.user 06/03/07 10:00 398 SimpleSample.manifest.xml 06/03/07 10:00 909 SimpleSample.sln 06/03/07 10:00 5,375 SimpleSampleTypes.cs

The service project files fall into three categories: Visual Studio files, source code files, and manifests as described below:

Visual Studio Files

The files SimpleSample.csproj, SimpleSample.csproj.user, and SimpleSample.sln are used by Visual Studio to manage the service project. Visual Studio provides two types of containers called solutions and projects for managing items necessary for developing services such as references, folders, files, and dependencies. In addition, Visual Studio provides Solution Folders to organize related projects into groups and then perform actions on those groups of projects. Solution Explorer, an interface for viewing and managing these containers and their associated items, is part of the Visual Studio integrated development environment (IDE).

To open the service project within Visual Studio you can either start Visual Studio from the Start menu or type the name of the project or solution on the command line of a Microsoft Robotics Studio Command Prompt, for example

SimpleSample.sln 

If you are not already familiar with the Visual Studio IDE, projects and solutions, then please refer to the Visual Studio documentation within the MSDN library for details.

Source Code Files

The source code files SimpleSample.cs, SimpleSampleTypes.cs, and AssemblyInfo.cs represent a starting point for the actual service implementation. While the service project at this point already contains some code, it is only a template for how to build up a complete service implementation. The AssemblyInfo.cs file contains some project wide attributes that you do not normally have to modify.

The SimpleSample.cs file contains the core of the Service Components consisting of initialization and termination code, service handlers, and event notification handlers, and the SimpleSampleTypes.cs file contains contract identifier as well as a definition of the service state and which messages are allowed on the main port (see Service Components for details).

Manifest Files

Manifests are XML files that can be read by the Manifest Loader Service indicating a set of services that are to be started. While manifests can be loaded at any time during the life time of a DSS Node they typically are used during start-up of a node to indicate which services to start. Manifests can be indicated on the command line when starting a DSS Node using DSS Host Tool (DssHost.exe), or as part of the static DssEnvironment class. They can also be loaded using the Control Panel service which is one of the System Services, or loaded programmatically by accessing the Manifest Loader Service directly.

Compiling a Service Project

Visual studio projects and solutions can be compiled from within Visual Studio or directly from the Microsoft Robotics Studio Command Prompt using MSBuild which is part of .Net Framework SDK and full versions of Visual Studio. For details on how to use MSBuild from the command line, please refer to the MSBuild documentation within the MSDN library for details.

Assuming you opened the solution above in Visual Studio you can compile it by selecting "Build Solution" (commonly also available by hitting "F6"). This causes three assemblies to be generated:

  1. A service implementation assembly based on the source code included in the service project.
  2. A DSS Proxy assembly exposing the contract of a service so that it programmatically can be used other services. The proxy assembly contains the public operations and state types exposed by the service. When services partner with each other they link with proxy assemblies rather than directly with each other.
  3. A DSS Transform assembly providing a mapping between the typed defines in the service implementation assembly and the proxy assembly. The service transform assembly is loaded automatically by the Microsoft Robotics Studio runtime and is only relevant to the service implementation, not other services using the service proxy.

All three assemblies are copied into the common bin folder which allows them to be loaded and instantiated by the Microsoft Robotics Studio runtime (see Running Services for how to start a service and interact with it from a Web browser).

The name of the service implementation assembly can be controlled using command line options in connection with DSS New Service Generation Tool (DssNewService.exe) or by changing the project settings in Visual Studio. The default assembly name is of the form

<ServiceName>.Yyyyy.Mmm

where yyyy is a four digit year and mm is the two digit month. By convention, the proxy and transform assemblies are named similar to the service implementation but with "proxy" and "transform" appended respectively.

Extending a Service Project

Service projects are not limited to contain the source code files listed above. Typical extensions of a service project include XSLT files for generating HTML from the service state as well as images, audio files, scripts, etc. Such additional files can either be copied directly to the output folder which makes them accessible to other services using the Mount Service or they can be embedded into the service implementation assembly as embedded resources served using the Embedded Resource Service.

Managing Multiple Service Projects

When you create a service project it by default contains a single service within a single Visual Studio project contained within a single Visual Studio solution:

Solution Project Service
SimpleSample.sln SimpleSample.csproj SimpleSample.cs
SimpleSampleTypes.cs
SimpleSample.manifest.xml

However, a project can contain multiple services and a solution can contain multiple projects. This becomes more and more useful as the number of services grow, both for managing cross service dependencies and also to limit the number of service DLLs.

Adding Multiple Projects to a Solution

Service projects can easily be added to the same solution enabling you to explicitly set the dependencies between multiple service projects. First we create a second service project exactly as we did before from a Microsoft Robotics Studio Command Prompt

cd %MRI_INSTANCE_DIR% DssNewService.exe /sTongue TiedimpleSampleTwo 

Similar to before you will find a folder called SimpleSampleTwo containing the new service project. Now, open the SimpleSample.sln solution from the first service project and in the Visual Studio Solution Explorer select "Add Existing Project" and add SimpleSampleTwo to the solution so that it contains both projects:

Solution Project Service
SimpleSample.sln SimpleSample.csproj

AssemblyInfo.cs
SimpleSample.cs
SimpleSampleTypes.cs
SimpleSample.manifest.xml

SimpleSampleTwo.csproj

AssemblyInfo.cs
SimpleSampleTwo.cs
SimpleSampleTwoTypes.cs
SimpleSampleTwo.manifest.xml

Service implementations do not link against each other directly but rather use their associated proxy assemblies as this allows service implementations to evolve and being deployed independently. Because proxy assemblies are not exposed directly in the Solution Explorer, however, you should indicate dependencies between service projects using the Project Dependencies wizard. For example, if SimpleSampleTwo depends on SimpleSample then use the Project Dependencies wizard to set the build order so that SimpleSample is built before SimpleSampleTwo.

Adding Multiple Services to a Project

When compiling the solution above with two service projects the result is two sets of service assemblies, one for the SimpleSample service and one for the SimpleSampleTwo service. However, as the number of services grow, it often makes sense to incorporate multiple services into a single set of assemblies.

Solution Project Service
SimpleSample.sln SimpleSample.csproj

AssemblyInfo.cs
SimpleSample.cs
SimpleSampleTypes.cs
SimpleSample.manifest.xml
SimpleSampleTwo.cs
SimpleSampleTwoTypes.cs
SimpleSampleTwo.manifest.xml

After having compiled the combined project you can verify that the generated service assembly contains both services implementations by using the DSS Contract Information Tool (DssInfo.exe) from the Microsoft Robotics Studio Command Prompt, for example

cd %MRI_INSTANCE_DIR%\bin DssInfo.exe /v:m SimpleSample.Y2007.M06.dll 
HenrikFNielsen at 2007-9-26 > top of Msdn Tech,Microsoft Robotics Studio,Microsoft Robotics - Community...
# 3
Only now I've time to study your text.

Thanks a lot for your reply, it was very clarify.

T.N.T. at 2007-9-26 > top of Msdn Tech,Microsoft Robotics Studio,Microsoft Robotics - Community...

Microsoft Robotics Studio

Site Classified