Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
BOOK: Professional Microsoft Robotics Studio ISBN: 978-0-470-14107-6
This is the forum to discuss the Wrox book Professional Microsoft Robotics Developer Studio by Kyle Johns, Trevor Taylor; ISBN: 9780470141076
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional Microsoft Robotics Studio ISBN: 978-0-470-14107-6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 17th, 2008, 08:20 AM
Authorized User
 
Join Date: Jun 2008
Location: Johannesburg, GA, South Africa.
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default Code Samples

Hi Trevor!

We spoke at MSDN forums, but I thought it would be better to contact you here. I downloaded the code, but it doesn't work with C# 2008 (MSRS April 2008, etc). It won't even extract.

Just by the way - I have bought and received the book - it is lovely. Way better (and cheaper) than the Russian mail order bride option.

While I am here: the code to generate a mesh from a text file... does that require any special additional code than what is in chapter 12? Because then I could just type it out and modify it myself. I thought I'd ask before I try. I'll be trying tonight.

Thanks, I hope you are well!

-Quintin
__________________
-Quintin (The University of Johannesburg)
<i>Currently looking for affordable Russian (or equivalent) mail order bride. Must have masters level or higher in simulated robotics</i>
 
Old June 23rd, 2008, 08:14 PM
Wrox Author
 
Join Date: Apr 2008
Location: Brisbane, QLD, Australia.
Posts: 60
Thanks: 0
Thanked 5 Times in 5 Posts
Default

Hi Quintin,

Sorry it has taken a while to reply. I've been trying to finish my PhD thesis :-(

You are correct. The package for the sample code was built with V1.5 because that is still the only official release.

However, most of the code can be migrated to the April CTP and VS2008. You need to first install into a V1.5 version, then copy the ProMRDS folder across to the April 2008 version of MRDS. You can migrate the whole thing by running DssProjectMigration on the ProMRDS folder.

Once migrated, most of the code works. There are still some outstanding problems with the CF code that I will be looking at soon.

The mesh generator was Kyle's code, but my understanding is that it is a stand-alone program. In any case, if you have V1.5 you can run it there and then just copy the mesh over to V2.0.

I'm glad the book worked out for you better than the mail order bride :-)

Trevor


 
Old June 24th, 2008, 02:14 AM
Authorized User
 
Join Date: Jun 2008
Location: Johannesburg, GA, South Africa.
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks Trevor!

I understand that you must be really busy (I know the feeling). Thanks for taking the time to reply! The wait was not a problem as I am still working on getting other problems fixed. There is very little (anywhere) on building autonomous simulations from scratch (today I hope to figure that one out). Also with your code it is a bit difficult, since you have a generator.

Haha thanks, I may still invest in a mail order bride though... I hope your PhD is going well! All the best!

-Quintin
 
Old June 25th, 2008, 05:24 AM
Wrox Author
 
Join Date: Apr 2008
Location: Brisbane, QLD, Australia.
Posts: 60
Thanks: 0
Thanked 5 Times in 5 Posts
Default

I'm not sure what you mean by "autonomous simulations". Can you elaborate a little?

Are you talking about building a new robot? Kyle covers that in the book. If you are talking about a complete environment, then the Maze Simulator might be what you need.

Trevor



 
Old June 25th, 2008, 05:38 AM
Authorized User
 
Join Date: Jun 2008
Location: Johannesburg, GA, South Africa.
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Trevor,

My goal is to create an autonomous agent (in this case a robot) that interacts with it's environment making use of it's sensors and actuators. I'm interested in learning how to build all of it from the ground up. So far I am making good headway (I think, but I have thought so before), but I will take a look at the maze simulator example.

Thanks!

-Quintin
 
Old June 25th, 2008, 11:06 PM
Wrox Author
 
Join Date: Apr 2008
Location: Brisbane, QLD, Australia.
Posts: 60
Thanks: 0
Thanked 5 Times in 5 Posts
Default

Have a look at the ExplorerSim example as well. It uses the Maze Simulator with a Pioneer 3DX and a Laser Range Finder.

You might also want to read the MSDN article by Sara Morgan about simulation:
http://msdn.microsoft.com/en-us/magazine/cc546547.aspx

And have a look at the RoboChamps web site too:
http://www.robochamps.com

Trevor


 
Old June 28th, 2008, 12:32 AM
Authorized User
 
Join Date: Jun 2008
Location: Johannesburg, GA, South Africa.
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks - will take a look!

I think what is most confusing is the great difference between the simulated and actual differential drive classes. I can understand that their implementation would be different, but I am a bit confused that the usage in the code is so different. After going through the textbooks, it looks so easy to create driveports and send driverequests for real entities (which is exactly what I want to do in simulation), but it seems that for a simulated drive I am going to have to use Simulation Tutorial 2, copy the code, and create my own driveport and driverequest objects.

I thought the whole point of simulation was to make it easy to port to real robots, thus making me think that the reverse was quite the same. I really imagined that the only difference between the simulated and real differential drives (probably including other 'hardware') was an assembly reference.

Haha - I even tried using a physical drive object and changing the manifest file to a simulated differential drive, needless to say I failed, but it was worth a shot :) IF I am right in that regard I think my only failing is getting a "real" drive plugged into a simulated entity - i.e. the CreateService method call.

