Added mds

This commit is contained in:
doterop 2020-12-17 13:00:57 +01:00 committed by bernat
parent ad9c80b559
commit 84f128db3b
2 changed files with 256 additions and 145 deletions

View File

@ -147,7 +147,9 @@ Check out the [introduction to blueprints](core_actors.md).
- `dropoff_general_rate` (_Float_)<sub>_ Modifiable_</sub> - `dropoff_general_rate` (_Float_)<sub>_ Modifiable_</sub>
- `dropoff_intensity_limit` (_Float_)<sub>_ Modifiable_</sub> - `dropoff_intensity_limit` (_Float_)<sub>_ Modifiable_</sub>
- `dropoff_zero_intensity` (_Float_)<sub>_ Modifiable_</sub> - `dropoff_zero_intensity` (_Float_)<sub>_ Modifiable_</sub>
- `horizontal_fov` (_Float_)<sub>_ Modifiable_</sub>
- `lower_fov` (_Float_)<sub>_ Modifiable_</sub> - `lower_fov` (_Float_)<sub>_ Modifiable_</sub>
- `noise_seed` (_Int_)<sub>_ Modifiable_</sub>
- `noise_stddev` (_Float_)<sub>_ Modifiable_</sub> - `noise_stddev` (_Float_)<sub>_ Modifiable_</sub>
- `points_per_second` (_Int_)<sub>_ Modifiable_</sub> - `points_per_second` (_Int_)<sub>_ Modifiable_</sub>
- `range` (_Float_)<sub>_ Modifiable_</sub> - `range` (_Float_)<sub>_ Modifiable_</sub>
@ -158,6 +160,7 @@ Check out the [introduction to blueprints](core_actors.md).
- **<font color="#498efc">sensor.lidar.ray_cast_semantic</font>** - **<font color="#498efc">sensor.lidar.ray_cast_semantic</font>**
- **Attributes:** - **Attributes:**
- `channels` (_Int_)<sub>_ Modifiable_</sub> - `channels` (_Int_)<sub>_ Modifiable_</sub>
- `horizontal_fov` (_Float_)<sub>_ Modifiable_</sub>
- `lower_fov` (_Float_)<sub>_ Modifiable_</sub> - `lower_fov` (_Float_)<sub>_ Modifiable_</sub>
- `points_per_second` (_Int_)<sub>_ Modifiable_</sub> - `points_per_second` (_Int_)<sub>_ Modifiable_</sub>
- `range` (_Float_)<sub>_ Modifiable_</sub> - `range` (_Float_)<sub>_ Modifiable_</sub>
@ -207,6 +210,7 @@ Check out the [introduction to blueprints](core_actors.md).
- **<font color="#498efc">sensor.other.radar</font>** - **<font color="#498efc">sensor.other.radar</font>**
- **Attributes:** - **Attributes:**
- `horizontal_fov` (_Float_)<sub>_ Modifiable_</sub> - `horizontal_fov` (_Float_)<sub>_ Modifiable_</sub>
- `noise_seed` (_Int_)<sub>_ Modifiable_</sub>
- `points_per_second` (_Int_)<sub>_ Modifiable_</sub> - `points_per_second` (_Int_)<sub>_ Modifiable_</sub>
- `range` (_Float_)<sub>_ Modifiable_</sub> - `range` (_Float_)<sub>_ Modifiable_</sub>
- `role_name` (_String_)<sub>_ Modifiable_</sub> - `role_name` (_String_)<sub>_ Modifiable_</sub>
@ -249,10 +253,6 @@ Check out the [introduction to blueprints](core_actors.md).
- **Attributes:** - **Attributes:**
- `role_name` (_String_)<sub>_ Modifiable_</sub> - `role_name` (_String_)<sub>_ Modifiable_</sub>
- `size` (_String_) - `size` (_String_)
- **<font color="#498efc">static.prop.bikeparking</font>**
- **Attributes:**
- `role_name` (_String_)<sub>_ Modifiable_</sub>
- `size` (_String_)
- **<font color="#498efc">static.prop.bin</font>** - **<font color="#498efc">static.prop.bin</font>**
- **Attributes:** - **Attributes:**
- `role_name` (_String_)<sub>_ Modifiable_</sub> - `role_name` (_String_)<sub>_ Modifiable_</sub>
@ -293,6 +293,10 @@ Check out the [introduction to blueprints](core_actors.md).
- **Attributes:** - **Attributes:**
- `role_name` (_String_)<sub>_ Modifiable_</sub> - `role_name` (_String_)<sub>_ Modifiable_</sub>
- `size` (_String_) - `size` (_String_)
- **<font color="#498efc">static.prop.calibrator</font>**
- **Attributes:**
- `role_name` (_String_)<sub>_ Modifiable_</sub>
- `size` (_String_)
- **<font color="#498efc">static.prop.chainbarrier</font>** - **<font color="#498efc">static.prop.chainbarrier</font>**
- **Attributes:** - **Attributes:**
- `role_name` (_String_)<sub>_ Modifiable_</sub> - `role_name` (_String_)<sub>_ Modifiable_</sub>
@ -409,6 +413,9 @@ Check out the [introduction to blueprints](core_actors.md).
- **Attributes:** - **Attributes:**
- `role_name` (_String_)<sub>_ Modifiable_</sub> - `role_name` (_String_)<sub>_ Modifiable_</sub>
- `size` (_String_) - `size` (_String_)
- **<font color="#498efc">static.prop.mesh</font>**
- **Attributes:**
- `role_name` (_String_)<sub>_ Modifiable_</sub>
- **<font color="#498efc">static.prop.mobile</font>** - **<font color="#498efc">static.prop.mobile</font>**
- **Attributes:** - **Attributes:**
- `role_name` (_String_)<sub>_ Modifiable_</sub> - `role_name` (_String_)<sub>_ Modifiable_</sub>
@ -473,10 +480,6 @@ Check out the [introduction to blueprints](core_actors.md).
- **Attributes:** - **Attributes:**
- `role_name` (_String_)<sub>_ Modifiable_</sub> - `role_name` (_String_)<sub>_ Modifiable_</sub>
- `size` (_String_) - `size` (_String_)
- **<font color="#498efc">static.prop.shop01</font>**
- **Attributes:**
- `role_name` (_String_)<sub>_ Modifiable_</sub>
- `size` (_String_)
- **<font color="#498efc">static.prop.shoppingbag</font>** - **<font color="#498efc">static.prop.shoppingbag</font>**
- **Attributes:** - **Attributes:**
- `role_name` (_String_)<sub>_ Modifiable_</sub> - `role_name` (_String_)<sub>_ Modifiable_</sub>
@ -636,6 +639,20 @@ Check out the [introduction to blueprints](core_actors.md).
- `object_type` (_String_) - `object_type` (_String_)
- `role_name` (_String_)<sub>_ Modifiable_</sub> - `role_name` (_String_)<sub>_ Modifiable_</sub>
- `sticky_control` (_Bool_)<sub>_ Modifiable_</sub> - `sticky_control` (_Bool_)<sub>_ Modifiable_</sub>
- **<font color="#498efc">vehicle.charger2020.charger2020</font>**
- **Attributes:**
- `color` (_RGBColor_)<sub>_ Modifiable_</sub>
- `number_of_wheels` (_Int_)
- `object_type` (_String_)
- `role_name` (_String_)<sub>_ Modifiable_</sub>
- `sticky_control` (_Bool_)<sub>_ Modifiable_</sub>
- **<font color="#498efc">vehicle.chargercop2020.chargercop2020</font>**
- **Attributes:**
- `color` (_RGBColor_)<sub>_ Modifiable_</sub>
- `number_of_wheels` (_Int_)
- `object_type` (_String_)
- `role_name` (_String_)<sub>_ Modifiable_</sub>
- `sticky_control` (_Bool_)<sub>_ Modifiable_</sub>
- **<font color="#498efc">vehicle.chevrolet.impala</font>** - **<font color="#498efc">vehicle.chevrolet.impala</font>**
- **Attributes:** - **Attributes:**
- `color` (_RGBColor_)<sub>_ Modifiable_</sub> - `color` (_RGBColor_)<sub>_ Modifiable_</sub>
@ -703,6 +720,14 @@ Check out the [introduction to blueprints](core_actors.md).
- `object_type` (_String_) - `object_type` (_String_)
- `role_name` (_String_)<sub>_ Modifiable_</sub> - `role_name` (_String_)<sub>_ Modifiable_</sub>
- `sticky_control` (_Bool_)<sub>_ Modifiable_</sub> - `sticky_control` (_Bool_)<sub>_ Modifiable_</sub>
- **<font color="#498efc">vehicle.lincoln2020.mkz2020</font>**
- **Attributes:**
- `color` (_RGBColor_)<sub>_ Modifiable_</sub>
- `driver_id` (_Int_)<sub>_ Modifiable_</sub>
- `number_of_wheels` (_Int_)
- `object_type` (_String_)
- `role_name` (_String_)<sub>_ Modifiable_</sub>
- `sticky_control` (_Bool_)<sub>_ Modifiable_</sub>
- **<font color="#498efc">vehicle.mercedes-benz.coupe</font>** - **<font color="#498efc">vehicle.mercedes-benz.coupe</font>**
- **Attributes:** - **Attributes:**
- `color` (_RGBColor_)<sub>_ Modifiable_</sub> - `color` (_RGBColor_)<sub>_ Modifiable_</sub>
@ -710,6 +735,13 @@ Check out the [introduction to blueprints](core_actors.md).
- `object_type` (_String_) - `object_type` (_String_)
- `role_name` (_String_)<sub>_ Modifiable_</sub> - `role_name` (_String_)<sub>_ Modifiable_</sub>
- `sticky_control` (_Bool_)<sub>_ Modifiable_</sub> - `sticky_control` (_Bool_)<sub>_ Modifiable_</sub>
- **<font color="#498efc">vehicle.mercedesccc.mercedesccc</font>**
- **Attributes:**
- `color` (_RGBColor_)<sub>_ Modifiable_</sub>
- `number_of_wheels` (_Int_)
- `object_type` (_String_)
- `role_name` (_String_)<sub>_ Modifiable_</sub>
- `sticky_control` (_Bool_)<sub>_ Modifiable_</sub>
- **<font color="#498efc">vehicle.mini.cooperst</font>** - **<font color="#498efc">vehicle.mini.cooperst</font>**
- **Attributes:** - **Attributes:**
- `color` (_RGBColor_)<sub>_ Modifiable_</sub> - `color` (_RGBColor_)<sub>_ Modifiable_</sub>
@ -887,3 +919,80 @@ Check out the [introduction to blueprints](core_actors.md).
- `is_invincible` (_Bool_)<sub>_ Modifiable_</sub> - `is_invincible` (_Bool_)<sub>_ Modifiable_</sub>
- `role_name` (_String_)<sub>_ Modifiable_</sub> - `role_name` (_String_)<sub>_ Modifiable_</sub>
- `speed` (_Float_)<sub>_ Modifiable_</sub> - `speed` (_Float_)<sub>_ Modifiable_</sub>
- **<font color="#498efc">walker.pedestrian.0016</font>**
- **Attributes:**
- `age` (_String_)
- `gender` (_String_)
- `is_invincible` (_Bool_)<sub>_ Modifiable_</sub>
- `role_name` (_String_)<sub>_ Modifiable_</sub>
- `speed` (_Float_)<sub>_ Modifiable_</sub>
- **<font color="#498efc">walker.pedestrian.0017</font>**
- **Attributes:**
- `age` (_String_)
- `gender` (_String_)
- `is_invincible` (_Bool_)<sub>_ Modifiable_</sub>
- `role_name` (_String_)<sub>_ Modifiable_</sub>
- `speed` (_Float_)<sub>_ Modifiable_</sub>
- **<font color="#498efc">walker.pedestrian.0018</font>**
- **Attributes:**
- `age` (_String_)
- `gender` (_String_)
- `is_invincible` (_Bool_)<sub>_ Modifiable_</sub>
- `role_name` (_String_)<sub>_ Modifiable_</sub>
- `speed` (_Float_)<sub>_ Modifiable_</sub>
- **<font color="#498efc">walker.pedestrian.0019</font>**
- **Attributes:**
- `age` (_String_)
- `gender` (_String_)
- `is_invincible` (_Bool_)<sub>_ Modifiable_</sub>
- `role_name` (_String_)<sub>_ Modifiable_</sub>
- `speed` (_Float_)<sub>_ Modifiable_</sub>
- **<font color="#498efc">walker.pedestrian.0020</font>**
- **Attributes:**
- `age` (_String_)
- `gender` (_String_)
- `is_invincible` (_Bool_)<sub>_ Modifiable_</sub>
- `role_name` (_String_)<sub>_ Modifiable_</sub>
- `speed` (_Float_)<sub>_ Modifiable_</sub>
- **<font color="#498efc">walker.pedestrian.0021</font>**
- **Attributes:**
- `age` (_String_)
- `gender` (_String_)
- `is_invincible` (_Bool_)<sub>_ Modifiable_</sub>
- `role_name` (_String_)<sub>_ Modifiable_</sub>
- `speed` (_Float_)<sub>_ Modifiable_</sub>
- **<font color="#498efc">walker.pedestrian.0022</font>**
- **Attributes:**
- `age` (_String_)
- `gender` (_String_)
- `is_invincible` (_Bool_)<sub>_ Modifiable_</sub>
- `role_name` (_String_)<sub>_ Modifiable_</sub>
- `speed` (_Float_)<sub>_ Modifiable_</sub>
- **<font color="#498efc">walker.pedestrian.0023</font>**
- **Attributes:**
- `age` (_String_)
- `gender` (_String_)
- `is_invincible` (_Bool_)<sub>_ Modifiable_</sub>
- `role_name` (_String_)<sub>_ Modifiable_</sub>
- `speed` (_Float_)<sub>_ Modifiable_</sub>
- **<font color="#498efc">walker.pedestrian.0024</font>**
- **Attributes:**
- `age` (_String_)
- `gender` (_String_)
- `is_invincible` (_Bool_)<sub>_ Modifiable_</sub>
- `role_name` (_String_)<sub>_ Modifiable_</sub>
- `speed` (_Float_)<sub>_ Modifiable_</sub>
- **<font color="#498efc">walker.pedestrian.0025</font>**
- **Attributes:**
- `age` (_String_)
- `gender` (_String_)
- `is_invincible` (_Bool_)<sub>_ Modifiable_</sub>
- `role_name` (_String_)<sub>_ Modifiable_</sub>
- `speed` (_Float_)<sub>_ Modifiable_</sub>
- **<font color="#498efc">walker.pedestrian.0026</font>**
- **Attributes:**
- `age` (_String_)
- `gender` (_String_)
- `is_invincible` (_Bool_)<sub>_ Modifiable_</sub>
- `role_name` (_String_)<sub>_ Modifiable_</sub>
- `speed` (_Float_)<sub>_ Modifiable_</sub>

