Adding a new robot

Let say you have a 3D model of a robot and you want to use it in MORSE, this page is what you are looking for. For more on 3D modeling, see Resources.

Since version 1.1, MORSE offers a convenient command-line tool to create and setup a new robot.

Assuming you already have an initial simulation environment called mysim, you can create a new robot with:

$ morse add robot <name> mysim

Low-poly

Blender is a 3D modeling software with both Photo-realistic Rendering and Game Engine capabilities. In the first case, users want very detailed models with high definition textures. In one word, heavy models. Those are not suited for the Game Engine, where we want to get real-time rendering.

MORSE’ 3D models need to be light, with compressed textures, and as few polygons as possible.

Physics

Game Physics: see Physics page.

  • Type = “Rigid body
  • Mass Affects the reaction due to collision between objects, more massive objects have more inertia. Will also affect material force fields. Will also change behaviors if you are using the suspension and steering portions of Bullet physics.
  • Collision Bounds: “Convex Hull
../_images/robot_game_physics_collision.png

See Blender wiki on Physics Types for more.

Only one root

Your model can be composed by different objects, but must have only one root object, the others being his children.

Builder part

Let say your 3D model is in “/home/bob/models/wallE.blend”.

The best practice is to set a MORSE_RESOURCE_PATH environment variable. Containing a list of path to models accessible by MORSE, separated by colon (:):

export MORSE_RESOURCE_PATH="/home/bob/models:/home/bob/models2012"

Your class must extend morse.builder.morsebuilder.Robot (or morse.builder.morsebuilder.GroundRobot) as:

from morse.builder import *

class WallE(Robot):
    def __init__(self, name = None):
        Robot.__init__(self, "wallE.blend", name)

Advanced

Core part

By default, morse.builder.morsebuilder.Robot use “morse.core.robot.Robot” classpath.

If you want a specific behaviour, you need to create a class like the ones in morse.robots. This new class must implement morse.core.robot.Robot in particular the morse.core.object.Object.default_action() method.

And back in your builder script, set the classpath with:

from morse.builder import *

class WallE(Robot):
    def __init__(self, name = None):
        Robot.__init__(self, "wallE.blend", name)
        self.properties(classpath="module.in.pythonpath.WallE")

Where module.in.pythonpath.WallE is a class extending morse.core.robot.Robot.

Wheeled robot

See morse.builder.robots.morserobots.SegwayRMP400 for builder and morse.robots.segwayrmp400.SegwayRMP400PhysicsClass for core examples.

Physics for wheels: Convex Hull, see Blender wiki on Collision Bounds.

Resources

Blender got huge amount of models, you can find some on Blendswap. Make sure you look in the “low-poly” category for Game Engine models.

You can also import many 3D format in Blender, for a full list, see the Import-Export Blender wiki page.

For more on Blender Game modeling, see Blender Cookie tutorials.