Modifiers¶
Modifier processing is a specific phase between datastream processing and real
component processing. It allows us to apply some generic transformations on the data
(for example, convert from one frame convention to another), or to alter
the qualities
of data to make them more realistic.
Adding a modifier to a component¶
Binding a component to use a modifier is done through the MORSE Builder
API, using the method
morse.builder.abstractcomponent.AbstractComponent.alter()
. For
example, to transform coordinates from local Blender frame to some absolute
UTM reference frame, you can use the UTM conversion modifier in this way:
from morse.builder import *
robot = ATRV()
gps = GPS()
gps.add_stream('socket')
gps.alter('UTM')
robot.append(gps)
env = Environment('empty', fastmode = True)
env.properties(UTMXOffset='123456789.0', UTMYOffset=-4242.0, UTMZOffset=421.0)
Sometimes, you need to pass some arguments to your modifier, for example to set the standard deviation of your gaussian noise. In such cases, you can use the following syntax:
import math
from morse.builder import *
robot = ATRV()
pose = Pose()
pose.add_stream('socket')
pose.alter('Noise', pos_std = 0.10, rot_std = math.radians(10))
env = Environment('empty', fastmode = True)
Creating a new modifier¶
Please see the developer documentation: Creating a modifier.