morse.builder package

Submodules

morse.builder.abstractcomponent module

class AbstractComponent(obj=None, filename='', category='')[source]

Bases: builtins.object

add_interface(interface, **kwargs)[source]

Add a service and stream interface to the component

Its argument is the name of the interface to be used.

add_overlay(datastream, overlay, config=None, **kwargs)[source]

Add a service overlay for a specific service manager to the component

Similar to the add_stream function. Its argument is the name of the datastream to be used.

add_service(interface, component=None, config=None)[source]

Add a service interface to the component

Similar to the previous function. Its argument is the name of the interface to be used.

add_stream(datastream, method=None, path=None, classpath=None, direction=None, **kwargs)[source]

Add a data stream interface to the component

Do the binding between a component and the method to export/import its data. This must be used in general by sensors and actuators. A single component can make several calls to this function to add bindings with more than one middleware.

Parameters:
  • datastream – enum in [‘ros’, ‘socket’, ‘yarp’, ‘text’, ‘pocolibs’, ‘moos’]
  • classpath – if set, force to use the configuration of the given component, instead of our own (default=None).

You can pass other argument to this method, they will be added as a map to the configuration.

component.add_stream('ros', topic='/myrobots/data')
component.add_stream('moos', moos_host='127.0.0.1', moos_port=9000,
                        moos_name='iMorse')
alter(modifier_name=None, classpath=None, direction=None, **kwargs)[source]

Add a modifier specified by its first argument to the component

append(obj, child=None, level=1)[source]

Add a child to the current object

Add the object given as an argument as a child of this object. The argument is an instance to another component. This method is generally used to add components to a robot. e.g., : robot.append(sensor), will set the robot parent of the sensor.

If child is not None, the object will be parented to the named child of self instead of the root of self.

append_collada(component=None)[source]

Append Collada objects to the scene

Parameters:component – component in which the objects are located
Returns:list of the imported Blender objects
append_meshes(objects=None, component=None, prefix=None)[source]

Append the component’s Blender objects to the scene

The objects are located either in: MORSE_COMPONENTS/self._category/component.blend/Object/ or in: MORSE_RESOURCE_PATH/component/Object/

If component is not set (neither as argument of append_meshes nor through the AbstractComponent constructor), a Blender Empty is created instead.

Note

By default, all the objects present in the component’s blend file are imported. If you need to exclude some (like lights you may have in your blend file), prefix the name of this objects with _ so that MORSE ignores them.

Parameters:
  • objects – list of the objects names to append
  • component – component in which the objects are located
  • prefix – filter the objects names to append (used by PassiveObject)
Returns:

list of the imported (selected) Blender objects

append_scenes(component=None)[source]
static close_context(level=1)[source]
components = []
frequency(frequency=None)[source]

Set the frequency of the Python module

Parameters:frequency – (int) Desired frequency, 0 < frequency < logic tics
get_child(name, objects=None, recursive=True)[source]

get_child returns the child named :param name:

If several children match the name, a warning is printed and the first one is returned.

Parameters:
  • name – the textual name of the child
  • objects – if specified, look for the child in this list of bpy Objects
  • recursive – (default: True) if true, search for the child recursively
is_exportable()[source]
is_morseable()[source]
level(level)[source]

Set the ‘realism level’ of the component.

Some components define several abstraction level that impact what data are exported.

See each component documentation for the list of available levels.

location[source]
mark_unexportable()[source]
morseable(calling_module=None)[source]

Make this component simulable in MORSE

Parameters:calling_module

Module called each simulation cycle. enum in [‘calling.sensor_action’,

‘calling.actuator_action’, ‘calling.robot_action’]
name[source]
profile()[source]

Watch the average time used during the simulation.

Display the profile of the component on the viewport in percent. As Blender would for framerate and other debug-properties.

properties(**kwargs)[source]

Add/modify the game properties of the Blender object

Usage example:

self.properties(capturing = True, classpath='module.Class', speed = 5.0)

will create and/or set the 3 game properties Component_Tag, classpath, and speed at the value True (boolean), ‘module.Class’ (string), 5.0 (float). In Python the type of numeric value is ‘int’, if you want to force it to float, use the following: float(5) or 5.0 Same if you want to force to integer, use: int(a/b) For the TIMER type, see the class timer(float) defined in this module:

