morse.helpers package¶
Submodules¶
morse.helpers.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.
morse.helpers.coordinates module¶
morse.helpers.filt2 module¶
morse.helpers.loading module¶
Loading Helpers for ‘classpath’ configuration
- create_instance_level(classpath, level, *args, **kwargs)[source]¶
Creates an instances of a class from a component abstration level.
morse.helpers.morse_logging module¶
- class MorseFormatter(*args, **kwargs)[source]¶
Bases:
logging.Formatter
- format(record)[source]¶
Format the specified record as text.
The record’s attribute dictionary is used as the operand to a string formatting operation which yields the returned string. Before formatting the dictionary, a couple of preparatory steps are carried out. The message attribute of the record is computed using LogRecord.getMessage(). If the formatting string uses the time (as determined by a call to usesTime(), formatTime() is called to format the event time. If there is exception information, it is formatted using formatException() and appended to the message.
morse.helpers.morse_math module¶
- 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
morse.helpers.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
morse.helpers.statistics module¶
Statistics helper for Morse usage
morse.helpers.transformation module¶
- class Transformation3d(obj)[source]¶
Bases:
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
- property pitch¶
Returns Euler Y axis, in radian
- property roll¶
Returns Euler X axis, in radian
- property rotation¶
Returns the rotation as a unit quaternion
- property rotation_matrix¶
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
- property translation¶
- 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.
- property x¶
Return the translation along the x-axis
- property y¶
Return the translation along the y-axis
- property yaw¶
Returns Euler Z axis, in radian
- property z¶
Return the translation along the z-axis
morse.helpers.velocity module¶
- angular_velocities(prev, now, dt)[source]¶
Return angular velocities between two poses
- Parameters
prev – the precedent pose, as a Transformation3d
now – the current pose, as a Transformation3d
dt – time elapsed between the two poses acquisition, in sec
See https://www.astro.rug.nl/software/kapteyn/_downloads/attitude.pdf for equation description