Compound Sensor

Special sensor that merges other sensors’ outputs

This special sensor is constructed by passing a list of other sensors, and creates a new datastream from the concatenation of other sensors’ local_data.

More accurately, it streams a dictionary of {<sensor name>: <sensor local_data>}.

Note that services exposed by original sensors are not exposed by the compound sensor.

Configuration parameters for compound sensor

You can set these properties in your scripts with <component>.properties(<property1>=..., <property2>=...).

  • sensors (The list of sensor names to merge., default: [])

    (no documentation available yet)

Data fields

This sensor exports these datafields at each simulation step:

  • timestamp (float, initial value: 0.0)

    number of milliseconds in simulated time

Interface support:

(attention, no interface support!)

Services for Compound Sensor

  • get_local_data() (blocking)

    Returns the current data stored in the sensor.

    • Return value

      a dictionary of the current sensor’s data

  • get_configurations() (blocking)

    Returns the configurations of a component (parsed from the properties).

    • Return value

      a dictionary of the current component’s configurations

  • get_properties() (blocking)

    Returns the properties of a component.

    • Return value

      a dictionary of the current component’s properties

Examples

The following examples show how to use this component in a Builder script:

from morse.builder import *

robot = ATRV()

# creates a new instance of the sensor
compoundsensor = CompoundSensor()

# place your component at the correct location
compoundsensor.translate(<x>, <y>, <z>)
compoundsensor.rotate(<rx>, <ry>, <rz>)

robot.append(compoundsensor)

# define one or several communication interface, like 'socket'
compoundsensor.add_interface(<interface>)

env = Environment('empty')

Other sources of examples

(This page has been auto-generated from MORSE module morse.sensors.compound.)

Table Of Contents

Previous topic

Collision

Next topic

Depth (XYZ) camera

This Page