self.properties(my_clock = timer(5.0), my_speed = int(5/2))
property_value(name)[source]
rotate(x=0.0, y=0.0, z=0.0)[source]

Rotate the current object

The rotation is an euler rotation relative to the object’s center. default: x=0, y=0, z=0, unit: radian

rotation_euler[source]
scale[source]
select()[source]
set_blender_object(obj)[source]
set_color(r, g, b)[source]

Set the color of the component.

Will try to apply the RGB color to the active material of all the meshes that are children of this component.

translate(x=0.0, y=0.0, z=0.0)[source]

Translate the current object

The translation will add (x, y, z) to the current object location. default: x=0, y=0, z=0, unit: meter

class Configuration[source]

Bases: builtins.object

datastream = {}
frequency = {}
has_datastream_configuration(component, stream)[source]
has_service_configuration(component, stream)[source]
max_frequency()[source]

Returns the highest update frequency requested in the Builder script for any component (via component.frequency(...)). If no specific frequency has been set, returns MORSE’s default (60Hz)

modifier = {}
overlay = {}
service = {}
set_frequency(component, freq)[source]
stream_manager = {}
update_name(old_name, new_name)[source]
write_config(robot_list)[source]

Write the ‘component_config.py’ file with the supplied settings

class timer[source]

Bases: builtins.float

this class extends float for the game properties configuration

morse.builder.actuators module

class Armature(name=None, armature_name=None, model_name=None)[source]

Bases: morse.builder.creator.ActuatorCreator

after_renaming()[source]
create_ik_targets(bones)[source]
class Arucomarker(name=None)[source]

Bases: morse.builder.creator.ActuatorCreator

class Destination(name=None, action=0, blendfile=None, blendobject=None, make_morseable=True)[source]

Bases: morse.builder.creator.ActuatorCreator

class Drag(name=None)[source]

Bases: morse.builder.creator.ActuatorCreator

class ExternalForce(name=None, action=0, blendfile=None, blendobject=None, make_morseable=True)[source]

Bases: morse.builder.creator.ActuatorCreator

class ForceTorque(name=None, action=0, blendfile=None, blendobject=None, make_morseable=True)[source]

Bases: morse.builder.creator.ActuatorCreator

class Gripper(name=None)[source]

Bases: morse.builder.creator.ActuatorCreator

properties(**kwargs)[source]
class Joystick(name=None, index=0)[source]

Bases: morse.builder.creator.ActuatorCreator

class Keyboard(name=None)[source]

Bases: morse.builder.creator.ActuatorCreator

class KukaLWR(name=None)[source]

Bases: morse.builder.actuators.Armature

This actuator provides a KUKA LWR mesh with the associated kinematic chain.

An IK target is available on the last join, allowing for cartesian control of the arm.

See the general documentation on armatures for details.

class Light(name=None)[source]

Bases: morse.builder.creator.ActuatorCreator

properties(**kwargs)[source]
class MocapControl(name=None, action=0, blendfile=None, blendobject=None, make_morseable=True)[source]

Bases: morse.builder.creator.ActuatorCreator

class MotionVW(name=None, action=0, blendfile=None, blendobject=None, make_morseable=True)[source]

Bases: morse.builder.creator.ActuatorCreator

class MotionVWDiff(name=None, action=0, blendfile=None, blendobject=None, make_morseable=True)[source]

Bases: morse.builder.creator.ActuatorCreator

class MotionXYW(name=None, action=0, blendfile=None, blendobject=None, make_morseable=True)[source]

Bases: morse.builder.creator.ActuatorCreator

class Orientation(name=None, action=0, blendfile=None, blendobject=None, make_morseable=True)[source]

Bases: morse.builder.creator.ActuatorCreator

class PA10(name=None)[source]

Bases: morse.builder.creator.ActuatorCreator

class PTU(name=None)[source]

Bases: morse.builder.creator.ActuatorCreator

class QuadrotorDynamicControl(name=None, action=0, blendfile=None, blendobject=None, make_morseable=True)[source]

Bases: morse.builder.creator.ActuatorCreator

class RotorcraftAttitude(name=None, action=0, blendfile=None, blendobject=None, make_morseable=True)[source]

Bases: morse.builder.creator.ActuatorCreator

class RotorcraftVelocity(name=None, action=0, blendfile=None, blendobject=None, make_morseable=True)[source]

Bases: morse.builder.creator.ActuatorCreator

