MSDN Magazine - June 2008 - (Page 70) that, in theory, it does not matter whether your robot is virtual or physical—the code used to power the robot and receive data from the sensors will be the same. Some of the code that is used in the simulation project can be reused when working with the actual robot. Now, you may have noticed that I said “in theory.” This is because the simulation cannot completely simulate a real-world environment. The simulation cannot account for noise—the stuff you do not expect, such as obstacles being in the wrong location. What the simulation can do is give you a fairly realistic opporFigure 8 Create BoeBot Entity Type [DataContract] public class BoeBot : DifferentialDriveEntity { Port _notifications = new Port (); // Default constructor, used for creating the entity from XML public BoeBot() { } // Custom constructor for building model from hardcoded values. // Used to create entity programmatically public BoeBot(Vector3 initialPos) { MASS = 0.454f; //in kilograms (around 1 pound) // the default settings approximate the BoeBot chassis CHASSIS_DIMENSIONS = new Vector3(0.09f, //meters wide 0.09f, //meters high 0.13f); //meters long FRONT_WHEEL_MASS = 0.01f; CHASSIS_CLEARANCE = 0.015f; FRONT_WHEEL_RADIUS = 0.025f; CASTER_WHEEL_RADIUS = 0.0125f; FRONT_WHEEL_WIDTH = 0.01f; CASTER_WHEEL_WIDTH = 0.008f; FRONT_AXLE_DEPTH_OFFSET = 0.01f; // distance from center of robot base.State.Name = "BoeBot"; base.State.MassDensity.Mass = MASS; base.State.Pose.Position = initialPos; // chassis position BoxShapeProperties motorBaseDesc = new BoxShapeProperties("BoeBot Body", MASS, new Pose(new Vector3( 0, // Use 0 for X axis offset CHASSIS_CLEARANCE + CHASSIS_DIMENSIONS.Y / 2, 0.03f)), // minor offset in the z/depth axis CHASSIS_DIMENSIONS); motorBaseDesc.Material = new MaterialProperties("high friction", 0.0f, 1.0f, 20.0f); motorBaseDesc.Name = "Chassis"; ChassisShape = new BoxShape(motorBaseDesc); // rear wheel is also called the castor CASTER_WHEEL_POSITION = new Vector3(0, // center of chassis CASTER_WHEEL_RADIUS, // distance from ground CHASSIS_DIMENSIONS.Z / 2); // at the rear of the robot RIGHT_FRONT_WHEEL_POSITION = new Vector3( +CHASSIS_DIMENSIONS.X / 2,// left of center FRONT_WHEEL_RADIUS, // distance from ground of axle FRONT_AXLE_DEPTH_OFFSET); // distance from center, on z-axis LEFT_FRONT_WHEEL_POSITION = new Vector3( -CHASSIS_DIMENSIONS.X / 2,// right of center FRONT_WHEEL_RADIUS, // distance from ground of axle FRONT_AXLE_DEPTH_OFFSET); // distance from center, on z-axis MotorTorqueScaling = 30; // specify a default mesh State.Assets.Mesh = "boe-bot.bos"; tunity to experiment with a new robot design or simulate the interaction of multiple robots. This can be very useful in academic environments where resources are limited and the number of students is high. Each entity can be associated with a mesh, which is what makes the entity appear realistic. For example, in the case of the globe, the mesh is what makes the globe entity appear like the planet Earth. Strictly speaking, it is not necessary to associate an entity with a mesh, but in the case of complex entities, such as robots, a mesh object is preferable. Just about any 3D graphical editing tool can be used to create the mesh. For this article, I was fortunate enough to have a colleague, Steve Grand, create a Boe-Bot mesh for me using a 3D package called SoftImage (see softimage.com for more information about this tool). The files associated with this mesh are included with the downloadable .zip file that accompanies this article. To follow along with the article, download the .zip file, extract the files, and copy the contents of the Boe-Bot folder to the /store/media directory associated with your local MSRS installation. SoftImage is capable of exporting the image to the .obj format. Not all packages are capable of doing this. For example, SolidWorks (see solidworks.com) is a 3D package recommended by MSRS on its Channel9 Wiki (go.microsoft.com/fwlink/?LinkId=114031). Unfortunately, SolidWorks is not capable of exporting to the .obj format, so it recommends a tool named Blender (blender.org) to do the actual conversion. Keep this in mind when selecting a graphics package to create your mesh file. The details involved with creating the Boe-Bot mesh are beyond the scope of this article, but you should know that it was created by joining multiple polygon mesh shapes. For example, the metal chassis began as a cube shape that was modified to represent the size and shape of the Boe-Bot. Additional cylinder shapes were then added to represent the wheels. A hierarchy was established to bind the wheels to the chassis and allow the entire object to function as a single shape. The result (as seen in Figure 9) is an image that represents the physical Boe-Bot. Creating a Mesh Convert the Mesh to Binary Format } MSRS offers a command-line tool that is capable of converting an .obj file to an optimized binary file with a .bos file extension. The benefit of this type of file is that it loads more quickly than the .obj file. The command-line tool, called Obj2bos.exe, can be accessed using the command prompt menu item included with the MSRS installation. When working with a mesh it is important to remember that materials are used to color physical objects and each entity can be associated with one or more materials. Therefore, when you create your .obj file, it will likely include additional material files with a .mtl extensions. It may also include image files used to create textures. These files must be copied to the same location as the .obj file before using the mesh conversion tool. The .obj file and all associated files should be placed in the /store/ Robotics Studio 70 msdn magazine http://softimage.com http://solidworks.com http://go.microsoft.com/fwlink/?LinkId=114031 http://blender.org
Table of Contents Feed for the Digital Edition of MSDN Magazine - June 2008 MSDN Magazine - June 2008 Contents Toolbox CLR Inside Out Cutting Edge Patterns In Practice SAAS Concurrency Robotics Form Filler GUI Library Service Station Foundations Windows With C++ Concurrent Affairs Going Places { End Bracket } MSDN Magazine - June 2008 MSDN Magazine - June 2008 - Contents (Page Cover1) MSDN Magazine - June 2008 - Contents (Page Cover2) MSDN Magazine - June 2008 - Contents (Page 1) MSDN Magazine - June 2008 - Contents (Page 2) MSDN Magazine - June 2008 - Contents (Page 3) MSDN Magazine - June 2008 - Contents (Page 4) MSDN Magazine - June 2008 - Contents (Page 5) MSDN Magazine - June 2008 - Contents (Page 6) MSDN Magazine - June 2008 - Contents (Page 7) MSDN Magazine - June 2008 - Contents (Page 8) MSDN Magazine - June 2008 - Contents (Page 9) MSDN Magazine - June 2008 - Contents (Page 10) MSDN Magazine - June 2008 - Toolbox (Page 11) MSDN Magazine - June 2008 - Toolbox (Page 12) MSDN Magazine - June 2008 - Toolbox (Page 13) MSDN Magazine - June 2008 - Toolbox (Page 14) MSDN Magazine - June 2008 - CLR Inside Out (Page 15) MSDN Magazine - June 2008 - CLR Inside Out (Page 16) MSDN Magazine - June 2008 - CLR Inside Out (Page 17) MSDN Magazine - June 2008 - CLR Inside Out (Page 18) MSDN Magazine - June 2008 - CLR Inside Out (Page 19) MSDN Magazine - June 2008 - CLR Inside Out (Page 20) MSDN Magazine - June 2008 - CLR Inside Out (Page 21) MSDN Magazine - June 2008 - CLR Inside Out (Page 22) MSDN Magazine - June 2008 - CLR Inside Out (Page 23) MSDN Magazine - June 2008 - CLR Inside Out (Page 24) MSDN Magazine - June 2008 - Cutting Edge (Page 25) MSDN Magazine - June 2008 - Cutting Edge (Page 26) MSDN Magazine - June 2008 - Cutting Edge (Page 27) MSDN Magazine - June 2008 - Cutting Edge (Page 28) MSDN Magazine - June 2008 - Cutting Edge (Page 29) MSDN Magazine - June 2008 - Cutting Edge (Page 30) MSDN Magazine - June 2008 - Cutting Edge (Page 31) MSDN Magazine - June 2008 - Cutting Edge (Page 32) MSDN Magazine - June 2008 - Cutting Edge (Page 33) MSDN Magazine - June 2008 - Cutting Edge (Page 34) MSDN Magazine - June 2008 - Cutting Edge (Page 35) MSDN Magazine - June 2008 - Cutting Edge (Page 36) MSDN Magazine - June 2008 - Patterns In Practice (Page 37) MSDN Magazine - June 2008 - Patterns In Practice (Page 38) MSDN Magazine - June 2008 - Patterns In Practice (Page 39) MSDN Magazine - June 2008 - Patterns In Practice (Page 40) MSDN Magazine - June 2008 - Patterns In Practice (Page 41) MSDN Magazine - June 2008 - Patterns In Practice (Page 42) MSDN Magazine - June 2008 - Patterns In Practice (Page 43) MSDN Magazine - June 2008 - SAAS (Page 44) MSDN Magazine - June 2008 - SAAS (Page 45) MSDN Magazine - June 2008 - SAAS (Page 46) MSDN Magazine - June 2008 - SAAS (Page 47) MSDN Magazine - June 2008 - SAAS (Page 48) MSDN Magazine - June 2008 - SAAS (Page 49) MSDN Magazine - June 2008 - SAAS (Page 50) MSDN Magazine - June 2008 - SAAS (Page 51) MSDN Magazine - June 2008 - SAAS (Page 52) MSDN Magazine - June 2008 - SAAS (Page 53) MSDN Magazine - June 2008 - Concurrency (Page 54) MSDN Magazine - June 2008 - Concurrency (Page 55) MSDN Magazine - June 2008 - Concurrency (Page 56) MSDN Magazine - June 2008 - Concurrency (Page 57) MSDN Magazine - June 2008 - Concurrency (Page 58) MSDN Magazine - June 2008 - Concurrency (Page 59) MSDN Magazine - June 2008 - Concurrency (Page 60) MSDN Magazine - June 2008 - Concurrency (Page 61) MSDN Magazine - June 2008 - Concurrency (Page 62) MSDN Magazine - June 2008 - Concurrency (Page 63) MSDN Magazine - June 2008 - Robotics (Page 64) MSDN Magazine - June 2008 - Robotics (Page 65) MSDN Magazine - June 2008 - Robotics (Page 66) MSDN Magazine - June 2008 - Robotics (Page 67) MSDN Magazine - June 2008 - Robotics (Page 68) MSDN Magazine - June 2008 - Robotics (Page 69) MSDN Magazine - June 2008 - Robotics (Page 70) MSDN Magazine - June 2008 - Robotics (Page 71) MSDN Magazine - June 2008 - Robotics (Page 72) MSDN Magazine - June 2008 - Robotics (Page 73) MSDN Magazine - June 2008 - Robotics (Page 74) MSDN Magazine - June 2008 - Robotics (Page 75) MSDN Magazine - June 2008 - Robotics (Page 76) MSDN Magazine - June 2008 - Robotics (Page 77) MSDN Magazine - June 2008 - Robotics (Page 78) MSDN Magazine - June 2008 - Form Filler (Page 79) MSDN Magazine - June 2008 - Form Filler (Page 80) MSDN Magazine - June 2008 - Form Filler (Page 81) MSDN Magazine - June 2008 - Form Filler (Page 82) MSDN Magazine - June 2008 - Form Filler (Page 83) MSDN Magazine - June 2008 - Form Filler (Page 84) MSDN Magazine - June 2008 - Form Filler (Page 85) MSDN Magazine - June 2008 - GUI Library (Page 86) MSDN Magazine - June 2008 - GUI Library (Page 87) MSDN Magazine - June 2008 - GUI Library (Page 88) MSDN Magazine - June 2008 - GUI Library (Page 89) MSDN Magazine - June 2008 - GUI Library (Page 90) MSDN Magazine - June 2008 - GUI Library (Page 91) MSDN Magazine - June 2008 - GUI Library (Page 92) MSDN Magazine - June 2008 - GUI Library (Page 93) MSDN Magazine - June 2008 - GUI Library (Page 94) MSDN Magazine - June 2008 - GUI Library (Page 95) MSDN Magazine - June 2008 - GUI Library (Page 96) MSDN Magazine - June 2008 - Service Station (Page 97) MSDN Magazine - June 2008 - Service Station (Page 98) MSDN Magazine - June 2008 - Service Station (Page 99) MSDN Magazine - June 2008 - Service Station (Page 100) MSDN Magazine - June 2008 - Service Station (Page 101) MSDN Magazine - June 2008 - Service Station (Page 102) MSDN Magazine - June 2008 - Service Station (Page 103) MSDN Magazine - June 2008 - Service Station (Page 104) MSDN Magazine - June 2008 - Foundations (Page 105) MSDN Magazine - June 2008 - Foundations (Page 106) MSDN Magazine - June 2008 - Foundations (Page 107) MSDN Magazine - June 2008 - Foundations (Page 108) MSDN Magazine - June 2008 - Foundations (Page 109) MSDN Magazine - June 2008 - Foundations (Page 110) MSDN Magazine - June 2008 - Foundations (Page 111) MSDN Magazine - June 2008 - Foundations (Page 112) MSDN Magazine - June 2008 - Windows With C++ (Page 113) MSDN Magazine - June 2008 - Windows With C++ (Page 114) MSDN Magazine - June 2008 - Windows With C++ (Page 115) MSDN Magazine - June 2008 - Windows With C++ (Page 116) MSDN Magazine - June 2008 - Windows With C++ (Page 117) MSDN Magazine - June 2008 - Windows With C++ (Page 118) MSDN Magazine - June 2008 - Concurrent Affairs (Page 119) MSDN Magazine - June 2008 - Concurrent Affairs (Page 120) MSDN Magazine - June 2008 - Concurrent Affairs (Page 121) MSDN Magazine - June 2008 - Concurrent Affairs (Page 122) MSDN Magazine - June 2008 - Concurrent Affairs (Page 123) MSDN Magazine - June 2008 - Concurrent Affairs (Page 124) MSDN Magazine - June 2008 - Concurrent Affairs (Page 125) MSDN Magazine - June 2008 - Concurrent Affairs (Page 126) MSDN Magazine - June 2008 - Going Places (Page 127) MSDN Magazine - June 2008 - Going Places (Page 128) MSDN Magazine - June 2008 - Going Places (Page 129) MSDN Magazine - June 2008 - Going Places (Page 130) MSDN Magazine - June 2008 - Going Places (Page 131) MSDN Magazine - June 2008 - { End Bracket } (Page 132) MSDN Magazine - June 2008 - { End Bracket } (Page Cover3) MSDN Magazine - June 2008 - { End Bracket } (Page Cover4)
For optimal viewing of this digital publication, please enable JavaScript and then refresh the page. If you would like to try to load the digital publication without using Flash Player detection, please click here.