morse.services package

Submodules

morse.services.communication_services module

class Communication[source]

Bases: morse.core.abstractobject.AbstractObject

action()[source]
distance_and_view(robot1, robot2)[source]

Return the distance between the two robots, and a boolean which described if one can view the other.

name()[source]

The name of the component, as appearing when exposing services for instance.

morse.services.supervision_services module

class Supervision[source]

Bases: morse.core.abstractobject.AbstractObject

action()[source]
activate(component_name)[source]

Enable the functionality of the component specified

deactivate(component_name)[source]

Stop the specified component from calling its default_action method

details()[source]

Returns a structure containing all possible details about the simulation currently running, including the list of robots, the list of services and datastreams, the list of middleware in use, etc.

get_camarafp_position()[source]

Get the CamaraFP (MORSE’ environment camera) world position. [x, y, z]

Returns:The camera’s world position. [x, y, z].
get_camarafp_projection_matrix()[source]

Get the CamaraFP (MORSE’ environment camera) 4x4 projection matrix

get_camarafp_transform()[source]

Get the CamaraFP (MORSE’ environment camera) world space transform matrix.

Returns:The camera’s world space transform matrix. 4x4 Matrix [[float]]
get_scene_objects()[source]

Returns a hierarchial dictonary structure of all objects in the scene along with their positions and orientations, formated as a Python string representation. The structure: {object_name: [dict_of_children, position_tuple, quaternion_tuple], object_name: [dict_of_children, position_tuple, quaternion_tuple], …}

list_robots()[source]

Return a list of the robots in the current scenario

Uses the list generated during the initialisation of the scenario

name()[source]

The name of the component, as appearing when exposing services for instance.

quit()[source]

Cleanly quit the simulation

reset_objects()[source]

Restore all simulation objects to their original position

Upon receiving the request using sockets, call the ‘reset_objects’ function located in morse/blender/main.py

restore_dynamics()[source]

Resumes physics for all object in the scene.

set_camarafp_far_clip(far_clip)[source]

Set the CamaraFP (MORSE’ environment camera) far clip distance

Parameters:far_clip (float) – The camera’s far clip distance.
set_camarafp_position(position)[source]

Set the CamaraFP (MORSE’ environment camera) world position. [x, y, z]

Parameters:position (list(float)) – The camera’s world position. [x, y, z].
set_camarafp_projection_matrix(projection_matrix)[source]

Set the CamaraFP (MORSE’ environment camera) 4x4 projection matrix

Parameters:projection_matrix (4x4 Matrix [[float]]) – The camera’s 4x4 projection matrix.
set_camarafp_transform(transform)[source]

Set the CamaraFP (MORSE’ environment camera) world space transform matrix.

Parameters:transform (4x4 Matrix [[float]]) – The camera’s world space transform matrix.
set_log_level(component, level)[source]

Allow to change the logger level of a specific component

Parameters:
  • component (string) – the name of the logger you want to modify
  • level (string) – the desired level of logging
set_object_dynamics(object_name, state)[source]

Enable or disable the dynamics for an individual object.

Note: When turning on dynamics, the object will continue with the velocities it had when it was turned off.

Parameters:
  • object_name (string) – The name of the object to change.
  • boolean (state) – Turn on dynamics(True), or off (False)
set_object_position(object_name, position, orientation=None)[source]

Set the position (and optionally orientation of an object in the simulation. [x, y, z]

param position:The objects’s world position. [x, y, z].
type position:list(float)
param orientation:
 (optional) The object’s world

orientation [roll pitch yaw] in radians :type: orientation: list(float)

set_object_visibility(object_name, visible, do_children)[source]

Set the visibility of an object in the simulation.

Note: The object will still have physics and dynamics despite being invisible.

Parameters:
  • object_name (string) – The name of the object to change visibility of.
  • boolean (do_children) – Make the object visible(True) or invisible(False)
  • boolean – If True then the visibility of all children of

object_name is also set.

suspend_dynamics()[source]

Suspends physics for all object in the scene.

terminate()[source]

Terminate the simulation (no finalization done!)

get_obj_by_name(name)[source]

Return object in the scene associated to :param name: If it does not exists, throw a MorseRPCInvokationError

get_structured_children_of(blender_object)[source]

Returns a nested dictionary of the given objects children, recursively. The retun format is as follows:

{blender_object.name: [children_dictionary, position, orientation]}

where children_dictionary is another of the same format, but with the keys being the children of blender_object. This continues down the entire tree structure.

Parameters:blender_object (KX_GameObject) – The Blender object to return children

for.

morse.services.time_services module

class TimeServices[source]

Bases: morse.core.abstractobject.AbstractObject

action()[source]
mode()[source]

Return the current time management mode

name()[source]

The name of the component, as appearing when exposing services for instance.

now()[source]

Return the simulator time, in seconds, since Epoch

set_time_scale(value)[source]

Modify the time_scale parameter, allowing to slowing or accelerating time

sleep(callback, *param)

Sleep for time seconds

Param:a float representing the time to wait (in second)
statistics()[source]

Return various statistics associated to the specific time management mode

Module contents