class RotorcraftWaypoint(name=None, action=0, blendfile=None, blendobject=None, make_morseable=True)[source]

Bases: morse.builder.creator.ActuatorCreator

class Sound(name=None)[source]

Bases: morse.builder.creator.ActuatorCreator

open(filepath)[source]
class StabilizedQuadrotor(name=None, action=0, blendfile=None, blendobject=None, make_morseable=True)[source]

Bases: morse.builder.creator.ActuatorCreator

class SteerForce(name=None, action=0, blendfile=None, blendobject=None, make_morseable=True)[source]

Bases: morse.builder.creator.ActuatorCreator

class Teleport(name=None, action=0, blendfile=None, blendobject=None, make_morseable=True)[source]

Bases: morse.builder.creator.ActuatorCreator

class Waypoint(name=None)[source]

Bases: morse.builder.creator.ActuatorCreator

add_lr_radars()[source]
add_radar(name, collision, fact)[source]
radar_set_collision(obj, sensor, controller_type, collision, value)[source]

morse.builder.blenderobjects module

class Camera(name)[source]

Bases: morse.builder.abstractcomponent.AbstractComponent

class Cone(name)[source]

Bases: morse.builder.blenderobjects.Mesh

mesh_primitive_add(*args, **kwargs)
class Coordsys(name)[source]

Bases: morse.builder.abstractcomponent.AbstractComponent

mesh_primitive_add(*args, **kwargs)
class Cube(name)[source]

Bases: morse.builder.blenderobjects.Mesh

mesh_primitive_add(*args, **kwargs)
class Cylinder(name)[source]

Bases: morse.builder.blenderobjects.Mesh

mesh_primitive_add(*args, **kwargs)
class Empty(name)[source]

Bases: morse.builder.blenderobjects.Mesh

mesh_primitive_add(*args, **kwargs)
class IcoSphere(name)[source]

Bases: morse.builder.blenderobjects.Mesh

mesh_primitive_add(*args, **kwargs)
class Mesh(name)[source]

Bases: morse.builder.abstractcomponent.AbstractComponent

color(r=0.1, g=0.1, b=0.1)[source]
mesh_primitive_add(*args, **kwargs)
class Plane(name)[source]

Bases: morse.builder.blenderobjects.Mesh

mesh_primitive_add(*args, **kwargs)
class Sphere(name)[source]

Bases: morse.builder.blenderobjects.Mesh

mesh_primitive_add(*args, **kwargs)
class Spot(name, lamp_type='SPOT')[source]

Bases: morse.builder.abstractcomponent.AbstractComponent

class Torus(name)[source]

Bases: morse.builder.blenderobjects.Mesh

mesh_primitive_add(*args, **kwargs)

morse.builder.bpymorse module

This module wraps the calls to the Blender Python API. This is intended for all the cases we need to run MORSE code outside Blender (mostly for documentation generation purposes).

add_actuator(*args, **kwargs)
add_camera(*args, **kwargs)
add_controller(*args, **kwargs)
add_empty(*args, **kwargs)
add_lamp(*args, **kwargs)
add_mesh_cone(*args, **kwargs)
add_mesh_cube(*args, **kwargs)
add_mesh_cylinder(*args, **kwargs)
add_mesh_ico_sphere(*args, **kwargs)
add_mesh_monkey(*args, **kwargs)
add_mesh_plane(*args, **kwargs)
add_mesh_torus(*args, **kwargs)
add_mesh_uv_sphere(*args, **kwargs)
add_morse_empty(shape='ARROWS')[source]

Add MORSE Component Empty object which hlods MORSE logic

add_object(*args, **kwargs)
add_sensor(*args, **kwargs)
append(*args, **kwargs)
apply_transform(*args, **kwargs)
armatures(*args, **kwargs)
collada_import(*args, **kwargs)
create_new_material()[source]
del_scene(*args, **kwargs)
delete(objects)[source]
deselect_all()[source]
empty_method(*args, **kwargs)[source]
fullscreen(fullscreen=True, desktop=True)[source]

Run the simulation fullscreen

Parameters:
  • fullscreen (Boolean, default: True) – Start player in a new fullscreen display
  • desktop (Boolean, default: True) – Use the current desktop resolution in fullscreen mode