-Quintin
 
Old June 30th, 2008, 04:43 AM
Wrox Author
 
Join Date: Apr 2008
Location: Brisbane, QLD, Australia.
Posts: 60
Thanks: 0
Thanked 5 Times in 5 Posts
Default

Sure there are differences if you are writing a new simulation entity. However, if you are only using an existing entity then it should look pretty much like a real robot.

There are several points to make here.

If you want to use Simulation Tutorial 2, you can try using the "Save Scene As..." option in the Simulator. It will create two files. One is a manifest that starts the appropriate services and the other is a config file that contains the full list of entities in the simulation. If you run the manifest, you will see that there is a differential drive service started.

However, if you want to modify the Simulation Tutorial 2 environment to add more objects or use a different simulated robot, then you don't want to save it from the Simulator. Instead you need to edit the C# code.

As you have already figured out, in order to access a simulated differential drive from another service you need to call CreateService in the simulation service. Search Simulation Tutorial 2 and you will see what I mean.

You don't have to create the services inside your simulation. It is possible to create them through the manifest by specifying the simulation entity that they correspond to. The approach in Simulation Tutorial 2, and in my Maze Simulator, is to create the services programmatically because it makes the manifests trivial -- just start the simulation and let it do the rest.

If you want to see an example of how to create services in a manifest, then have a look at the following code I put together to use the Maze Simulator in VPL:
http://www.promrds.com/Downloads/SimBot.zip

If you open mazesim.manifest.xml you will see how it creates the services. Unfortunately, VPL removes all of the line terminators so you will have to "unravel" the code first. Of course, this approach results in TWO copies of each service -- one from the Maze Simulator and one from the manifest. I am updating the Maze Simulator so that you can turn off the service creation to make it more compatible with VPL.

So there are two options:
1. Write a simulated environment and create services. Then write another service and just treat the simulated robot like a real robot, i.e. just start the simulation in the manifest with a single service record.

2. Write a simulated environment, but don't create any services. Write another service and in the manifest start the simulation service and also start a simulated service for each of the different devices, drive, laser, bumpers, etc.

I hope this explains it a bit better. Maybe this should be in the book :-)

Trevor



 
Old July 1st, 2008, 05:41 AM
Authorized User
 
Join Date: Jun 2008
Location: Johannesburg, GA, South Africa.
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Trevor,

Thank you so much for your patience with me, I am really struggling to get this thing right.

I am trying your suggested number two at the moment: I have created a project called TerrainLoader, in which I have loaded a LegoNXTTribot, a sky box, camera's etc. But NO other services or entities. The LegoNXTTribot only has a drive, there are no other sensors / actuators. When I run it, it loads everything as expected.

Next I created a project called Actuator, which just uses the "Microsoft.Robotics.Services.Drive.Proxy" to create a port. I then use SpawnIterator to call my DriveRobot method, which sends a driveRequest to the drive. That's all it does, and compiles fine.

Then I modified the manifest of Actuator to look like this http://qjaybee.googlepages.com/manifest.jpg while leaving the TerrainLoader manifest untouched. This is the only way I could get it to even RUN. I am running it from the C# IDE, I do not use the VPL. The result is that the simulation loads nicely, but throws errors: http://qjaybee.googlepages.com/error.jpg

If you have any suggestions, I would really appreciate it! Thanks again!

-Quintin
 
Old July 3rd, 2008, 06:30 PM
Wrox Author
 
Join Date: Apr 2008
Location: Brisbane, QLD, Australia.
Posts: 60
Thanks: 0
Thanked 5 Times in 5 Posts
Default

If you are trying to use option 2, then your manifest does not seem to have a connection between the SimulatedDifferentialDrive and a simulation entity.

Here is a piece of the code from the manifest for the SimBot example that I mentioned in my previous posting. It uses my Simulated Diff Drive and a Pioneer robot, but you should get the idea. You need to replace the P3DXMotorBase with LegoNXTMotorBase. Also, the contract id has to be changed.


  <ServiceRecordType>
    <Contract

xmlns="http://schemas.microsoft.com/xw/2004/10/dssp.html">http://www.promrds.com/contracts/200...ulateddifferen

tialdrivett.html</Contract>
    <AliasList xmlns="http://schemas.microsoft.com/xw/2004/10/dssp.html" />
    <PartnerList xmlns="http://schemas.microsoft.com/xw/2004/10/dssp.html">
      <Partner>
        <Service>http://localhost/P3DXMotorBase</Service>
        <AliasList />
        <PartnerList />
        <Name xmlns:q3="http://schemas.microsoft.com/robotics/2006/04/simulation.html">q3:Entity</Name>
      </Partner>
    </PartnerList>
    <Name xmlns:q4="http://schemas.microsoft.com/robotics/2006/05/drive.html">q4:diffdrive</Name>
  </ServiceRecordType>






Similar Threads
Thread Thread Starter Forum Replies Last Post
C# version of the code samples? Berggreen BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 9 June 21st, 2006 08:32 AM
where can i get the samples code edwinomar ADO.NET 2 April 16th, 2004 12:55 PM
Problems in samples code??????? cuccu BOOK: Professional C#, 2nd and 3rd Editions 2 December 4th, 2003 11:52 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.