Generic laser range sensors
This is a generic sensor class used to emulate laser range scanners, including a variety of SICK and Hokuyo sensors.
This sensor works by generating a series of rays in predefined directions, and then computing whether any active object is found within a certain distance from the origin of the sensor.
The resolution and detection range can be completely configured using the MORSE Builder API. This will generate a flat mesh with a semi-circular shape, where its vertices represent the directions in which the rays of the sensor are cast. It is also possible to create a sensor with multiple scan layers, such as the SICK LD-MRS. This is configured using the parameters specified below.
Note
Objects in the scene with the No collision setting in their Game properties will not be detected by this sensor
The number and direction of the rays emitted by the sensor is determined by the vertices of a semi-circle mesh parented to the sensor. The sensor will cast rays from the center of the sensor in the direction of each of the vertices in the semi-circle.
Three preconfigured scanners are available: a SICK LMS500 laser scanner, a Hokuyo and a SICK LD-MRS. The example below shows how to add them in a simulation:
from morse.builder import *
# Append a sick laser
sick = Sick() # range: 30m, field: 180deg, 180 sample points
hokuyo = Hokuyo() # range: 30m, field: 270deg, 1080 sample points
sick_ld_mrs = SickLDMRS() # range: 30m, field 100deg, 4 layers, 400 points per layer
All these default parameters can be changed i(cf Configuration parameters below). An example of how to change the arc object using the Builder API is show below:
from morse.builder import *
# Append a sick laser
sick = Sick()
sick.properties(resolution = 5)
sick.properties(scan_window = 90)
sick.properties(laser_range = 5.0)
Note
In some special cases (like multi-robot setups), you may need to additionally call sick.create_sick_arc() after setting your scanner properties.
The ray will be created from (-window/2) to (+window/2). So the range_list will contain the range clockwise.
Another example for the SICK LD-MRS:
from morse.builder import *
sick = SickLDMRS()
sick.properties(Visible_arc = True)
sick.properties(resolution = 1.0)
sick.properties(scan_window = 100)
sick.properties(laser_range = 50.0)
sick.properties(layers = 4)
sick.properties(layer_separation = 0.8)
sick.properties(layer_offset = 0.25)
As with any other component, it is possible to adjust the refresh frequency of the sensor, after it has been defined in the builder script. For example, to set the frequency to 1 Hz:
sick.frequency(1.0)
You can set these properties in your scripts with <component>.properties(<property1>=..., <property2>=...).
The distance in meters from the center of the sensor to which it is capable of detecting other objects.
The angle between each laser in the sensor. Expressed in degrees in decimal format. (i. e.), half a degree is expressed as 0.5. Used when creating the arc object.
The full angle covered by the sensor. Expressed in degrees in decimal format. Used when creating the arc object.
if the laser arc should be displayed during the simulation
Number of scanning planes used by the sensor.
The angular distance between the planes, in degrees.
The horizontal distance between the scan points in consecutive scanning layers. Must be given in degrees.
This sensor exports these datafields at each simulation step:
number of milliseconds in simulated time
Array that stores the positions of the points found by the laser. The points are given with respect to the location of the sensor, and stored as lists of three elements. The number of points depends on the geometry of the arc parented to the sensor (see below). The point (0, 0, 0) means that this ray has not it anything in its range
Array that stores the distance to the first obstacle detected by each ray. The order indexing of this array is the same as for point_list, so that the element in the same index of both lists will correspond to the measures for the same ray. If the ray does not hit anything in its range it returns laser_range
Interface support:
Returns the current data stored in the sensor.
Return value
a dictionary of the current sensor’s data
Returns the configurations of a component (parsed from the properties).
Return value
a dictionary of the current component’s configurations
Returns the properties of a component.
Return value
a dictionary of the current component’s properties
The following examples show how to use this component in a Builder script:
from morse.builder import *
robot = ATRV()
# creates a new instance of the sensor
laserscanner = LaserScanner()
# place your component at the correct location
laserscanner.translate(<x>, <y>, <z>)
laserscanner.rotate(<rx>, <ry>, <rz>)
robot.append(laserscanner)
# define one or several communication interface, like 'socket'
laserscanner.add_interface(<interface>)
env = Environment('empty')
(This page has been auto-generated from MORSE module morse.sensors.laserscanner.)