Light

A simple point light

This actuator is a simple On/Off light. Based on SPOT light.

  • Emit in +X

Configuration parameters for Light

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

  • emit (bool, default: True)
    Set to False to initially disable the light
  • distance (float, default: 10)
    Distance at which the light energy is halfed
  • color (string, default: "(0,0,0)")
    Light color
  • size (float, default: 1.5707963267948966)
    Light spot size
  • energy (float, default: 1.0)
    Light energy when On

Data fields

This actuator reads these datafields at each simulation step:

  • emit (bool, initial value: True)
    On/Off light switch

Interface support:

Services for Light

  • 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

  • set_property(prop_name, prop_val) (blocking)

    Modify one property on a component

    • Parameters

      • prop_name: the name of the property to modify (as shown the documentation)
      • prop_val: the new value of the property. Note that there is no checking about the type of the value so be careful
    • Return value

      nothing

  • toggle(emit) (blocking)

    Toggle the light.

    • Parameters

      • emit: if emit is set to True/False, switch the light On/Off; if emit is not set, toggle the light (from On to Off and conversely)
    • Return value

      Returns always True

Examples

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

from morse.builder import *

# adds a default robot (the MORSE mascott!)
robot = Morsy()

# creates a new instance of the actuator
light = Light()

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

robot.append(light)

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

env = Environment('empty')

Other sources of examples

(This page has been auto-generated from MORSE module morse.actuators.light.)