helpers Package

colors Module

RGBtoHue(rgbList)[source]

Convert an RGB color to Hue

retrieveHue(obj)[source]

Convert the color of an object to hue

Retrieve the first material of the first mesh of an object and return the hue of this material.

components Module

add_data(name, default_value, type='', doc='(no documentation available yet)', level='all')[source]

Defines a new data field for this component, either for export (sensors) or for import (actuators).

Note

Several fields with the same name may be present if they belong to different ‘abstraction levels’.

Parameters:
  • name – name of the field
  • default_value – initial value of the field
  • type – indicative type value, currently only used for documentation
  • doc – description of the field
  • level – (default: all) abstraction level this field belong to. Only useful when levels are defined for the component with add_level statements.
add_level(name, classname, doc='(no documentation available yet)', default=False)[source]

Defines an abstraction level for a component.

Abstraction levels are predefined subsets of the component output or input, defining a particular functional level for your component.

Note

Two special level names are reserved: all and default. You can not use them.

Parameters:
  • name – name of the level
  • classpath – classpath (ie, module path + classname) that implements the level, or None to use the current class.
  • doc – short description of the level.
add_property(python_name, default_value, name, type='', doc='(no documentation available yet)')[source]

Add a property to the current class of component

Parameters:
  • python_name – name of the Python variable. It will be dynamically added to the component Python script.
  • default_value – the default value
  • name (string) – the name of the property. If used in the Blender logic bricks, it must match the Blender name.
  • type – type of the property, for documentation
  • doc – description of the property.

filt2 Module

class Filt2(wn=1.0, ksi=1.0)[source]

Bases: builtins.object

filtre du second ordre Yann

init()[source]
setParam(wn, ksi)[source]
simulate(u, dt)[source]

loading Module

Loading Helpers for ‘classpath’ configuration

create_instance(classpath, *args, **kwargs)[source]

Creates an instances of a class.

create_instance_level(classpath, level, *args, **kwargs)[source]

Creates an instances of a class from a component abstration level.

get_class(classpath)[source]

Returns the class object from a full classpath (like toto.tata.MyTata)

load_module_attribute(module_name, attribute_name)[source]

Dynamically import a Python attribute.

morse_logging Module

class MorseFormatter(*args, **kwargs)[source]

Bases: logging.Formatter

format(record)[source]

morse_math Module

euler_angle(ob)[source]
fill_vector(vector, point)[source]

Copy the contents of a list into an existing vector structure.

get_rotation_matrix(object)[source]

Return a the rotation matrix of an object. Used to transform another object to this one’s coordinate system.

invert_rotation_matrix(object)[source]

Return the inverse of the rotation matrix of an object.

Used to get the position of another object with respect to this one.

normalise_angle(angle)[source]

Force the given angle to be between PI and -PI

This function expects an angle given in radians It will reduce the input angle to be less than PI, and give it the correct sign.

Using new method proposed by David Hodo: hododav@tigermail.auburn.edu

print_matrix_33(matrix)[source]

print_matrix_33 prints a 3x3 @matrix on stdout

print_matrix_44(matrix)[source]

print_matrix_44 prints a 4x4 @matrix on stdout

print_vector(vector)[source]

print a vector with 4 decimals per value

rotation_direction(current_angle, target_angle, tolerance, speed)[source]

Test the direction in which a rotation should be made

Using the current angle of a component and the next desired angle. Angles are expected in radians

motion Module

object_is_moving(bge_object)[source]

Check if an object is currently in motion

Will work only for ‘dynamic’ or ‘rigid body’ objects in Blender. An object is considered to be in motion if any of the three components of its velocity vector is greater than an arbitrary tolerance.

passive_objects Module

active_objects()[source]

Returns all active objects in current scene, ie objects that have their ‘Object’ property set to True.

details(obj)[source]

Returns a dictionary containing the differents properties for a given active object.

If the object is not active (ie, it has no ‘Object’ property, or the property is set to False), None is returned.

If no label is available, it defaults to the Blender name. The description field may be an empty string. If no type is available, it defaults to ‘Object’. If the graspable flag is not present, it defaults to False.

Parameters:name – the Blender name of the object.
Returns:a dictionary {‘label’:string, ‘description’:string, ‘type’:string, ‘graspable’:bool}
graspable_objects()[source]

Returns all objects in current scene that have the ‘Graspable’ property set to True, amongst active objects.

label(obj)[source]

Returns the label of a given active object.

If the object is not active (ie, it has no ‘Object’ property, or the property is set to False), None is returned.

If no label is available, it defaults to the Blender name.

Parameters:name – the Blender name of the object.
Returns:the label
obj_from_label(label)[source]

Returns the label of a given active object.

If the object is not active (ie, it has no ‘Object’ property, or the property is set to False), None is returned.

If no label is available, it defaults to the Blender name.

Parameters:name – the Blender name of the object.
Returns:the label

statistics Module

Statistics helper for Morse usage

class Stats[source]

Bases: builtins.object

A simple class to compute basic statistics on some values, computed incrementaly

update(x)[source]
variance[source]

transformation Module

class Transformation3d(obj)[source]

Bases: builtins.object

Transformation3d represents a generic 3D transformation. It is used by each component of the simulator to know their position in the world. Blender does not propose such an interface, only some rotation matrix and translation vector.

Internally, we store an internal 4x4 matrix, and use it to compute transformation. the euler representation is then calculated on base of matrix (euler ZYX convention)

Note : Blender store its matrix in column major mode ...

distance(t3d)[source]

Compute the 3d distance between two transformations.

nor self, nor t3d are modified by the call of this method

distance_2d(t3d)[source]

Compute the 2d distance between two transformations.

nor self, nor t3d are modified by the call of this method

pitch[source]

Returns Euler Y axis, in radian

roll[source]

Returns Euler X axis, in radian

rotation[source]

Returns the rotation as a unit quaternion

rotation_matrix[source]

Returns the rotation as a 3x3 matrix

transformation3d_with(t3d)[source]

Compute the transformation between itself and another transformation t3d. In other words, A.transformation3d_with(B) returns inv(A) * B.

self is not modified by the call of this function

translation[source]
update(obj)[source]

Update the transformation3D to reflect the transformation between obj (a blender object) and the blender world origin

update_Y_forward(obj)[source]

Update the transformation3D to reflect the transformation between obj (a blender object) and the blender world origin. In this case, the robot moves forwar along the Y axis.

Change the values of yaw, pitch, roll for Blender vehicles Robots that use the Blender vehicle constraints move in the direction of the Y axis, contrary to most of the MORSE components that move along the X axis.

x[source]

Return the translation along the x-axis

y[source]

Return the translation along the y-axis

yaw[source]

Returns Euler Z axis, in radian

z[source]

Return the translation along the z-axis