New iteration by S

This commit is contained in:
sergi-e 2020-07-31 13:16:12 +02:00 committed by bernat
parent f140584228
commit 3ebcc89dd3
9 changed files with 209 additions and 192 deletions

View File

@ -189,13 +189,10 @@ Different functionalities such as navigation, measurement of physical properties
<td><a href="../python_api#carlaimumeasurement">carla.IMUMeasurement</a></td>
<td>Comprises an accelerometer, a gyroscope, and a compass.</td>
<tr>
<td>LIDAR raycast</td>
<td>LIDAR</td>
<td><a href="../python_api#carlalidarmeasurement">carla.LidarMeasurement</a></td>
<td>A rotating LIDAR. Generates a 3D point cloud and its asociated intensity modelling the surroundings p.</td>
<td>A rotating LIDAR. Generates a 4D point cloud with coordinates and intensity per point to model the surroundings.</td>
<tr>
<td>RawLIDAR raycast</td>
<td><a href="../python_api#carlalidarrawmeasurement">carla.LidarRawMeasurement</a></td>
<td>A rotating LIDAR. Generates a 3D point cloud plus extra information about the raycast hitted object.</td><tr>
<td>Radar</td>
<td><a href="../python_api#carlaradarmeasurement">carla.RadarMeasurement</a></td>
<td>2D point map modelling elements in sight and their movement regarding the sensor. </td>
@ -203,6 +200,10 @@ Different functionalities such as navigation, measurement of physical properties
<td>RSS</td>
<td><a href="../python_api#carlarssresponse">carla.RssResponse</a></td>
<td>Modifies the controller applied to a vehicle according to safety checks. This sensor works in a different manner than the rest, and there is specific <a href="../adv_rss">RSS documentation</a> for it. </td>
<tr>
<td>Semantic LIDAR</td>
<td><a href="../python_api#carlasemanticlidarmeasurement">carla.SemanticLidarMeasurement</a></td>
<td>A rotating LIDAR. Generates a 3D point cloud with extra information regarding instance and semantic segmentation.</td>
</tbody>
</table>
<br>

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 390 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 128 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 530 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 137 KiB

View File