get_context_object()[source]
get_context_scene()[source]
get_context_window()[source]
get_first_selected_object()[source]
get_fps()[source]
get_lamp(name_or_id)[source]
get_lamps()[source]
get_last_lamp()[source]
get_last_material()[source]
get_last_scene()[source]
get_last_sound()[source]
get_last_text()[source]
get_material(name_or_id)[source]
get_materials()[source]
get_object(name_or_id)[source]
get_objects()[source]
get_objects_in_blend(filepath)[source]
get_properties(obj)[source]
get_scene(name_or_id)[source]
get_scenes()[source]
get_scenes_in_blend(filepath)[source]
get_selected_objects()[source]
get_sound(name_or_id)[source]
get_sounds()[source]
get_text(name_or_id)[source]
get_texts()[source]
new_game_property(*args, **kwargs)
new_material(*args, **kwargs)
new_mesh(*args, **kwargs)
new_object(*args, **kwargs)
new_scene(*args, **kwargs)
new_text(*args, **kwargs)
open_sound(*args, **kwargs)
properties(obj, **kwargs)[source]

Add/modify the game properties of the Blender object

Usage example:

properties(obj, capturing = True, classpath='module.Class', speed = 5.0)

will create and/or set the 3 game properties Component_Tag, classpath, and speed at the value True (boolean), ‘module.Class’ (string), 5.0 (float). In Python the type of numeric value is ‘int’, if you want to force it to float, use the following: float(5) or 5.0 Same if you want to force to integer, use: int(a/b) For the TIMER type, see the class timer(float) defined in this module:

properties(obj, my_clock = timer(5.0), my_speed = int(5/2))
save(filepath=None, check_existing=False, compress=True)[source]

Save .blend file

Parameters:
  • filepath (string, (optional, default: current file)) – File Path
  • check_existing (boolean, (optional, default: False)) – Check and warn on overwriting existing files
  • compress (boolean, (optional, default: True)) – Compress, Write compressed .blend file
select_all(*args, **kwargs)
select_only(obj)[source]
set_active_scene(name_or_id)[source]
set_debug(debug=True)[source]
set_speed(fps=60, logic_step_max=20, physics_step_max=20)[source]

Tune the speed of the simulation

Parameters:
  • fps (default 60) – Nominal number of game frames per second (physics fixed timestep = 1/fps, independently of actual frame rate)
  • logic_step_max (default value : 20) – Maximum number of logic frame per game frame if graphics slows down the game, higher value allows better synchronization with physics
  • physics_step_max (default value : 20) – Maximum number of physics step per game frame if graphics slows down the game, higher value allows physics to keep up with realtime

usage:

bpymorse.set_speed(120, 5, 5)

Note

It is recommended to use the same value for logic_step_max | physics_step_max

Warning

This method must be called at the top of your Builder script, before creating any component.

set_viewport(viewport_shade='WIREFRAME', clip_end=1000)[source]

Set the default view mode

Parameters:viewport_shade – enum in [‘BOUNDBOX’, ‘WIREFRAME’, ‘SOLID’, ‘TEXTURED’], default ‘WIREFRAME’
set_viewport_perspective(perspective='CAMERA')[source]

Set the default view view_perspective

Equivalent to bpy.ops.view3d.viewnumpad with good context.

Parameters:perspective (enum in [‘FRONT’, ‘BACK’, ‘LEFT’, ‘RIGHT’, ‘TOP’, ‘BOTTOM’, ‘CAMERA’], default ‘CAMERA’) – View, Preset viewpoint to use
version()[source]

morse.builder.creator module

class ActuatorCreator(name=None, action=0, blendfile=None, blendobject=None, make_morseable=True)[source]

Bases: morse.builder.creator.ComponentCreator

class ComponentCreator(name, category, action=0, blendfile='', blendobject=None, make_morseable=True)[source]

Bases: morse.builder.abstractcomponent.AbstractComponent

APPEND_EMPTY = 0
USE_BLEND = 1
append_collada(component=None)[source]

Append Collada objects to this component

Overloads morse.builder.abstractcomponent.AbstractComponent.append_collada()

Parameters:component – component in which the objects are located
Returns:list of the imported Blender objects
append_meshes(objects=None, component=None, prefix=None)[source]

Append the objects to this component

Overloads morse.builder.abstractcomponent.AbstractComponent.append_meshes()

Parameters:
  • objects – list of the objects names to append
  • component – component in which the objects are located
