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
This command creates and configures a template model of a robot, and explains how to modify it to suit your needs.
3D Model¶
Blender is a 3D modeling application with both Photo-realistic Rendering and Game Engine capabilities. In the first case, users want very detailed models with high definition textures. In other words, heavy models. Those are not well suited to the Game Engine, where we want to get real-time rendering.
As such, it is advisable to prepare a lightweight (“low-poly”) model of your robot, with compressed textures.
The section blender-advices of Adding a new component provides some advice on creating a 3D model in Blender.
Resources¶
Blender has a huge number 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 formats into Blender, for a full list, see the Import-Export Blender wiki page.
For more on Blender Game modeling, see Blender Cookie tutorials.
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”

See Blender wiki on Physics Types for more.
Only one root¶
Your model can be composed of many different objects, but there may be only one root object, all the others being its 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 paths to models accessible by MORSE, each separated by a 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
uses the
“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.