@ -1024,15 +1024,15 @@ Computed intensity for this point.
---
## carla.LidarMeasurement<a name="carla.LidarMeasurement"></a>
<div style="padding-left:30px;margin-top:-20px"><small><b>Inherited from _[carla.SensorData](#carla.SensorData)_</b></small></div></p><p>Class that defines the lidar data retrieved by a <b>sensor.lidar.ray_cast</b>. This essentially simulates a rotating lidar using ray-casting. Learn more about this [here](ref_sensors.md#lidar-raycast-sensor).
<div style="padding-left:30px;margin-top:-20px"><small><b>Inherited from _[carla.SensorData](#carla.SensorData)_</b></small></div></p><p>Class that defines the LIDAR data retrieved by a <b>sensor.lidar.ray_cast</b>. This essentially simulates a rotating LIDAR using ray-casting. Learn more about this [here](ref_sensors.md#lidar-raycast-sensor).
<h3>Instance Variables</h3>
- <a name="carla.LidarMeasurement.channels"></a>**<font color="#f8805a">channels</font>** (_int_)
Number of lasers shot.
- <a name="carla.LidarMeasurement.horizontal_angle"></a>**<font color="#f8805a">horizontal_angle</font>** (_float_)
Horizontal angle the Lidar is rotated at the time of the measurement (in radians).
Horizontal angle the LIDAR is rotated at the time of the measurement (in radians).
- <a name="carla.LidarMeasurement.raw_data"></a>**<font color="#f8805a">raw_data</font>** (_bytes_)
Received list of 4D points. Each point consists in a 3D-xyz data plus the intensity computed for that point.
Received list of 4D points. Each point consists of [x,y,z] coordiantes plus the intensity computed for that point.
<h3>Methods</h3>
- <a name="carla.LidarMeasurement.save_to_disk"></a>**<font color="#7fb800">save_to_disk</font>**(<font color="#00a6ed">**self**</font>, <font color="#00a6ed">**path**</font>)
@ -1686,17 +1686,17 @@ Sets the log level.
---
## carla.SemanticLidarDetection<a name="carla.SemanticLidarDetection"></a>
Data contained inside a [carla.SemanticLidarMeasurement](#carla.SemanticLidarMeasurement). Each of these represents one of the points in the cloud with its location and its asociated intensity.
Data contained inside a [carla.SemanticLidarMeasurement](#carla.SemanticLidarMeasurement). Each of these represents one of the points in the cloud with its location, the cosine of the incident angle, index of the object hit, and its semantic tag.
<h3>Instance Variables</h3>
- <a name="carla.SemanticLidarDetection.point"></a>**<font color="#f8805a">point</font>** (_[carla.Location](#carla.Location)_)
Point in xyz coordinates.
[x,y,z] coordinates of the point.
- <a name="carla.SemanticLidarDetection.cos_inc_angle"></a>**<font color="#f8805a">cos_inc_angle</font>** (_float_)
Cosine of the incident angle between the ray and the normal of the hit object.
Cosine of the incident angle between the ray, and the normal of the hit object.
- <a name="carla.SemanticLidarDetection.object_idx"></a>**<font color="#f8805a">object_idx</font>** (_uint_)
Carla index of the hitted actor.
Carla index of the hit actor.
- <a name="carla.SemanticLidarDetection.object_tag"></a>**<font color="#f8805a">object_tag</font>** (_uint_)
Semantic tag of the hitted component.
Semantic tag of the hit component.
<h3>Methods</h3>
@ -1706,19 +1706,19 @@ Semantic tag of the hitted component.
---
## carla.SemanticLidarMeasurement<a name="carla.SemanticLidarMeasurement"></a>
<div style="padding-left:30px;margin-top:-20px"><small><b>Inherited from _[carla.SensorData](#carla.SensorData)_</b></small></div></p><p>Class that defines the semantic lidar data retrieved by a <b>sensor.lidar.ray_cast_semantic</b>. This essentially simulates a rotating lidar using ray-casting. Learn more about this [here](ref_sensors.md#semanticlidar-raycast-sensor).
<div style="padding-left:30px;margin-top:-20px"><small><b>Inherited from _[carla.SensorData](#carla.SensorData)_</b></small></div></p><p>Class that defines the semantic LIDAR data retrieved by a <b>sensor.lidar.ray_cast_semantic</b>. This essentially simulates a rotating LIDAR using ray-casting. Learn more about this [here](ref_sensors.md#semanticlidar-raycast-sensor).
<h3>Instance Variables</h3>
- <a name="carla.SemanticLidarMeasurement.channels"></a>**<font color="#f8805a">channels</font>** (_int_)
Number of lasers shot.
- <a name="carla.SemanticLidarMeasurement.horizontal_angle"></a>**<font color="#f8805a">horizontal_angle</font>** (_float_)
Horizontal angle the Lidar is rotated at the time of the measurement (in radians).
Horizontal angle the LIDAR is rotated at the time of the measurement (in radians).
- <a name="carla.SemanticLidarMeasurement.raw_data"></a>**<font color="#f8805a">raw_data</font>** (_bytes_)
Received list of raw detection points. Each point consists in a 3D-xyz data plus cosine of the incident angle, the idx of the hit actor and its semantic tag.
Received list of raw detection points. Each point consists of [x,y,z] coordinates plus the cosine of the incident angle, the index of the hit actor, and its semantic tag.
<h3>Methods</h3>
- <a name="carla.SemanticLidarMeasurement.save_to_disk"></a>**<font color="#7fb800">save_to_disk</font>**(<font color="#00a6ed">**self**</font>, <font color="#00a6ed">**path**</font>)
Saves the point cloud to disk as a <b>.ply</b> file describing data from 3D scanners. The files generated are ready to be used within [MeshLab](http://www.meshlab.net/), an open source system for processing said files. Just take into account that axis may differ from Unreal Engine and so, need to be reallocated.
Saves the point cloud to disk as a <b>.ply</b> file describing data from 3D scanners. The files generated are ready to be used within [MeshLab](http://www.meshlab.net/), an open-source system for processing said files. Just take into account that axis may differ from Unreal Engine and so, need to be reallocated.
- **Parameters:**
- `path` (_str_)
@ -1777,14 +1777,14 @@ Commands the sensor to stop listening for data.
Base class for all the objects containing data generated by a [carla.Sensor](#carla.Sensor). This objects should be the argument of the function said sensor is listening to, in order to work with them. Each of these sensors needs for a specific type of sensor data. Hereunder is a list of the sensors and their corresponding data.
- Cameras (RGB, depth and semantic segmentation): [carla.Image](#carla.Image).
- Collision detector: [carla.CollisionEvent](#carla.CollisionEvent).
- Gnss detector: [carla.GnssMeasurement](#carla.GnssMeasurement).
- IMU detector: [carla.IMUMeasurement](#carla.IMUMeasurement).
- GNSS sensor: [carla.GnssMeasurement](#carla.GnssMeasurement).
- IMU sensor: [carla.IMUMeasurement](#carla.IMUMeasurement).
- Lane invasion detector: [carla.LaneInvasionEvent](#carla.LaneInvasionEvent).
- Lidar raycast: [carla.LidarMeasurement](#carla.LidarMeasurement).
- SemanticLidar raycast: [carla.SemanticLidarMeasurement](#carla.SemanticLidarMeasurement).
- LIDAR sensor: [carla.LidarMeasurement](#carla.LidarMeasurement).
- Obstacle detector: [carla.ObstacleDetectionEvent](#carla.ObstacleDetectionEvent).
- Radar detector: [carla.RadarMeasurement](#carla.RadarMeasurement).
- RSS sensor: [carla.RssResponse](#carla.RssResponse).
- Radar sensor: [carla.RadarMeasurement](#carla.RadarMeasurement).
- RSS sensor: [carla.RssResponse](#carla.RssResponse).
- Semantic LIDAR sensor: [carla.SemanticLidarMeasurement](#carla.SemanticLidarMeasurement).
<h3>Instance Variables</h3>
- <a name="carla.SensorData.frame"></a>**<font color="#f8805a">frame</font>** (_int_)

View File

@ -1,19 +1,18 @@
# Sensors reference
* [__Collision detector__](#collision-detector)
* [__Depth camera__](#depth-camera)
* [__GNSS sensor__](#gnss-sensor)
* [__IMU sensor__](#imu-sensor)
* [__Lane invasion detector__](#lane-invasion-detector)
* [__Lidar raycast sensor__](#lidar-raycast-sensor)
* [__SemanticLidar raycast sensor__](#semanticlidar-raycast-sensor)
* [__Obstacle detector__](#obstacle-detector)
* [__Radar sensor__](#radar-sensor)
* [__RGB camera__](#rgb-camera)
* [__RSS sensor__](#rss-sensor)
* [__Semantic segmentation camera__](#semantic-segmentation-camera)
* [__DVS camera__](#dvs-camera)
* [__Collision detector__](#collision-detector)
* [__Depth camera__](#depth-camera)
* [__GNSS sensor__](#gnss-sensor)
* [__IMU sensor__](#imu-sensor)
* [__Lane invasion detector__](#lane-invasion-detector)
* [__LIDAR sensor__](#lidar-sensor)
* [__Obstacle detector__](#obstacle-detector)
* [__Radar sensor__](#radar-sensor)
* [__RGB camera__](#rgb-camera)
* [__RSS sensor__](#rss-sensor)
* [__Semantic LIDAR sensor__](#semantic-lidar-sensor)
* [__Semantic segmentation camera__](#semantic-segmentation-camera)
* [__DVS camera__](#dvs-camera)
---
## Collision detector
@ -464,38 +463,41 @@ This sensor does not have any configurable attribute.
</table>
---
## Lidar raycast sensor
## LIDAR sensor
* __Blueprint:__ sensor.lidar.ray_cast
* __Output:__ [carla.LidarMeasurement](python_api.md#carla.LidarMeasurement) per step (unless `sensor_tick` says otherwise).
This sensor simulates a rotating Lidar implemented using ray-casting.
The points are computed by adding a laser for each channel distributed in the vertical FOV. The rotation is simulated computing the horizontal angle that the Lidar rotated in a frame. The point cloud is calculated by doing a ray-cast for each laser in every step:
This sensor simulates a rotating LIDAR implemented using ray-casting.
The points are computed by adding a laser for each channel distributed in the vertical FOV. The rotation is simulated computing the horizontal angle that the Lidar rotated in a frame. The point cloud is calculated by doing a ray-cast for each laser in every step.
`points_per_channel_each_step = points_per_second / (FPS * channels)`
If the `noise_stddev` attribute is positive, each point is then randomly perturbed along the vector of the laser ray. In effect, this simulates
a Lidar with perfect angular positioning, but noisy distance measurement.
A LIDAR measurement contains a package with all the points generated during a `1/FPS` interval. During this interval the physics are not updated so all the points in a measurement reflect the same "static picture" of the scene.
A Lidar measurement contains a packet with all the points generated during a `1/FPS` interval. During this interval the physics are not updated so all the points in a measurement reflect the same "static picture" of the scene.
The information of the Lidar measurement is enconded 4D points. Being the first three, the space points in xyz coordinates and the last one intensity loss during the travel. This intensity is computed by:
<br>
![LidarIntensityComputation](img/lidar_intensity.png)
<br>
where a is the attenuation coefficient and d is the distance to the sensor.
In order to increase the realism, we add the possibility of dropping cloud points. This is done in two different ways. In a general way, we can randomly drop points with a probability given by <b>dropoff_general_rate</b>. In this case, the drop off of points is done before tracing the ray cast so adjust this parameter can increase our performance. If that parameter is set to zero it will be ignored. The second way to regulate the drop off of points is in a rate proportional to the intensity. This drop off rate will be proportional to the intensity from zero at <b>dropoff_intensity_limit</b> to <b>dropoff_zero_intensity</b> at zero intensity.
This output contains a cloud of simulation points and thus, can be iterated to retrieve a list of their [`carla.Location`](python_api.md#carla.Location):
This output contains a cloud of simulation points and thus, it can be iterated to retrieve a list of their [`carla.Location`](python_api.md#carla.Location):
```py
for location in lidar_measurement:
print(location)
```
The information of the LIDAR measurement is enconded 4D points. Being the first three, the space points in xyz coordinates and the last one intensity loss during the travel. This intensity is computed by the following formula.
<br>
![LidarIntensityComputation](img/lidar_intensity.jpg)
`a` — Attenuation coefficient. This may depend on the sensor's wavelenght, and the conditions of the atmosphere. It can be modified with the LIDAR attribute `atmosphere_attenuation_rate`.
`d` — Distance from the hit point to the sensor.
For a better realism, points in the cloud can be dropped off. This is an easy way to simulate loss due to external perturbations. This can done combining two different.
* __General drop-off__ — Proportion of points that are dropped off randomly. This is done before the tracing, meaning the points being dropped are not calculated, and therefore improves the performance. If `dropoff_general_rate = 0.5`, half of the points will be dropped.
* __Instensity-based drop-off__ — For each point detected, and extra drop-off is performed with a probability based in the computed intensity. This probability is determined by two parameters. `dropoff_zero_intensity` is the probability of points with zero intensity to be dropped. `dropoff_intensity_limit` is a threshold intensity above which no points will be dropped. The probability of a point within the range to be dropped is a linear proportion based on these two parameters.
Additionally, the `noise_stddev` attribute makes for a noise model to simulate unexpected deviations that appear in real-life sensors. For positive values, each point is randomly perturbed along the vector of the laser ray. The result is a LIDAR sensor with perfect angular positioning, but noisy distance measurement.
The rotation of the LIDAR can be tuned to cover a specific angle on every simulation step (using a [fixed time-step](adv_synchrony_timestep.md)). For example, to rotate once per step (full circle output, as in the picture below), the rotation frequency and the simulated FPS should be equal. <br> __1.__ Set the sensor's frequency `sensors_bp['lidar'][0].set_attribute('rotation_frequency','10')`. <br> __2.__ Run the simulation using `python config.py --fps=10`.
![LidarPointCloud](img/lidar_point_cloud.gif)
![LidarPointCloud](img/lidar_point_cloud.jpg)
#### Lidar attributes
@ -526,7 +528,7 @@ The rotation of the LIDAR can be tuned to cover a specific angle on every simula
<td><code>rotation_frequency</code></td>
<td>float</td>
<td>10.0</td>
<td>Lidar rotation frequency.</td>
<td>LIDAR rotation frequency.</td>
<tr>
<td><code>upper_fov</code></td>
<td>float</td>
@ -541,7 +543,7 @@ The rotation of the LIDAR can be tuned to cover a specific angle on every simula
<td><code>atmosphere_attenuation_rate</code></td>
<td>float</td>
<td>0.004</td>
<td>Coefficient that measures the lidar instensity loss per meter. Check the intensity computation above.</td>
<td>Coefficient that measures the LIDAR instensity loss per meter. Check the intensity computation above.</td>
<tr>
<td><code>dropoff_general_rate</code></td>
<td>float</td>
@ -551,12 +553,12 @@ The rotation of the LIDAR can be tuned to cover a specific angle on every simula
<td><code>dropoff_intensity_limit</code></td>
<td>float</td>
<td>0.8</td>
<td>For the intensity dropoff, the limit above which we do not drop any point.</td>
<td>For the intensity based drop-off, the threshold intensity value above which no points are dropped.</td>
<tr>
<td><code>dropoff_zero_intensity</code></td>
<td>float</td>
<td>0.4</td>
<td>For the intensity dropoff, the maximum drop off at zero intensity.</td>
<td>For the intensity based drop-off, the probability of each point with zero intensity being dropped.</td>
<tr>
<td><code>sensor_tick</code></td>
<td>float</td>
@ -566,7 +568,7 @@ The rotation of the LIDAR can be tuned to cover a specific angle on every simula
<td><code>noise_stddev</code></td>
<td>float</td>
<td>0.0</td>
<td>Standard deviation of noise along the vector of each raycast.</td>
<td>Standard deviation of the noise model to disturb each point along the vector of its raycast.</td>
</tbody>
</table>
<br>
@ -595,11 +597,11 @@ The rotation of the LIDAR can be tuned to cover a specific angle on every simula
<tr>
<td><code>horizontal_angle</code></td>
<td>float</td>
<td>Angle (radians) in the XY plane of the lidar this frame.</td>
<td>Angle (radians) in the XY plane of the LIDAR in the current frame.</td>
<tr>
<td><code>channels</code></td>
<td>int</td>
<td>Number of channels (lasers) of the lidar.</td>
<td>Number of channels (lasers) of the LIDAR.</td>
<tr>
<td><code>get_point_count(channel)</code></td>
<td>int</td>
@ -611,120 +613,6 @@ The rotation of the LIDAR can be tuned to cover a specific angle on every simula
</tbody>
</table>
---
## SemanticLidar raycast sensor
* __Blueprint:__ sensor.lidar.ray_cast_semantic
* __Output:__ [carla.SemanticLidarMeasurement](python_api.md#carla.SemanticLidarMeasurement) per step (unless `sensor_tick` says otherwise).
This sensor simulates a rotating Lidar implemented using ray-casting that exposes all the information about the raycast hit. Its behaviour is quite similar to the [Lidar raycast sensor](#lidar-raycast-sensor) but this sensor does not have any of the intensity, dropoff or noise features and its output is more complete.
The points are computed by adding a laser for each channel distributed in the vertical FOV. The rotation is simulated computing the horizontal angle that the Lidar rotated in a frame. The point cloud is calculated by doing a ray-cast for each laser in every step:
`points_per_channel_each_step = points_per_second / (FPS * channels)`
A Lidar measurement contains a packet with all the points generated during a `1/FPS` interval. During this interval the physics are not updated so all the points in a measurement reflect the same "static picture" of the scene.
This output contains a cloud of lidar semantic detections and therefore, it can be iterated to retrieve a list of their [`carla.SemanticLidarDetection`](python_api.md#carla.SemanticLidarDetection):
```py
for detection in semantic_lidar_measurement:
print(detection)
```
The rotation of the LIDAR can be tuned to cover a specific angle on every simulation step (using a [fixed time-step](adv_synchrony_timestep.md)). For example, to rotate once per step (full circle output, as in the picture below), the rotation frequency and the simulated FPS should be equal. <br> __1.__ Set the sensor's frequency `sensors_bp['lidar'][0].set_attribute('rotation_frequency','10')`. <br> __2.__ Run the simulation using `python config.py --fps=10`.
![LidarPointCloud](img/semantic_lidar_point_cloud.png)
#### SemanticLidar attributes
<table class ="defTable">
<thead>
<th>Blueprint attribute</th>
<th>Type</th>
<th>Default</th>
<th>Description</th>
</thead>
<tbody>
<td>
<code>channels</code> </td>
<td>int</td>
<td>32</td>
<td>Number of lasers.</td>
<tr>
<td><code>range</code></td>
<td>float</td>
<td>10.0</td>
<td>Maximum distance to measure/raycast in meters (centimeters for CARLA 0.9.6 or previous).</td>
<tr>
<td><code>points_per_second</code></td>
<td>int</td>
<td>56000</td>
<td>Points generated by all lasers per second.</td>
<tr>
<td><code>rotation_frequency</code></td>
<td>float</td>
<td>10.0</td>
<td>Lidar rotation frequency.</td>
<tr>
<td><code>upper_fov</code></td>
<td>float</td>
<td>10.0</td>
<td>Angle in degrees of the highest laser.</td>
<tr>
<td><code>lower_fov</code></td>
<td>float</td>
<td>-30.0</td>
<td>Angle in degrees of the lowest laser.</td>
<tr>
<td><code>sensor_tick</code></td>
<td>float</td>
<td>0.0</td>
<td>Simulation seconds between sensor captures (ticks).</td>
</tbody>
</table>
<br>
#### Output attributes
<table class ="defTable">
<thead>
<th>Sensor data attribute</th>
<th>Type</th>
<th>Description</th>
</thead>
<tbody>
<td>
<code>frame</code> </td>
<td>int</td>
<td>Frame number when the measurement took place.</td>
<tr>
<td><code>timestamp</code></td>
<td>double</td>
<td>Simulation time of the measurement in seconds since the beginning of the episode.</td>
<tr>
<td><code>transform</code></td>
<td><a href="../python_api#carlatransform">carla.Transform</a></td>
<td>Location and rotation in world coordinates of the sensor at the time of the measurement.</td>
<tr>
<td><code>horizontal_angle</code></td>
<td>float</td>
<td>Angle (radians) in the XY plane of the lidar this frame.</td>
<tr>
<td><code>channels</code></td>
<td>int</td>
<td>Number of channels (lasers) of the lidar.</td>
<tr>
<td><code>get_point_count(channel)</code></td>
<td>int</td>
<td>Number of points per channel captured this frame.</td>
<tr>
<td><code>raw_data</code></td>
<td>bytes</td>
<td>Array that can be transform into semantic detections, each of them have four 32-bits floats (XYZ of each point and consine of the incident angle) and two unsigned int (idx of the hitted actor and its semantic tag).</td>
</tbody>
</table>
---
## Obstacle detector
@ -1410,6 +1298,134 @@ def _on_actor_constellation_request(self, actor_constellation_data):
return actor_constellation_result
```
---
## Semantic LIDAR sensor
* __Blueprint:__ sensor.lidar.ray_cast_semantic
* __Output:__ [carla.SemanticLidarMeasurement](python_api.md#carla.SemanticLidarMeasurement) per step (unless `sensor_tick` says otherwise).
This sensor simulates a rotating LIDAR implemented using ray-casting that exposes all the information about the raycast hit. Its behaviour is quite similar to the [LIDAR sensor](#lidar-sensor), but there are two main differences between them.
* The raw data retrieved by the semantic LIDAR includes more data per point.
* Coordinates of the point (as the normal LIDAR does).
* The cosine between the angle of incidence and the normal of the surface hit.
* Instance and semantic ground-truth. Basically the index of the CARLA object hit, and its semantic tag.
* The semantic LIDAR does not include neither intensity, drop-off nor noise model attributes.
The points are computed by adding a laser for each channel distributed in the vertical FOV. The rotation is simulated computing the horizontal angle that the LIDAR rotated in a frame. The point cloud is calculated by doing a ray-cast for each laser in every step.
```sh
points_per_channel_each_step = points_per_second / (FPS * channels)
```
A LIDAR measurement contains a package with all the points generated during a `1/FPS` interval. During this interval the physics are not updated so all the points in a measurement reflect the same "static picture" of the scene.
This output contains a cloud of lidar semantic detections and therefore, it can be iterated to retrieve a list of their [`carla.SemanticLidarDetection`](python_api.md#carla.SemanticLidarDetection):
```py
for detection in semantic_lidar_measurement:
print(detection)
```
The rotation of the LIDAR can be tuned to cover a specific angle on every simulation step (using a [fixed time-step](adv_synchrony_timestep.md)). For example, to rotate once per step (full circle output, as in the picture below), the rotation frequency and the simulated FPS should be equal. <br>
__1.__ Set the sensor's frequency `sensors_bp['lidar'][0].set_attribute('rotation_frequency','10')`. <br>
__2.__ Run the simulation using `python config.py --fps=10`.
![LidarPointCloud](img/semantic_lidar_point_cloud.jpg)
#### SemanticLidar attributes
<table class ="defTable">
<thead>
<th>Blueprint attribute</th>
<th>Type</th>
<th>Default</th>
<th>Description</th>
</thead>
<tbody>
<td>
<code>channels</code> </td>
<td>int</td>
<td>32</td>
<td>Number of lasers.</td>
<tr>
<td><code>range</code></td>
<td>float</td>
<td>10.0</td>
<td>Maximum distance to measure/raycast in meters (centimeters for CARLA 0.9.6 or previous).</td>
<tr>
<td><code>points_per_second</code></td>
<td>int</td>
<td>56000</td>
<td>Points generated by all lasers per second.</td>
<tr>
<td><code>rotation_frequency</code></td>
<td>float</td>
<td>10.0</td>
<td>LIDAR rotation frequency.</td>
<tr>
<td><code>upper_fov</code></td>
<td>float</td>
<td>10.0</td>
<td>Angle in degrees of the highest laser.</td>
<tr>
<td><code>lower_fov</code></td>
<td>float</td>
<td>-30.0</td>
<td>Angle in degrees of the lowest laser.</td>
<tr>
<td><code>sensor_tick</code></td>
<td>float</td>
<td>0.0</td>
<td>Simulation seconds between sensor captures (ticks).</td>
</tbody>
</table>
<br>
#### Output attributes
<table class ="defTable">
<thead>
<th>Sensor data attribute</th>
<th>Type</th>
<th>Description</th>
</thead>
<tbody>
<td>
<code>frame</code> </td>
<td>int</td>
<td>Frame number when the measurement took place.</td>
<tr>
<td><code>timestamp</code></td>
<td>double</td>
<td>Simulation time of the measurement in seconds since the beginning of the episode.</td>
<tr>
<td><code>transform</code></td>
<td><a href="../python_api#carlatransform">carla.Transform</a></td>
<td>Location and rotation in world coordinates of the sensor at the time of the measurement.</td>
<tr>
<td><code>horizontal_angle</code></td>
<td>float</td>
<td>Angle (radians) in the XY plane of the LIDAR in the current frame.</td>
<tr>
<td><code>channels</code></td>
<td>int</td>
<td>Number of channels (lasers) of the LIDAR.</td>
<tr>
<td><code>get_point_count(channel)</code></td>
<td>int</td>
<td>Number of points per channel captured in the current frame.</td>
<tr>
<td><code>raw_data</code></td>
<td>bytes</td>
<td>Array containing the point cloud with instance and semantic information. For each point, four 32-bits floats are stored. <br>
- XYZ coordinates. <br>
- cosine of the incident angle. <br>
- Unsigned int containing the index of the object hit. <br>
- Unsigned int containing the semantic tag of the object it.
</tbody>
</table>
---
## Semantic segmentation camera

View File

@ -8,14 +8,14 @@
Base class for all the objects containing data generated by a carla.Sensor. This objects should be the argument of the function said sensor is listening to, in order to work with them. Each of these sensors needs for a specific type of sensor data. Hereunder is a list of the sensors and their corresponding data.
- Cameras (RGB, depth and semantic segmentation): carla.Image.
- Collision detector: carla.CollisionEvent.
- Gnss detector: carla.GnssMeasurement.
- IMU detector: carla.IMUMeasurement.
- GNSS sensor: carla.GnssMeasurement.
- IMU sensor: carla.IMUMeasurement.
- Lane invasion detector: carla.LaneInvasionEvent.
- Lidar raycast: carla.LidarMeasurement.
- SemanticLidar raycast: carla.SemanticLidarMeasurement.
- LIDAR sensor: carla.LidarMeasurement.
- Obstacle detector: carla.ObstacleDetectionEvent.
- Radar detector: carla.RadarMeasurement.
- Radar sensor: carla.RadarMeasurement.
- RSS sensor: carla.RssResponse.
- Semantic LIDAR sensor: carla.SemanticLidarMeasurement.
# - PROPERTIES -------------------------
instance_variables:
- var_name: frame
@ -118,7 +118,7 @@
parent: carla.SensorData
# - DESCRIPTION ------------------------
doc: >
Class that defines the lidar data retrieved by a <b>sensor.lidar.ray_cast</b>. This essentially simulates a rotating lidar using ray-casting. Learn more about this [here](ref_sensors.md#lidar-raycast-sensor).
Class that defines the LIDAR data retrieved by a <b>sensor.lidar.ray_cast</b>. This essentially simulates a rotating LIDAR using ray-casting. Learn more about this [here](ref_sensors.md#lidar-raycast-sensor).
# - PROPERTIES -------------------------
instance_variables:
- var_name: channels
@ -128,11 +128,11 @@
- var_name: horizontal_angle
type: float
doc: >
Horizontal angle the Lidar is rotated at the time of the measurement (in radians).
Horizontal angle the LIDAR is rotated at the time of the measurement (in radians).
- var_name: raw_data
type: bytes
doc: >
Received list of 4D points. Each point consists in a 3D-xyz data plus the intensity computed for that point.
Received list of 4D points. Each point consists of [x,y,z] coordiantes plus the intensity computed for that point.
# - METHODS ----------------------------
methods:
- def_name: save_to_disk
@ -192,7 +192,7 @@
parent: carla.SensorData
# - DESCRIPTION ------------------------
doc: >
Class that defines the semantic lidar data retrieved by a <b>sensor.lidar.ray_cast_semantic</b>. This essentially simulates a rotating lidar using ray-casting. Learn more about this [here](ref_sensors.md#semanticlidar-raycast-sensor).
Class that defines the semantic LIDAR data retrieved by a <b>sensor.lidar.ray_cast_semantic</b>. This essentially simulates a rotating LIDAR using ray-casting. Learn more about this [here](ref_sensors.md#semanticlidar-raycast-sensor).
# - PROPERTIES -------------------------
instance_variables:
- var_name: channels
@ -202,11 +202,11 @@
- var_name: horizontal_angle
type: float
doc: >
Horizontal angle the Lidar is rotated at the time of the measurement (in radians).
Horizontal angle the LIDAR is rotated at the time of the measurement (in radians).
- var_name: raw_data
type: bytes
doc: >
Received list of raw detection points. Each point consists in a 3D-xyz data plus cosine of the incident angle, the idx of the hit actor and its semantic tag.
Received list of raw detection points. Each point consists of [x,y,z] coordinates plus the cosine of the incident angle, the index of the hit actor, and its semantic tag.
# - METHODS ----------------------------
methods:
- def_name: save_to_disk
@ -214,7 +214,7 @@
- param_name: path
type: str
doc: >
Saves the point cloud to disk as a <b>.ply</b> file describing data from 3D scanners. The files generated are ready to be used within [MeshLab](http://www.meshlab.net/), an open source system for processing said files. Just take into account that axis may differ from Unreal Engine and so, need to be reallocated.
Saves the point cloud to disk as a <b>.ply</b> file describing data from 3D scanners. The files generated are ready to be used within [MeshLab](http://www.meshlab.net/), an open-source system for processing said files. Just take into account that axis may differ from Unreal Engine and so, need to be reallocated.
# --------------------------------------
- def_name: get_point_count
params:
@ -245,28 +245,28 @@
- class_name: SemanticLidarDetection
# - DESCRIPTION ------------------------
doc: >
Data contained inside a carla.SemanticLidarMeasurement. Each of these represents one of the points in the cloud with its location and its asociated intensity.
Data contained inside a carla.SemanticLidarMeasurement. Each of these represents one of the points in the cloud with its location, the cosine of the incident angle, index of the object hit, and its semantic tag.
# - PROPERTIES -------------------------
instance_variables:
- var_name: point
type: carla.Location
doc: >
Point in xyz coordinates.
[x,y,z] coordinates of the point.
# --------------------------------------
- var_name: cos_inc_angle
type: float
doc: >
Cosine of the incident angle between the ray and the normal of the hit object.
Cosine of the incident angle between the ray, and the normal of the hit object.
# --------------------------------------
- var_name: object_idx
type: uint
doc: >
Carla index of the hitted actor.
Carla index of the hit actor.
# --------------------------------------
- var_name: object_tag
type: uint
doc: >
Semantic tag of the hitted component.
Semantic tag of the hit component.
# - METHODS ----------------------------
methods:
- def_name: __str__