Returns:

list of the imported Blender objects

parent_root(objects)[source]
class SensorCreator(name=None, action=0, make_morseable=True)[source]

Bases: morse.builder.creator.ComponentCreator

morse.builder.data module

This module holds MORSE Builder API settings

MORSE_COMPONENTS: Default path to Morse components.

MORSE_RESOURCE_PATH: Path list to Morse components (like the shell PATH variable).

The search path for components. It is a colon-separated list of directories in which MORSE looks for components. A zero-length (null) directory name in the value of PATH indicates the current directory. A null directory name may appear as two adjacent colons, or as an initial or trailing colon. The default path is MORSE_COMPONENTS, wich means this list always contains morse components path. You can export it before to start morse (commonly in ~/.bashrc) as:

export MORSE_RESOURCE_PATH="/home/user/my_own_components:/home/user/my_own_environments"

MORSE_MODIFIERS: Path to the modifiers modules.

MORSE_DATASTREAM_MODULE: Path to the middleware modules.

MORSE_MODIFIER_DICT: Associate a modifier function to a component.

morse.builder.environment module

class Environment(filename, main_scene=None, fastmode=False, component_renaming=True, auto_tune_time=True)[source]

Bases: morse.builder.abstractcomponent.AbstractComponent

Class to configure the general environment of the simulation

It handles the background environment in which your robots are simulated, general properties of the simulation, the default location and orientation of the camera, the Blender Game Engine settings, configure the parameters for the multi-node simulation and also writes the ‘component_config.py’ file.

add_service(datastream)[source]

Override AbstractComponent method

Use it to define which datastream expose the simulator internals services (i.e., the services used to remotely control the simulator behaviour):

env = Environement('indoors-1/indoor-1', fastmode = True)
# Set the simulation management services to be available from ROS:
env.add_service('ros')
aim_camera(rotation)[source]
configure_multinode(protocol='socket', server_address='localhost', server_port='65000', distribution=None)[source]

Provide the information necessary for the node to connect to a multi-node server.

Parameters:
  • protocol – Either ‘socket’ or ‘hla’
  • server_address – IP address where the multi-node server can be found
  • server_port – Used only for ‘socket’ protocol. Currently it should always be 65000
  • distribution – A Python dictionary. The keys are the names of the nodes, and the values are lists with the names of the robots handled by each node
dala1 = ATRV()
dala2 = ATRV()

env = Environment('land-1/trees')
env.configure_multinode(
        protocol='socket',
        server_address='localhost',
        server_port='65000',
        distribution={
            "nodeA": [dala1.name],
            "nodeB": [dala2.name],
        })
configure_service(datastream)[source]
configure_stream_manager(stream_manager, **kwargs)[source]
create(name=None)[source]

Generate the scene configuration and insert necessary objects

Should always be called at the very end of the Builder script. It will finalise the building process and write the configuration files.

enable_mist(value=True)[source]

Enables or disables mist

See World/Mist on the Blender Manual for more information about this particular setting.

Parameters:value – indicate whether to enable/disable mist
fullscreen(fullscreen=True)[source]

Run the simulation fullscreen

Parameters:fullscreen (Boolean, default: True) – Start player in a new fullscreen display
is_internal_camera(camera)[source]
multinode_distribution = {}
place_camera(location)[source]
save(filepath=None, check_existing=False, compress=True)[source]

Save .blend file

Parameters:
  • filepath (string, (optional, default: current file)) – File Path
  • check_existing (boolean, (optional, default: False)) – Check and warn on overwriting existing files
  • compress (boolean, (optional, default: True)) – Compress, Write compressed .blend file
select_display_camera(robot_camera)[source]

Select the camera that will be displayed on the HUD Screen object

Parameters:robot_camera – AbstractComponent reference to the camera desired to be displayed
set_animation_record(record=True)[source]

Record the simulation as a Blender animation (F-Curves)

See the tutorial: Recording Game Physics to Keyframes for more information about this particular setting.

Parameters:record – boolean, default True
set_auto_start(auto_start=True)[source]
set_background_scene(scene)[source]

Set the background scene used by main scene

Parameters:scene – the name of the scene to use in background
set_camera_clip(clip_start=0.1, clip_end=100)[source]

Set the simulator’s Camera near and far clipping distance

