Collision
=========


**Detect objects colliding with the current object.**


Sensor to detect objects colliding with the current object,
with more settings than the Touch sensor


.. cssclass:: properties morse-section

Configuration parameters for collision
--------------------------------------


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

- ``collision_property`` (string, default: ``""``)
	Only look for objects with this property, default "" (all objects)


.. cssclass:: fields morse-section

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


This sensor exports these datafields at each simulation step:

- ``timestamp`` (float, initial value: ``0.0``)
	number of milliseconds in simulated time
- ``collision`` (bool, initial value: ``False``)
	objects colliding with the current object
- ``objects`` (string, initial value: ````)
	A list of colliding objects.

*Interface support:*

(attention, no interface support!)

.. cssclass:: services morse-section

Services for Collision
----------------------

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

- ``get_local_data()`` (blocking)
    Returns the current data stored in the sensor.
    
    
  - Return value

    a dictionary of the current sensor's data 



.. 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 sensor
    collision = Collision()

    # place your component at the correct location
    collision.translate(<x>, <y>, <z>)
    collision.rotate(<rx>, <ry>, <rz>)
    
    robot.append(collision)
    
    # define one or several communication interface, like 'socket'
    collision.add_interface(<interface>)

    env = Environment('empty')
    

.. cssclass:: files morse-section

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

- `Source code <../../_modules/morse/sensors/collision.html>`_
- `Unit-test <../../_modules/base/collision_testing.html>`_




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