Bases: builtins.object
Add a service and stream interface to the component
Its argument is the name of the interface to be used.
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 a service interface to the component
Similar to the previous function. Its argument is the name of the interface to be used.
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: |
|
---|
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')
Add a modifier specified by its first argument to the component
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.
Append Collada objects to the scene
Parameters: | component – component in which the objects are located |
---|---|
Returns: | list of the imported Blender objects |
Append the objects to the scene
The objects are located either in: MORSE_COMPONENTS/self._category/component.blend/Object/ or in: MORSE_RESOURCE_PATH/component/Object/
Parameters: |
|
---|---|
Returns: | list of the imported (selected) Blender objects |
Set the frequency delay for the call of the Python module
Parameters: |
|
---|
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.
Make this component simulable in MORSE
Parameters: | calling_module – Module called each simulation cycle. enum in [‘calling.sensor_action’,
|
---|
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.
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))
Bases: morse.builder.blenderobjects.Mesh
Bases: morse.builder.blenderobjects.Mesh
Bases: morse.builder.blenderobjects.Mesh
Bases: morse.builder.blenderobjects.Mesh
Bases: morse.builder.abstractcomponent.AbstractComponent
Bases: morse.builder.blenderobjects.Mesh
Bases: morse.builder.blenderobjects.Mesh
Bases: morse.builder.blenderobjects.Mesh
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).
Save .blend file
Parameters: |
|
---|
Tune the speed of the simulation
Parameters: |
|
---|
usage:
bpymorse.set_speed(120, 5, 5)
Warning
This method must be called at the top of your Builder script, before creating any component.
Bases: morse.builder.abstractcomponent.AbstractComponent
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 the objects to this component
Overloads morse.builder.abstractcomponent.AbstractComponent.append_meshes()
Parameters: |
|
---|---|
Returns: | list of the imported Blender objects |
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.
Bases: morse.builder.morsebuilder.Component
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.
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.configure_service('ros')
Set the orientation of the default camera
Parameters: | rotation – list with an euler rotation for the camera. |
---|
env.aim_camera([1.3300, 0, 0.7854])
Provide the information necessary for the node to connect to a multi-node server.
Parameters: |
|
---|
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],
})
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.
Set the location of the default camera.
Parameters: | location – list with the new 3D coordinates for the camera. |
---|
env.place_camera([10.0, -10.0, 3.0])
Save .blend file
Parameters: |
|
---|
Select the camera that will be displayed on the HUD Screen object
Parameters: | robot_camera – AbstractComponent reference to the camera desired to be displayed |
---|
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 the simulator’s Camera near and far clipping distance
Parameters: |
|
---|
Set the gravity for the specific scene
Parameters: | gravity – float, default: 9.81 |
---|
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) |
---|
Material mode to use for rendering
Parameters: | material_mode – enum in [‘SINGLETEXTURE’, ‘MULTITEXTURE’, ‘GLSL’] |
---|
Configure to render image in stereo mode
(anaglyphs allows to see in 3d with special red-cyan glasses)
Parameters: |
|
---|
Set the default view mode
Parameters: | viewport_shade – enum in [‘BOUNDBOX’, ‘WIREFRAME’, ‘SOLID’, ‘TEXTURED’], default ‘WIREFRAME’ |
---|
Display the value of the game-properties marked as debug
Parameters: | value – indicate whether to show or not this information |
---|
Bases: morse.builder.abstractcomponent.AbstractComponent
Append a morse-component to the scene
cf. bpy.ops.wm.link_append and bpy.data.libraries.load
Bases: morse.builder.abstractcomponent.AbstractComponent
Allows to import any Blender object to the scene.
Bases: morse.builder.morsebuilder.Robot
Add a child to the current object
Overloads morse.builder.abstractcomponent.AbstractComponent.append() e.g., robot.append(sensor) will set the robot parent of the sensor.