Parameters:
  • clip_start – Camera near clipping distance, float in meters (default 0.1)
  • clip_end – Camera far clipping distance, float in meters (default 100)
set_camera_focal_length(focal_length=20.0)[source]

Set the focal length of the default camera

Parameters:focal_length – focal length im mm (default 20.0)
env.set_camera_focal_length(50.0)
set_camera_location(location)[source]

Set the location of the default camera.

Parameters:location – list with the new 3D coordinates for the camera.
env.set_camera_location([10.0, -10.0, 3.0])
set_camera_rotation(rotation)[source]

Set the orientation of the default camera

Parameters:rotation – list with an euler rotation for the camera.
env.set_camera_rotation([1.3300, 0, 0.7854])
set_camera_speed(speed=2.0)[source]

Set the simulator’s Camera speed

Parameters:speed – desired speed of the camera, in meter by second.
set_debug(debug=True)[source]

Set Blender debug mode

Parameters:debug (Boolean, default: True) – set when blender is running in debug mode (started with –debug)
set_gravity(gravity=9.81)[source]

Set the gravity for the specific scene

Parameters:gravity – float, default: 9.81
set_horizon_color(color=(0.05, 0.22, 0.4))[source]

Set the horizon color

See World/Background on the Blender Manual for more information about this particular setting.

Parameters:color – (0.0, 0.0, 0.0) < (R, B, G) < (1.0, 1.0, 1.0) default: dark azure (0.05, 0.22, 0.4)
set_log_level(component, level)[source]

Set the debug level of the component to the level level.

Parameters:
  • component – the class name of the component
  • level – a string representing the level of debug to set

