Generic Camera ============== **Base class for cameras in MORSE** A generic camera class, which is expected to be used as a base class for real camera. Concrete instantiation are currently: - :doc:`video_camera <../sensors/video_camera>` - :doc:`depth_camera <../sensors/depth_camera>` - :doc:`semantic_camera <../sensors/semantic_camera>` .. note:: The cameras make use of Blender's **bge.texture** module, which requires a graphic card capable of GLSL shading. Also, the 3D view window in Blender must be set to draw **Textured** objects. .. note:: The streaming of data from this sensor can be toggled off and on by pressing the SPACE key during the simulation. This will affect all the video cameras on the scene. Toggling off the cameras can help make the simulation run faster, specially when there are several cameras. However, the lack of data on the stream may cause problems to some middlewares. .. warning:: Contrary to most of objects in Morse, the X axis of the camera is not "in front" of the camera. Here, Morse follows the "standard convention for camera", i.e. X and Y are in the image plane, and Z is in the depth axis of the camera. .. cssclass:: properties morse-section Configuration parameters for Generic Camera ------------------------------------------- You can set these properties in your scripts with ``.properties(=..., =...)``. - ``cam_width`` (default: ``256``) (no documentation available yet) - ``cam_height`` (default: ``256``) (no documentation available yet) - ``cam_focal`` (default: ``25.0``) (no documentation available yet) - ``cam_near`` (default: ``0.1``) (no documentation available yet) - ``cam_far`` (default: ``100.0``) (no documentation available yet) - ``Vertical_Flip`` (default: ``True``) (no documentation available yet) - ``retrieve_depth`` (default: ``False``) (no documentation available yet) - ``retrieve_zbuffer`` (default: ``False``) (no documentation available yet) .. cssclass:: fields morse-section Data fields ----------- This sensor exports these datafields at each simulation step: - ``timestamp`` (float, initial value: ``0.0``) number of seconds in simulated time *Interface support:* (attention, no interface support!) .. cssclass:: services morse-section Services for Generic Camera --------------------------- - ``get_properties()`` (blocking) Returns the properties of a component. - Return value a dictionary of the current component's properties - ``get_local_data()`` (blocking) Returns the current data stored in the sensor. - Return value a dictionary of the current sensor's data - ``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 - ``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 sensor camera = Camera() # place your component at the correct location camera.translate(, , ) camera.rotate(, , ) robot.append(camera) # define one or several communication interface, like 'socket' camera.add_interface() env = Environment('empty') .. cssclass:: files morse-section Other sources of examples +++++++++++++++++++++++++ - `Source code <../../_modules/morse/sensors/camera.html>`_ - `Unit-test <../../_modules/base/camera_testing.html>`_ *(This page has been auto-generated from MORSE module morse.sensors.camera.)*