View File

@ -2865,6 +2865,8 @@ States the synchrony between client and server. When set to true, the server wil
When enabled, the simulation will run no rendering at all. This is mainly used to avoid overhead during heavy traffic simulations. It is false by default. When enabled, the simulation will run no rendering at all. This is mainly used to avoid overhead during heavy traffic simulations. It is false by default.
- <a name="carla.WorldSettings.fixed_delta_seconds"></a>**<font color="#f8805a">fixed_delta_seconds</font>** (_float_) - <a name="carla.WorldSettings.fixed_delta_seconds"></a>**<font color="#f8805a">fixed_delta_seconds</font>** (_float_)
Ensures that the time elapsed between two steps of the simulation is fixed. Set this to <b>0.0</b> to work with a variable time-step, as happens by default. Ensures that the time elapsed between two steps of the simulation is fixed. Set this to <b>0.0</b> to work with a variable time-step, as happens by default.
- <a name="carla.WorldSettings.max_culling_distance"></a>**<font color="#f8805a">max_culling_distance</font>** (_float_)
Configure the max draw distance for each mesh of the level.
- <a name="carla.WorldSettings.deterministic_ragdolls"></a>**<font color="#f8805a">deterministic_ragdolls</font>** (_bool_) - <a name="carla.WorldSettings.deterministic_ragdolls"></a>**<font color="#f8805a">deterministic_ragdolls</font>** (_bool_)
Defines wether to use deterministic physics for pedestrian death animations or physical ragdoll simulation. When enabled, pedestrians have less realistic death animation but ensures determinism. When disabled, pedestrians are simulated as ragdolls with more realistic simulation and collision but no determinsm can be ensured. Defines wether to use deterministic physics for pedestrian death animations or physical ragdoll simulation. When enabled, pedestrians have less realistic death animation but ensures determinism. When disabled, pedestrians are simulated as ragdolls with more realistic simulation and collision but no determinsm can be ensured.
@ -3236,40 +3238,6 @@ document.getElementById("snipets-container").innerHTML = null;
} }
</script> </script>
<div id ="carla.ActorBlueprint.set_attribute-snipet" style="display: none;">
<p class="SnipetFont">
Snipet for carla.ActorBlueprint.set_attribute
</p>
<div id="carla.ActorBlueprint.set_attribute-code" class="SnipetContent">
```py
# This recipe changes attributes of different type of blueprint actors.
# ...
walker_bp = world.get_blueprint_library().filter('walker.pedestrian.0002')
walker_bp.set_attribute('is_invincible', True)
# ...
# Changes attribute randomly by the recommended value
vehicle_bp = wolrd.get_blueprint_library().filter('vehicle.bmw.*')
color = random.choice(vehicle_bp.get_attribute('color').recommended_values)
vehicle_bp.set_attribute('color', color)
# ...
camera_bp = world.get_blueprint_library().filter('sensor.camera.rgb')
camera_bp.set_attribute('image_size_x', 600)
camera_bp.set_attribute('image_size_y', 600)
# ...
```
<button id="button1" class="CopyScript" onclick="CopyToClipboard('carla.ActorBlueprint.set_attribute-code')">Copy snipet</button>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<button id="button1" class="CloseSnipet" onclick="CloseSnipet()">Close snipet</button><br><br>
</div>
<div id ="carla.Client.apply_batch_sync-snipet" style="display: none;"> <div id ="carla.Client.apply_batch_sync-snipet" style="display: none;">
<p class="SnipetFont"> <p class="SnipetFont">
Snipet for carla.Client.apply_batch_sync Snipet for carla.Client.apply_batch_sync
@ -3343,30 +3311,6 @@ for i in range(0, len(all_actors), 2):
</div> </div>
<div id ="carla.WalkerAIController.stop-snipet" style="display: none;">
<p class="SnipetFont">
Snipet for carla.WalkerAIController.stop
</p>
<div id="carla.WalkerAIController.stop-code" class="SnipetContent">
```py
#To destroy the pedestrians, stop them from the navigation, and then destroy the objects (actor and controller).
# stop pedestrians (list is [controller, actor, controller, actor ...])
for i in range(0, len(all_id), 2):
all_actors[i].stop()
# destroy pedestrian (actor and controller)
client.apply_batch([carla.command.DestroyActor(x) for x in all_id])
```
<button id="button1" class="CopyScript" onclick="CopyToClipboard('carla.WalkerAIController.stop-code')">Copy snipet</button>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<button id="button1" class="CloseSnipet" onclick="CloseSnipet()">Close snipet</button><br><br>
</div>
<div id ="carla.Map.get_waypoint-snipet" style="display: none;"> <div id ="carla.Map.get_waypoint-snipet" style="display: none;">
<p class="SnipetFont"> <p class="SnipetFont">
Snipet for carla.Map.get_waypoint Snipet for carla.Map.get_waypoint
@ -3400,6 +3344,89 @@ print("R lane marking change: " + str(waypoint.right_lane_marking.lane_change))
</div> </div>
<div id ="carla.WalkerAIController.stop-snipet" style="display: none;">
<p class="SnipetFont">
Snipet for carla.WalkerAIController.stop
</p>
<div id="carla.WalkerAIController.stop-code" class="SnipetContent">
```py
#To destroy the pedestrians, stop them from the navigation, and then destroy the objects (actor and controller).
# stop pedestrians (list is [controller, actor, controller, actor ...])
for i in range(0, len(all_id), 2):
all_actors[i].stop()
# destroy pedestrian (actor and controller)
client.apply_batch([carla.command.DestroyActor(x) for x in all_id])
```
<button id="button1" class="CopyScript" onclick="CopyToClipboard('carla.WalkerAIController.stop-code')">Copy snipet</button>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<button id="button1" class="CloseSnipet" onclick="CloseSnipet()">Close snipet</button><br><br>
</div>
<div id ="carla.Sensor.listen-snipet" style="display: none;">
<p class="SnipetFont">
Snipet for carla.Sensor.listen
</p>
<div id="carla.Sensor.listen-code" class="SnipetContent">
```py
# This recipe applies a color conversion to the image taken by a camera sensor,
# so it is converted to a semantic segmentation image.
# ...
camera_bp = world.get_blueprint_library().filter('sensor.camera.semantic_segmentation')
# ...
cc = carla.ColorConverter.CityScapesPalette
camera.listen(lambda image: image.save_to_disk('output/%06d.png' % image.frame, cc))
# ...
```
<button id="button1" class="CopyScript" onclick="CopyToClipboard('carla.Sensor.listen-code')">Copy snipet</button>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<button id="button1" class="CloseSnipet" onclick="CloseSnipet()">Close snipet</button><br><br>
</div>
<div id ="carla.ActorBlueprint.set_attribute-snipet" style="display: none;">
<p class="SnipetFont">
Snipet for carla.ActorBlueprint.set_attribute
</p>
<div id="carla.ActorBlueprint.set_attribute-code" class="SnipetContent">
```py
# This recipe changes attributes of different type of blueprint actors.
# ...
walker_bp = world.get_blueprint_library().filter('walker.pedestrian.0002')
walker_bp.set_attribute('is_invincible', True)
# ...
# Changes attribute randomly by the recommended value
vehicle_bp = wolrd.get_blueprint_library().filter('vehicle.bmw.*')
color = random.choice(vehicle_bp.get_attribute('color').recommended_values)
vehicle_bp.set_attribute('color', color)
# ...
camera_bp = world.get_blueprint_library().filter('sensor.camera.rgb')
camera_bp.set_attribute('image_size_x', 600)
camera_bp.set_attribute('image_size_y', 600)
# ...
```
<button id="button1" class="CopyScript" onclick="CopyToClipboard('carla.ActorBlueprint.set_attribute-code')">Copy snipet</button>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<button id="button1" class="CloseSnipet" onclick="CloseSnipet()">Close snipet</button><br><br>
</div>
<div id ="carla.DebugHelper.draw_line-snipet" style="display: none;"> <div id ="carla.DebugHelper.draw_line-snipet" style="display: none;">
<p class="SnipetFont"> <p class="SnipetFont">
Snipet for carla.DebugHelper.draw_line Snipet for carla.DebugHelper.draw_line
@ -3442,52 +3469,6 @@ while True:
</div> </div>
<div id ="carla.TrafficLight.set_state-snipet" style="display: none;">
<p class="SnipetFont">
Snipet for carla.TrafficLight.set_state
</p>
<div id="carla.TrafficLight.set_state-code" class="SnipetContent">
```py
# This recipe changes from red to green the traffic light that affects the vehicle.
# This is done by detecting if the vehicle actor is at a traffic light.
# ...
world = client.get_world()
spectator = world.get_spectator()
vehicle_bp = random.choice(world.get_blueprint_library().filter('vehicle.bmw.*'))
transform = random.choice(world.get_map().get_spawn_points())
vehicle = world.try_spawn_actor(vehicle_bp, transform)
# Wait for world to get the vehicle actor
world.tick()
world_snapshot = world.wait_for_tick()
actor_snapshot = world_snapshot.find(vehicle.id)
# Set spectator at given transform (vehicle transform)
spectator.set_transform(actor_snapshot.get_transform())
# ...# ...
if vehicle_actor.is_at_traffic_light():
traffic_light = vehicle_actor.get_traffic_light()
if traffic_light.get_state() == carla.TrafficLightState.Red:
# world.hud.notification("Traffic light changed! Good to go!")
traffic_light.set_state(carla.TrafficLightState.Green)
# ...
```
<button id="button1" class="CopyScript" onclick="CopyToClipboard('carla.TrafficLight.set_state-code')">Copy snipet</button>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<button id="button1" class="CloseSnipet" onclick="CloseSnipet()">Close snipet</button><br><br>
<img src="/img/snipets_images/carla.TrafficLight.set_state.gif">
</div>
<div id ="carla.DebugHelper.draw_box-snipet" style="display: none;"> <div id ="carla.DebugHelper.draw_box-snipet" style="display: none;">
<p class="SnipetFont"> <p class="SnipetFont">
Snipet for carla.DebugHelper.draw_box Snipet for carla.DebugHelper.draw_box
@ -3519,6 +3500,31 @@ for actor_snapshot in world_snapshot:
</div> </div>
<div id ="carla.World.spawn_actor-snipet" style="display: none;">
<p class="SnipetFont">
Snipet for carla.World.spawn_actor
</p>
<div id="carla.World.spawn_actor-code" class="SnipetContent">
```py
# This recipe attaches different camera / sensors to a vehicle with different attachments.
# ...
camera = world.spawn_actor(rgb_camera_bp, transform, attach_to=vehicle, attachment_type=Attachment.Rigid)
# Default attachment: Attachment.Rigid
gnss_sensor = world.spawn_actor(sensor_gnss_bp, transform, attach_to=vehicle)
collision_sensor = world.spawn_actor(sensor_collision_bp, transform, attach_to=vehicle)
lane_invasion_sensor = world.spawn_actor(sensor_lane_invasion_bp, transform, attach_to=vehicle)
# ...
```
<button id="button1" class="CopyScript" onclick="CopyToClipboard('carla.World.spawn_actor-code')">Copy snipet</button>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<button id="button1" class="CloseSnipet" onclick="CloseSnipet()">Close snipet</button><br><br>
</div>
<div id ="carla.Client.__init__-snipet" style="display: none;"> <div id ="carla.Client.__init__-snipet" style="display: none;">
<p class="SnipetFont"> <p class="SnipetFont">
Snipet for carla.Client.__init__ Snipet for carla.Client.__init__
@ -3564,53 +3570,49 @@ Snipet for carla.Client.__init__
</div> </div>
<div id ="carla.Sensor.listen-snipet" style="display: none;"> <div id ="carla.TrafficLight.set_state-snipet" style="display: none;">
<p class="SnipetFont"> <p class="SnipetFont">
Snipet for carla.Sensor.listen Snipet for carla.TrafficLight.set_state
</p> </p>
<div id="carla.Sensor.listen-code" class="SnipetContent"> <div id="carla.TrafficLight.set_state-code" class="SnipetContent">
```py ```py
# This recipe applies a color conversion to the image taken by a camera sensor, # This recipe changes from red to green the traffic light that affects the vehicle.
# so it is converted to a semantic segmentation image. # This is done by detecting if the vehicle actor is at a traffic light.
# ... # ...
camera_bp = world.get_blueprint_library().filter('sensor.camera.semantic_segmentation') world = client.get_world()
# ... spectator = world.get_spectator()
cc = carla.ColorConverter.CityScapesPalette
camera.listen(lambda image: image.save_to_disk('output/%06d.png' % image.frame, cc)) vehicle_bp = random.choice(world.get_blueprint_library().filter('vehicle.bmw.*'))
transform = random.choice(world.get_map().get_spawn_points())
vehicle = world.try_spawn_actor(vehicle_bp, transform)
# Wait for world to get the vehicle actor
world.tick()
world_snapshot = world.wait_for_tick()
actor_snapshot = world_snapshot.find(vehicle.id)
# Set spectator at given transform (vehicle transform)
spectator.set_transform(actor_snapshot.get_transform())
# ...# ...
if vehicle_actor.is_at_traffic_light():
traffic_light = vehicle_actor.get_traffic_light()
if traffic_light.get_state() == carla.TrafficLightState.Red:
# world.hud.notification("Traffic light changed! Good to go!")
traffic_light.set_state(carla.TrafficLightState.Green)
# ... # ...
``` ```
<button id="button1" class="CopyScript" onclick="CopyToClipboard('carla.Sensor.listen-code')">Copy snipet</button>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<button id="button1" class="CloseSnipet" onclick="CloseSnipet()">Close snipet</button><br><br> <button id="button1" class="CopyScript" onclick="CopyToClipboard('carla.TrafficLight.set_state-code')">Copy snipet</button>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<button id="button1" class="CloseSnipet" onclick="CloseSnipet()">Close snipet</button><br><br>
</div>
<div id ="carla.World.spawn_actor-snipet" style="display: none;">
<p class="SnipetFont">
Snipet for carla.World.spawn_actor
</p>
<div id="carla.World.spawn_actor-code" class="SnipetContent">
```py
# This recipe attaches different camera / sensors to a vehicle with different attachments. <img src="/img/snipets_images/carla.TrafficLight.set_state.gif">
# ...
camera = world.spawn_actor(rgb_camera_bp, transform, attach_to=vehicle, attachment_type=Attachment.Rigid)
# Default attachment: Attachment.Rigid
gnss_sensor = world.spawn_actor(sensor_gnss_bp, transform, attach_to=vehicle)
collision_sensor = world.spawn_actor(sensor_collision_bp, transform, attach_to=vehicle)
lane_invasion_sensor = world.spawn_actor(sensor_lane_invasion_bp, transform, attach_to=vehicle)
# ...
```
<button id="button1" class="CopyScript" onclick="CopyToClipboard('carla.World.spawn_actor-code')">Copy snipet</button>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<button id="button1" class="CloseSnipet" onclick="CloseSnipet()">Close snipet</button><br><br>
</div> </div>