XXX not persistent (if you save the scene and reload it directly from blender, the logger is not set at the right level.

set_material_mode(material_mode='GLSL')[source]

Material mode to use for rendering

  • SINGLETEXTURE Singletexture, Singletexture face materials.
  • MULTITEXTURE Multitexture, Multitexture materials.
  • GLSL GLSL, OpenGL shading language shaders.
Parameters:material_mode – enum in [‘SINGLETEXTURE’, ‘MULTITEXTURE’, ‘GLSL’]
set_mist_settings(**settings)[source]

Sets the mist settings for the scene

See World/Mist on the Blender Manual for more information about this particular setting.

Optional arguments need to be specified with identifyer: :param enable: Enables or disables mist :param intensity: Overall minimum intensity of the mist effect in [0,1] :param start: Starting distance of the mist, measured from the camera :param depth: Distance over which the mist effect fades in :param falloff: Type of transition used to fade mist enum in [‘QUADRATIC’, ‘LINEAR’, ‘INVERSE_QUADRATIC’], default ‘QUADRATIC’

set_physics_step_sub(step_sub)[source]

Configure the number of physics sub step per physics step.

Basically, if you increase the step_sub value, your simulation will spent more time in computing physics, but it will be more precise. The default value is 2.

See also http://www.blender.org/documentation/blender_python_api_2_63_0/bpy.types.SceneGameData.html#bpy.types.SceneGameData.physics_step_sub

set_stereo(mode='ANAGLYPH', eye_separation=0.1, stereo='STEREO')[source]

Configure to render image in stereo mode

(anaglyphs allows to see in 3d with special red-cyan glasses)

Parameters:
  • mode – Stereographic techniques. enum in [‘QUADBUFFERED’, ‘ABOVEBELOW’, ‘INTERLACED’, ‘ANAGLYPH’, ‘SIDEBYSIDE’, ‘VINTERLACE’], default ‘ANAGLYPH’
  • eye_separation – Distance between the eyes. float in [0.01, 5], default 0.1
  • stereo – enum in [‘NONE’, ‘STEREO’, ‘DOME’], default ‘STEREO’
set_time_scale(slowdown_by=None, accelerate_by=None)[source]

Slow down or accelerate the simulation relative to real-time (default behaviour: real-time simulation) by modifying the time scale of the simulation.

Parameters:slowndown_by – factor by which the simulation should be

slowed down, relative to real-time :param accelerate_by: factor by which the simulation should be accelerated, relative to real-time You must pass only one of these options

set_time_strategy(strategy)[source]

Choose the time strategy for the current simulation

Parameters:strategy – the strategy to choose. Must be one of value

of morse.builder.TimeStrategies

set_viewport(viewport_shade='WIREFRAME', clip_end=1000)[source]

Set the default view mode

Parameters:viewport_shade – enum in [‘BOUNDBOX’, ‘WIREFRAME’, ‘SOLID’, ‘TEXTURED’], default ‘WIREFRAME’
show_debug_properties(value=True)[source]

Display the value of the game-properties marked as debug

Parameters:value – indicate whether to show or not this information
show_framerate(value=True)[source]

Display framerate and profile information of the simulation

Parameters:value – indicate whether to show or not this information
show_physics(value=True)[source]

Display of the bounding boxes of objects during the simulation

Parameters:value – indicate whether to show or not this information
simulator_frequency(base_frequency=60, logic_step_max=20, physics_step_max=20)[source]

Tune the frequency of the simulation

Parameters:
  • base_frequency (default 60) – Nominal number of game frames per second (physics fixed timestep = 1/ (base_frequency * time_scale), independently of actual frame rate)
  • logic_step_max (default value : 20) – Maximum number of logic frame per game frame if graphics slows down the game, higher value allows better synchronization with physics
  • physics_step_max (default value : 20) – Maximum number of physics step per game frame if graphics slows down the game, higher value allows physics to keep up with realtime

usage:

env.simulator_frequency(120, 5, 5)

Note

It is recommended to use the same value for logic_step_max and physics_step_max

use_internal_syncer()[source]
use_relative_time(relative_time)[source]

Configure if Morse should exports relative time (time since Morse start) or “absolute” start (time since Epoch)

use_vsync(vsync)[source]

Configure vsync parameter for the current scene

Parameters:vsync – should be one [‘ON’, ‘OFF’, ‘ADAPTIVE’]

morse.builder.morsebuilder module

class Component(category='', filename='', make_morseable=True)[source]

Bases: morse.builder.abstractcomponent.AbstractComponent

Append a morse-component to the scene

cf. bpy.ops.wm.link_append and bpy.data.libraries.load

class GroundRobot(filename, name)[source]

Bases: morse.builder.morsebuilder.Robot

class PassiveObject(filename='props/objects', prefix=None, keep_pose=False)[source]

Bases: morse.builder.abstractcomponent.AbstractComponent

Allows to import any Blender object to the scene.

setgraspable()[source]

Makes an object graspable to the human avatar by adding a NEAR collision sensor to the object.

This function also set the object to be an active game object (property ‘Object’ set to true), and set the object label to the Blender object name (if not already set).

class Robot(filename='', name=None)[source]

Bases: morse.builder.morsebuilder.Component

add_default_interface(stream)[source]

Add a service and stream interface to all components of the robot

Note

If add_stream or add_service is used explicitly for some components and the specified interface is the same it will be added twice.

make_external()[source]
make_ghost(alpha=0.3)[source]

Make this robot a ghost

The robot is made transparent, with no collision.

Note

A ghost robot has no influence on other simulated robots (no collision, invisible to laser sensors) except for video sensors.

Parameters:alpha – Transparency alpha coefficient (0 for invisible, 1 for opaque, default is 0.3)
make_grasper(obj_name)[source]
set_collision_bounds()[source]
set_dynamic()[source]
set_friction(friction=0.0)[source]

Set Coulomb friction coefficient

Parameters:friction (float) – [0, 100], default 0.0
set_mass(mass)[source]

Set component’s mass

Parameters:mass (float) – The component’s mass

Note

The object must have a physics controller for the mass to be applied, otherwise the mass value will be returned as 0.0.

set_no_collision()[source]

Configure this robot to not use physics at all

set_physics_type(physics_type='STATIC')[source]

Configure this robot physics type

set_rigid_body()[source]

Configure this robot to use rigid_body physics

set_use_record_animation(use_record_animation=True)[source]

Record animation objects without physics

class WheeledRobot(filename, name)[source]

Bases: morse.builder.morsebuilder.GroundRobot

after_renaming()[source]
unparent_wheels()[source]

Make the wheels orphans, but keep the transformation applied to the parent robot

class Zone(type)[source]

Bases: morse.builder.blenderobjects.Cube

rotate(x=0.0, y=0.0, z=0.0)[source]
size[source]
morse_excepthook(*args, **kwargs)[source]

morse.builder.sensors module

class Accelerometer(name=None)[source]

Bases: morse.builder.creator.SensorCreator

class Airspeed(name=None, action=0, make_morseable=True)[source]

Bases: morse.builder.creator.SensorCreator

class ArmaturePose(name=None, action=0, make_morseable=True)[source]

Bases: morse.builder.creator.SensorCreator

class Attitude(name=None, action=0, make_morseable=True)[source]

Bases: morse.builder.creator.SensorCreator

class Barometer(name=None, action=0, make_morseable=True)[source]

Bases: morse.builder.creator.SensorCreator

class Battery(name=None)[source]

Bases: morse.builder.creator.SensorCreator

class Clock(name=None, action=0, make_morseable=True)[source]

Bases: morse.builder.creator.SensorCreator

class Collision(name=None)[source]

Bases: morse.builder.creator.SensorCreator

properties(**kwargs)[source]
class CompoundSensor(sensors, name=None)[source]

Bases: morse.builder.creator.SensorCreator

after_renaming()[source]
class DepthCamera(name=None)[source]

Bases: morse.builder.sensors.VideoCamera

class GPS(name=None)[source]

Bases: morse.builder.creator.SensorCreator

class Gyroscope(name=None)[source]

Bases: morse.builder.creator.SensorCreator

class Hokuyo(name=None)[source]

Bases: morse.builder.sensors.LaserSensorWithArc

A laser scanner configured to mimick the Hokuyo sensor.

See the laser scanners general documentation for details.

class IMU(name=None)[source]

Bases: morse.builder.creator.SensorCreator

class Infrared(name=None)[source]

Bases: morse.builder.sensors.LaserSensorWithArc

A laser scanner configured to mimick a infra-red proximity sensor.

See the laser scanners general documentation for details.

class Kinect(name='Kinect')[source]

Bases: morse.builder.sensors.CompoundSensor

Microsoft Kinect RGB-D camera, implemented as a pair of depth camera and video camera.

See the general documentation for video cameras and depth cameras for details.

add_stream(*args, **kwargs)[source]
frequency(frequency)[source]
profile()[source]
class LaserSensorWithArc(name=None, action=0, make_morseable=True)[source]

Bases: morse.builder.creator.SensorCreator

after_renaming()[source]
create_laser_arc()[source]

Create an arc for use with the laserscanner sensor

The arc is created using the parameters in the laserscanner Empty. ‘resolution and ‘scan_window’ are used to determine how many points will be added to the arc.

get_ray_material()[source]
class Magnetometer(name=None, action=0, make_morseable=True)[source]

Bases: morse.builder.creator.SensorCreator

class Odometry(name=None)[source]

Bases: morse.builder.creator.SensorCreator

class PTUPosture(name=None, action=0, make_morseable=True)[source]

Bases: morse.builder.creator.SensorCreator

class Pose(name=None)[source]

Bases: morse.builder.creator.SensorCreator

class Proximity(name=None)[source]

Bases: morse.builder.creator.SensorCreator

class RadarAltimeter(name=None, action=0, make_morseable=True)[source]

Bases: morse.builder.creator.SensorCreator

class SearchAndRescue(name=None)[source]

Bases: morse.builder.creator.SensorCreator

properties(**kwargs)[source]
class SemanticCamera(name=None)[source]

Bases: morse.builder.sensors.VideoCamera

class Sick(name=None)[source]

Bases: morse.builder.sensors.LaserSensorWithArc

A laser scanner configured to mimick the SICK sensor.

See the laser scanners general documentation for details.

class SickLDMRS(name=None)[source]

Bases: morse.builder.sensors.LaserSensorWithArc

A laser scanner configured to mimick the SICK LD-MRS sensor.

See the laser scanners general documentation for details.

class StereoUnit(name=None)[source]

Bases: morse.builder.creator.SensorCreator

class Thermometer(name=None)[source]

Bases: morse.builder.creator.SensorCreator

class Velocity(name=None)[source]

Bases: morse.builder.creator.SensorCreator

class Velodyne(name=None)[source]

Bases: morse.builder.sensors.DepthCamera

class VelodyneRayCast(name=None)[source]

Bases: morse.builder.sensors.LaserSensorWithArc

VelodyneZB

alias of Velodyne

class VideoCamera(name=None)[source]

Bases: morse.builder.creator.SensorCreator

hide_mesh(hide=True)[source]

Hide the camera mesh

Can be used to hide a third person camera attached to a robot.

rotate(x=0, y=0, z=0)[source]

Module contents