Distance sensor to detect nearby objects.
This sensor can be used to determine which other objects are within a certain radius of the sensor. It performs its test based only on distance. The type of tracked objects can be specified using the Track property.
You can set these properties in your scripts with <component>.properties(<property1>=..., <property2>=...).
The distance, in meters beyond which this sensor is unable to locate other robots.
The type of tracked objects. This type is looked for as game property of scene objects. You must then add a new game property to the objects you want to be detected by the proximity sensor.
This sensor exports these datafields at each simulation step:
number of seconds in simulated time
A list of the tracked objects located within the given radius. The keys of the dictionary are the object names, and the values are the distances (in meters) from the sensor.
deprecated. Points to near_objects for compatibility reasons.
Returns the properties of a component.
a dictionary of the current component’s properties
Returns the configurations of a component (parsed from the properties).
a dictionary of the current component’s configurations
The service expects a float range (in meter), and modify the range used to detect objects around the proximity sensor.
Returns the current data stored in the sensor.
a dictionary of the current sensor’s data
The service allows to modify the kind of objects detected by the proximity sensor.
Modify one property on a component
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 sensor proximity = Proximity() # place your component at the correct location proximity.translate(<x>, <y>, <z>) proximity.rotate(<rx>, <ry>, <rz>) robot.append(proximity) # define one or several communication interface, like 'socket' proximity.add_interface(<interface>) env = Environment('empty')