Light
=====


**A simple point light**


This actuator is a simple On/Off light. Based on `SPOT
<http://wiki.blender.org/index.php/Doc:2.6/Manual/Lighting/Lamps/Spot>`_ light.

-  Emit in +X



.. cssclass:: properties morse-section

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


.. cssclass:: fields morse-section

Data fields
-----------


This actuator reads these datafields at each simulation step:

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

*Interface support:*

- :tag:`ros`  as BoolReader (:py:mod:`morse.middleware.ros.light.BoolReader`)
- :tag:`socket`  as straight JSON deserialization (:py:mod:`morse.middleware.socket_datastream.SocketReader`)
- :tag:`yarp`  as yarp::Bottle (:py:mod:`morse.middleware.yarp_datastream.YarpReader`)


.. cssclass:: services morse-section

Services for Light
------------------

- ``get_properties()`` (blocking)
    Returns the properties of a component.
    
    
  - Return value

    a dictionary of the current component's properties  

- ``get_configurations()`` (blocking)
    Returns the configurations of a component (parsed from the properties).
    
    
  - Return value

    a dictionary of the current component's configurations  

- ``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 



.. cssclass:: examples morse-section

Examples
--------


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

.. code-block:: python


    from morse.builder import *
    
    robot = ATRV()
    
    # 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')
    

.. cssclass:: files morse-section

Other sources of examples
+++++++++++++++++++++++++

- `Source code <../../_modules/morse/actuators/light.html>`_
- `Unit-test <../../_modules/base/light_testing.html>`_




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