Wednesday, June 18, 2008

Creating a custom simulation is MRDS

Today I finally cracked the nut open! I think this may be my first blog of use to someone else. Today I am covering the means by which a programmer can load a custom environment using the simulator and connect it to a program designed in the VPL. I'm doing it really simply so there shouldn't be any tricks.

One thing I noticed is that you can't just define a scene and load it in the VPL. What you need to do is define a scene with all the components that you will be using in the Simulation Editor (right down to the differential drive 'entities') and then load the manifest for the Simulation Environment 'on top' of those components. So it will feel like you are loading the environment several times, when in reality you are just connecting a piece of your robot to that simulation. That's why you tell it to use existing if it has been loaded beforehand.

  1. Start up the "Basic Simulation environment" change the mode to edit and add / remove the entities you wish. They are quite straight forward. I decided to keep the basic entities like the skybox and the floor. I added a the Lego NXT bot, which looks like a box. You can probably load a ton of meshes and get it looking nice, but that is not the point of today. I also added a table, just to see that I could.
  2. Now select the NXTTribot in the editor and expand the "Misc" category. Under the "ServiceContract" field type (or select) "http://schemas.microsoft.com/robotics/simulation/services/2006/05/simulateddifferentialdrive.html"
  3. (Optional) To get the Tribot looking good, select the Tribot and click "Edit Entity".
    Then click the elipses "..." in the "EntityState" property. In the "EntityState" window, click the elipses under the mesh property and select the LegoNXTTribot.bos file. You can make your robot look like anything you like with this.
  4. Save your manifest file. Give it a unique name and preferrably include the date. I saved it under "Samples\Config" since many of them are there.
  5. Now design your VPL language. Obviously I just used one that has a GenericDifferentialDrive. Then you can load the manifest by changing the configuration of the drive to "Use a manifest" and then import your custom manifest.[1]
  6. Run the program. Mine worked well!

[1] This is not possible if you did not load the right ServiceContract The robots are just meshes until you plug that guy in. So the best way to do it is to load a pre-existing SE and then see what contracts are used.

I hope this helps!

UPDATE:
  1. If you struggle with the entity (like getting wheels), then check out THIS POST
  2. Please also be aware that I wouldn't actually recommend you create robotic entities from scratch unless they are really simple. When creating a Pioneer 3DX robot with a LRF, I found that the existence of the LRF made a collision point, making the robot fly off in a random direction. Rather, just edit existing scenes with the robot that you want to use
  3. Comments are welcome on this blog, but please keep in mind you get what you pay for here, I'm trying to help. If you have a question, I'm all ears and I'll do my best. I will not tolerate insults on this blog, that's what my other blog is for.

0 incoming messages (comments):