Light ===== **A simple point light** This actuator is a simple On/Off light. Based on `SPOT `_ light. - Emit in +X .. cssclass:: properties morse-section Configuration parameters for Light ---------------------------------- You can set these properties in your scripts with ``.properties(=..., =...)``. - ``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 `std_msgs/Bool `_ (: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`) - :tag:`moos` as LightReader (:py:mod:`morse.middleware.moos.light.LightReader`) .. 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 - ``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 - ``get_configurations()`` (blocking) Returns the configurations of a component (parsed from the properties). - Return value a dictionary of the current component's configurations .. 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 * # 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(, , ) light.rotate(, , ) robot.append(light) # define one or several communication interface, like 'socket' light.add_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.)*