|
|
|
@ -434,7 +434,13 @@ Enum declaration that contains the different tags available to filter the boundi
|
|
|
|
|
- <a name="carla.CityObjectLabel.Sidewalks"></a>**<font color="#f8805a">Sidewalks</font>**
|
|
|
|
|
- <a name="carla.CityObjectLabel.TrafficSigns"></a>**<font color="#f8805a">TrafficSigns</font>**
|
|
|
|
|
- <a name="carla.CityObjectLabel.Vegetation"></a>**<font color="#f8805a">Vegetation</font>**
|
|
|
|
|
- <a name="carla.CityObjectLabel.Vehicles"></a>**<font color="#f8805a">Vehicles</font>**
|
|
|
|
|
- <a name="carla.CityObjectLabel.Car"></a>**<font color="#f8805a">Car</font>**
|
|
|
|
|
- <a name="carla.CityObjectLabel.Bus"></a>**<font color="#f8805a">Bus</font>**
|
|
|
|
|
- <a name="carla.CityObjectLabel.Truck"></a>**<font color="#f8805a">Truck</font>**
|
|
|
|
|
- <a name="carla.CityObjectLabel.Motorcycle"></a>**<font color="#f8805a">Motorcycle</font>**
|
|
|
|
|
- <a name="carla.CityObjectLabel.Bicycle"></a>**<font color="#f8805a">Bicycle</font>**
|
|
|
|
|
- <a name="carla.CityObjectLabel.Rider"></a>**<font color="#f8805a">Rider</font>**
|
|
|
|
|
- <a name="carla.CityObjectLabel.Train"></a>**<font color="#f8805a">Train</font>**
|
|
|
|
|
- <a name="carla.CityObjectLabel.Walls"></a>**<font color="#f8805a">Walls</font>**
|
|
|
|
|
- <a name="carla.CityObjectLabel.Sky"></a>**<font color="#f8805a">Sky</font>**
|
|
|
|
|
- <a name="carla.CityObjectLabel.Ground"></a>**<font color="#f8805a">Ground</font>**
|
|
|
|
@ -484,12 +490,23 @@ Creates a new world with default settings using `map_name` map. All actors in th
|
|
|
|
|
- `map_name` (_str_) - Name of the map to be used in this world. Accepts both full paths and map names, e.g. '/Game/Carla/Maps/Town01' or 'Town01'. Remember that these paths are dynamic.
|
|
|
|
|
- `reset_settings` (_bool_) - Option to reset the episode setting to default values, set to false to keep the current settings. This is useful to keep sync mode when changing map and to keep deterministic scenarios.
|
|
|
|
|
- `map_layers` (_[carla.MapLayer](#carla.MapLayer)_) - Layers of the map that will be loaded. By default all layers are loaded. This parameter works like a flag mask.
|
|
|
|
|
- **Return:** _[carla.World](#carla.World)_
|
|
|
|
|
- **Warning:** <font color="#ED2F2F">_`map_layers` are only available for "Opt" maps
|
|
|
|
|
_</font>
|
|
|
|
|
- <a name="carla.Client.load_world_if_different"></a>**<font color="#7fb800">load_world_if_different</font>**(<font color="#00a6ed">**self**</font>, <font color="#00a6ed">**map_name**</font>, <font color="#00a6ed">**reset_settings**=True</font>, <font color="#00a6ed">**map_layers**=[carla.MapLayer.All](#carla.MapLayer.All)</font>)
|
|
|
|
|
Creates a new world with default settings using `map_name` map only if it is a different map from the currently loaded map. Otherwise this function returns `None`. All actors in the current world will be destroyed.
|
|
|
|
|
- **Parameters:**
|
|
|
|
|
- `map_name` (_str_) - Name of the map to be used in this world. Accepts both full paths and map names, e.g. '/Game/Carla/Maps/Town01' or 'Town01'. Remember that these paths are dynamic.
|
|
|
|
|
- `reset_settings` (_bool_) - Option to reset the episode setting to default values, set to false to keep the current settings. This is useful to keep sync mode when changing map and to keep deterministic scenarios.
|
|
|
|
|
- `map_layers` (_[carla.MapLayer](#carla.MapLayer)_) - Layers of the map that will be loaded. By default all layers are loaded. This parameter works like a flag mask.
|
|
|
|
|
- **Return:** _[carla.World](#carla.World)_
|
|
|
|
|
- **Warning:** <font color="#ED2F2F">_`map_layers` are only available for "Opt" maps
|
|
|
|
|
_</font>
|
|
|
|
|
- <a name="carla.Client.reload_world"></a>**<font color="#7fb800">reload_world</font>**(<font color="#00a6ed">**self**</font>, <font color="#00a6ed">**reset_settings**=True</font>)
|
|
|
|
|
Reload the current world, note that a new world is created with default settings using the same map. All actors present in the world will be destroyed, __but__ traffic manager instances will stay alive.
|
|
|
|
|
- **Parameters:**
|
|
|
|
|
- `reset_settings` (_bool_) - Option to reset the episode setting to default values, set to false to keep the current settings. This is useful to keep sync mode when changing map and to keep deterministic scenarios.
|
|
|
|
|
- **Return:** _[carla.World](#carla.World)_
|
|
|
|
|
- **Raises:** RuntimeError when corresponding.
|
|
|
|
|
- <a name="carla.Client.replay_file"></a>**<font color="#7fb800">replay_file</font>**(<font color="#00a6ed">**self**</font>, <font color="#00a6ed">**name**</font>, <font color="#00a6ed">**start**</font>, <font color="#00a6ed">**duration**</font>, <font color="#00a6ed">**follow_id**</font>, <font color="#00a6ed">**replay_sensors**</font>)
|
|
|
|
|
Load a new world with default settings using `map_name` map. All actors present in the current world will be destroyed, __but__ traffic manager instances will stay alive.
|
|
|
|
@ -3771,9 +3788,9 @@ When enabled, the simulation will run no rendering at all. This is mainly used t
|
|
|
|
|
- <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.
|
|
|
|
|
- <a name="carla.WorldSettings.substepping"></a>**<font color="#f8805a">substepping</font>** (_bool_)
|
|
|
|
|
Enable the physics substepping. This option allows computing some physics substeps between two render frames. If synchronous mode is set, the number of substeps and its time interval are fixed and computed are so they fulfilled the requirements of [carla.WorldSettings.max_substep](#carla.WorldSettings.max_substep) and [carla.WorldSettings.max_substep_delta_time](#carla.WorldSettings.max_substep_delta_time). These last two parameters need to be compatible with [carla.WorldSettings.fixed_delta_seconds](#carla.WorldSettings.fixed_delta_seconds). Enabled by default.
|
|
|
|
|
Enable the physics substepping. This option allows computing some physics substeps between two render frames. If synchronous mode is set, the number of substeps and its time interval are fixed and computed are so they fulfilled the requirements of [carla.WorldSettings.max_substeps](#carla.WorldSettings.max_substeps) and [carla.WorldSettings.max_substep_delta_time](#carla.WorldSettings.max_substep_delta_time). These last two parameters need to be compatible with [carla.WorldSettings.fixed_delta_seconds](#carla.WorldSettings.fixed_delta_seconds). Enabled by default.
|
|
|
|
|
- <a name="carla.WorldSettings.max_substep_delta_time"></a>**<font color="#f8805a">max_substep_delta_time</font>** (_float_)
|
|
|
|
|
Maximum delta time of the substeps. If the [carla.WorldSettingsmax_substep](#carla.WorldSettingsmax_substep) is high enough, the substep delta time would be always below or equal to this value. By default, the value is set to 0.01.
|
|
|
|
|
Maximum delta time of the substeps. If the [carla.WorldSettings.max_substeps](#carla.WorldSettings.max_substeps) is high enough, the substep delta time would be always below or equal to this value. By default, the value is set to 0.01.
|
|
|
|
|
- <a name="carla.WorldSettings.max_substeps"></a>**<font color="#f8805a">max_substeps</font>** (_int_)
|
|
|
|
|
The maximum number of physics substepping that are allowed. By default, the value is set to 10.
|
|
|
|
|
- <a name="carla.WorldSettings.max_culling_distance"></a>**<font color="#f8805a">max_culling_distance</font>** (_float_)
|
|
|
|
@ -4072,6 +4089,11 @@ Actor affected by the command.
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
## command.FutureActor<a name="command.FutureActor"></a>
|
|
|
|
|
A utility object used to reference an actor that will be created in the command in the previous step, it has no parameters or methods.
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
## command.Response<a name="command.Response"></a>
|
|
|
|
|
States the result of executing a command as either the ID of the actor to whom the command was applied to (when succeeded) or an error string (when failed). actor ID, depending on whether or not the command succeeded. The method __<font color="#7fb800">apply_batch_sync()</font>__ in [carla.Client](#carla.Client) returns a list of these to summarize the execution of a batch.
|
|
|
|
|
|
|
|
|
@ -4226,6 +4248,71 @@ document.getElementById("snipets-container").innerHTML = null;
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<div id ="carla.World.unload_map_layer-snipet" style="display: none;">
|
|
|
|
|
<p class="SnipetFont">
|
|
|
|
|
Snippet for carla.World.unload_map_layer
|
|
|
|
|
</p>
|
|
|
|
|
<div id="carla.World.unload_map_layer-code" class="SnipetContent">
|
|
|
|
|
|
|
|
|
|
```py
|
|
|
|
|
|
|
|
|
|
# This recipe toggles off several layers in our "_Opt" maps
|
|
|
|
|
|
|
|
|
|
# Load town one with minimum layout (roads, sidewalks, traffic lights and traffic signs)
|
|
|
|
|
# as well as buildings and parked vehicles
|
|
|
|
|
world = client.load_world('Town01_Opt', carla.MapLayer.Buildings | carla.MapLayer.ParkedVehicles)
|
|
|
|
|
|
|
|
|
|
# Toggle all buildings off
|
|
|
|
|
world.unload_map_layer(carla.MapLayer.Buildings)
|
|
|
|
|
|
|
|
|
|
# Toggle all parked vehicles off
|
|
|
|
|
world.unload_map_layer(carla.MapLayer.ParkedVehicles)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
<button id="button1" class="CopyScript" onclick="CopyToClipboard('carla.World.unload_map_layer-code')">Copy snippet</button> <button id="button1" class="CloseSnipet" onclick="CloseSnipet()">Close snippet</button><br><br>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div id ="carla.DebugHelper.draw_string-snipet" style="display: none;">
|
|
|
|
|
<p class="SnipetFont">
|
|
|
|
|
Snippet for carla.DebugHelper.draw_string
|
|
|
|
|
</p>
|
|
|
|
|
<div id="carla.DebugHelper.draw_string-code" class="SnipetContent">
|
|
|
|
|
|
|
|
|
|
```py
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# This recipe is a modification of lane_explorer.py example.
|
|
|
|
|
# It draws the path of an actor through the world, printing information at each waypoint.
|
|
|
|
|
|
|
|
|
|
# ...
|
|
|
|
|
current_w = map.get_waypoint(vehicle.get_location())
|
|
|
|
|
while True:
|
|
|
|
|
|
|
|
|
|
next_w = map.get_waypoint(vehicle.get_location(), lane_type=carla.LaneType.Driving | carla.LaneType.Shoulder | carla.LaneType.Sidewalk )
|
|
|
|
|
# Check if the vehicle is moving
|
|
|
|
|
if next_w.id != current_w.id:
|
|
|
|
|
vector = vehicle.get_velocity()
|
|
|
|
|
# Check if the vehicle is on a sidewalk
|
|
|
|
|
if current_w.lane_type == carla.LaneType.Sidewalk:
|
|
|
|
|
draw_waypoint_union(debug, current_w, next_w, cyan if current_w.is_junction else red, 60)
|
|
|
|
|
else:
|
|
|
|
|
draw_waypoint_union(debug, current_w, next_w, cyan if current_w.is_junction else green, 60)
|
|
|
|
|
debug.draw_string(current_w.transform.location, str('%15.0f km/h' % (3.6 * math.sqrt(vector.x**2 + vector.y**2 + vector.z**2))), False, orange, 60)
|
|
|
|
|
draw_transform(debug, current_w.transform, white, 60)
|
|
|
|
|
|
|
|
|
|
# Update the current waypoint and sleep for some time
|
|
|
|
|
current_w = next_w
|
|
|
|
|
time.sleep(args.tick_time)
|
|
|
|
|
# ...
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
<button id="button1" class="CopyScript" onclick="CopyToClipboard('carla.DebugHelper.draw_string-code')">Copy snippet</button> <button id="button1" class="CloseSnipet" onclick="CloseSnipet()">Close snippet</button><br><br>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div id ="carla.ActorBlueprint.set_attribute-snipet" style="display: none;">
|
|
|
|
|
<p class="SnipetFont">
|
|
|
|
|
Snippet for carla.ActorBlueprint.set_attribute
|
|
|
|
@ -4260,6 +4347,247 @@ camera_bp.set_attribute('image_size_y', 600)
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div id ="carla.World.get_spectator-snipet" style="display: none;">
|
|
|
|
|
<p class="SnipetFont">
|
|
|
|
|
Snippet for carla.World.get_spectator
|
|
|
|
|
</p>
|
|
|
|
|
<div id="carla.World.get_spectator-code" class="SnipetContent">
|
|
|
|
|
|
|
|
|
|
```py
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# This recipe spawns an actor and the spectator camera at the actor's location.
|
|
|
|
|
|
|
|
|
|
# ...
|
|
|
|
|
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())
|
|
|
|
|
# ...
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
<button id="button1" class="CopyScript" onclick="CopyToClipboard('carla.World.get_spectator-code')">Copy snippet</button> <button id="button1" class="CloseSnipet" onclick="CloseSnipet()">Close snippet</button><br><br>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div id ="carla.Sensor.listen-snipet" style="display: none;">
|
|
|
|
|
<p class="SnipetFont">
|
|
|
|
|
Snippet 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 snippet</button> <button id="button1" class="CloseSnipet" onclick="CloseSnipet()">Close snippet</button><br><br>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div id ="carla.World.load_map_layer-snipet" style="display: none;">
|
|
|
|
|
<p class="SnipetFont">
|
|
|
|
|
Snippet for carla.World.load_map_layer
|
|
|
|
|
</p>
|
|
|
|
|
<div id="carla.World.load_map_layer-code" class="SnipetContent">
|
|
|
|
|
|
|
|
|
|
```py
|
|
|
|
|
|
|
|
|
|
# This recipe toggles on several layers in our "_Opt" maps
|
|
|
|
|
|
|
|
|
|
# Load town one with only minimum layout (roads, sidewalks, traffic lights and traffic signs)
|
|
|
|
|
world = client.load_world('Town01_Opt', carla.MapLayer.None)
|
|
|
|
|
|
|
|
|
|
# Toggle all buildings on
|
|
|
|
|
world.load_map_layer(carla.MapLayer.Buildings)
|
|
|
|
|
|
|
|
|
|
# Toggle all foliage on
|
|
|
|
|
world.load_map_layer(carla.MapLayer.Foliage)
|
|
|
|
|
|
|
|
|
|
# Toggle all parked vehicles on
|
|
|
|
|
world.load_map_layer(carla.MapLayer.ParkedVehicles)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
<button id="button1" class="CopyScript" onclick="CopyToClipboard('carla.World.load_map_layer-code')">Copy snippet</button> <button id="button1" class="CloseSnipet" onclick="CloseSnipet()">Close snippet</button><br><br>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div id ="carla.Map.get_waypoint-snipet" style="display: none;">
|
|
|
|
|
<p class="SnipetFont">
|
|
|
|
|
Snippet for carla.Map.get_waypoint
|
|
|
|
|
</p>
|
|
|
|
|
<div id="carla.Map.get_waypoint-code" class="SnipetContent">
|
|
|
|
|
|
|
|
|
|
```py
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# This recipe shows the current traffic rules affecting the vehicle.
|
|
|
|
|
# Shows the current lane type and if a lane change can be done in the actual lane or the surrounding ones.
|
|
|
|
|
|
|
|
|
|
# ...
|
|
|
|
|
waypoint = world.get_map().get_waypoint(vehicle.get_location(),project_to_road=True, lane_type=(carla.LaneType.Driving | carla.LaneType.Shoulder | carla.LaneType.Sidewalk))
|
|
|
|
|
print("Current lane type: " + str(waypoint.lane_type))
|
|
|
|
|
# Check current lane change allowed
|
|
|
|
|
print("Current Lane change: " + str(waypoint.lane_change))
|
|
|
|
|
# Left and Right lane markings
|
|
|
|
|
print("L lane marking type: " + str(waypoint.left_lane_marking.type))
|
|
|
|
|
print("L lane marking change: " + str(waypoint.left_lane_marking.lane_change))
|
|
|
|
|
print("R lane marking type: " + str(waypoint.right_lane_marking.type))
|
|
|
|
|
print("R lane marking change: " + str(waypoint.right_lane_marking.lane_change))
|
|
|
|
|
# ...
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
<button id="button1" class="CopyScript" onclick="CopyToClipboard('carla.Map.get_waypoint-code')">Copy snippet</button> <button id="button1" class="CloseSnipet" onclick="CloseSnipet()">Close snippet</button><br><br>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<img src="/img/snipets_images/carla.Map.get_waypoint.jpg">
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div id ="carla.TrafficLight.set_state-snipet" style="display: none;">
|
|
|
|
|
<p class="SnipetFont">
|
|
|
|
|
Snippet 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 snippet</button> <button id="button1" class="CloseSnipet" onclick="CloseSnipet()">Close snippet</button><br><br>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<img src="/img/snipets_images/carla.TrafficLight.set_state.gif">
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div id ="carla.Vehicle.set_wheel_steer_direction-snipet" style="display: none;">
|
|
|
|
|
<p class="SnipetFont">
|
|
|
|
|
Snippet for carla.Vehicle.set_wheel_steer_direction
|
|
|
|
|
</p>
|
|
|
|
|
<div id="carla.Vehicle.set_wheel_steer_direction-code" class="SnipetContent">
|
|
|
|
|
|
|
|
|
|
```py
|
|
|
|
|
|
|
|
|
|
# Sets the appearance of the vehicles front wheels to 40°. Vehicle physics will not be affected.
|
|
|
|
|
|
|
|
|
|
vehicle.set_wheel_steer_direction(carla.VehicleWheelLocation.FR_Wheel, 40.0)
|
|
|
|
|
vehicle.set_wheel_steer_direction(carla.VehicleWheelLocation.FL_Wheel, 40.0)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
<button id="button1" class="CopyScript" onclick="CopyToClipboard('carla.Vehicle.set_wheel_steer_direction-code')">Copy snippet</button> <button id="button1" class="CloseSnipet" onclick="CloseSnipet()">Close snippet</button><br><br>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div id ="carla.DebugHelper.draw_box-snipet" style="display: none;">
|
|
|
|
|
<p class="SnipetFont">
|
|
|
|
|
Snippet for carla.DebugHelper.draw_box
|
|
|
|
|
</p>
|
|
|
|
|
<div id="carla.DebugHelper.draw_box-code" class="SnipetContent">
|
|
|
|
|
|
|
|
|
|
```py
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# This recipe shows how to draw traffic light actor bounding boxes from a world snapshot.
|
|
|
|
|
|
|
|
|
|
# ....
|
|
|
|
|
debug = world.debug
|
|
|
|
|
world_snapshot = world.get_snapshot()
|
|
|
|
|
|
|
|
|
|
for actor_snapshot in world_snapshot:
|
|
|
|
|
actual_actor = world.get_actor(actor_snapshot.id)
|
|
|
|
|
if actual_actor.type_id == 'traffic.traffic_light':
|
|
|
|
|
debug.draw_box(carla.BoundingBox(actor_snapshot.get_transform().location,carla.Vector3D(0.5,0.5,2)),actor_snapshot.get_transform().rotation, 0.05, carla.Color(255,0,0,0),0)
|
|
|
|
|
# ...
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
<button id="button1" class="CopyScript" onclick="CopyToClipboard('carla.DebugHelper.draw_box-code')">Copy snippet</button> <button id="button1" class="CloseSnipet" onclick="CloseSnipet()">Close snippet</button><br><br>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<img src="/img/snipets_images/carla.DebugHelper.draw_box.jpg">
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div id ="carla.WalkerAIController.stop-snipet" style="display: none;">
|
|
|
|
|
<p class="SnipetFont">
|
|
|
|
|
Snippet 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 snippet</button> <button id="button1" class="CloseSnipet" onclick="CloseSnipet()">Close snippet</button><br><br>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div id ="carla.Client.apply_batch_sync-snipet" style="display: none;">
|
|
|
|
|
<p class="SnipetFont">
|
|
|
|
|
Snippet for carla.Client.apply_batch_sync
|
|
|
|
@ -4333,6 +4661,36 @@ for i in range(0, len(all_actors), 2):
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div id ="carla.World.enable_environment_objects-snipet" style="display: none;">
|
|
|
|
|
<p class="SnipetFont">
|
|
|
|
|
Snippet for carla.World.enable_environment_objects
|
|
|
|
|
</p>
|
|
|
|
|
<div id="carla.World.enable_environment_objects-code" class="SnipetContent">
|
|
|
|
|
|
|
|
|
|
```py
|
|
|
|
|
|
|
|
|
|
# This recipe turn visibility off and on for two specifc buildings on the map
|
|
|
|
|
|
|
|
|
|
# Get the buildings in the world
|
|
|
|
|
world = client.get_world()
|
|
|
|
|
env_objs = world.get_environment_objects(carla.CityObjectLabel.Buildings)
|
|
|
|
|
|
|
|
|
|
# Access individual building IDs and save in a set
|
|
|
|
|
building_01 = env_objs[0]
|
|
|
|
|
building_02 = env_objs[1]
|
|
|
|
|
objects_to_toggle = {building_01.id, building_02.id}
|
|
|
|
|
|
|
|
|
|
# Toggle buildings off
|
|
|
|
|
world.enable_environment_objects(objects_to_toggle, False)
|
|
|
|
|
# Toggle buildings on
|
|
|
|
|
world.enable_environment_objects(objects_to_toggle, True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
<button id="button1" class="CopyScript" onclick="CopyToClipboard('carla.World.enable_environment_objects-code')">Copy snippet</button> <button id="button1" class="CloseSnipet" onclick="CloseSnipet()">Close snippet</button><br><br>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div id ="carla.Client.__init__-snipet" style="display: none;">
|
|
|
|
|
<p class="SnipetFont">
|
|
|
|
|
Snippet for carla.Client.__init__
|
|
|
|
@ -4378,316 +4736,6 @@ Snippet for carla.Client.__init__
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div id ="carla.DebugHelper.draw_box-snipet" style="display: none;">
|
|
|
|
|
<p class="SnipetFont">
|
|
|
|
|
Snippet for carla.DebugHelper.draw_box
|
|
|
|
|
</p>
|
|
|
|
|
<div id="carla.DebugHelper.draw_box-code" class="SnipetContent">
|
|
|
|
|
|
|
|
|
|
```py
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# This recipe shows how to draw traffic light actor bounding boxes from a world snapshot.
|
|
|
|
|
|
|
|
|
|
# ....
|
|
|
|
|
debug = world.debug
|
|
|
|
|
world_snapshot = world.get_snapshot()
|
|
|
|
|
|
|
|
|
|
for actor_snapshot in world_snapshot:
|
|
|
|
|
actual_actor = world.get_actor(actor_snapshot.id)
|
|
|
|
|
if actual_actor.type_id == 'traffic.traffic_light':
|
|
|
|
|
debug.draw_box(carla.BoundingBox(actor_snapshot.get_transform().location,carla.Vector3D(0.5,0.5,2)),actor_snapshot.get_transform().rotation, 0.05, carla.Color(255,0,0,0),0)
|
|
|
|
|
# ...
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
<button id="button1" class="CopyScript" onclick="CopyToClipboard('carla.DebugHelper.draw_box-code')">Copy snippet</button> <button id="button1" class="CloseSnipet" onclick="CloseSnipet()">Close snippet</button><br><br>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<img src="/img/snipets_images/carla.DebugHelper.draw_box.jpg">
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div id ="carla.DebugHelper.draw_string-snipet" style="display: none;">
|
|
|
|
|
<p class="SnipetFont">
|
|
|
|
|
Snippet for carla.DebugHelper.draw_string
|
|
|
|
|
</p>
|
|
|
|
|
<div id="carla.DebugHelper.draw_string-code" class="SnipetContent">
|
|
|
|
|
|
|
|
|
|
```py
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# This recipe is a modification of lane_explorer.py example.
|
|
|
|
|
# It draws the path of an actor through the world, printing information at each waypoint.
|
|
|
|
|
|
|
|
|
|
# ...
|
|
|
|
|
current_w = map.get_waypoint(vehicle.get_location())
|
|
|
|
|
while True:
|
|
|
|
|
|
|
|
|
|
next_w = map.get_waypoint(vehicle.get_location(), lane_type=carla.LaneType.Driving | carla.LaneType.Shoulder | carla.LaneType.Sidewalk )
|
|
|
|
|
# Check if the vehicle is moving
|
|
|
|
|
if next_w.id != current_w.id:
|
|
|
|
|
vector = vehicle.get_velocity()
|
|
|
|
|
# Check if the vehicle is on a sidewalk
|
|
|
|
|
if current_w.lane_type == carla.LaneType.Sidewalk:
|
|
|
|
|
draw_waypoint_union(debug, current_w, next_w, cyan if current_w.is_junction else red, 60)
|
|
|
|
|
else:
|
|
|
|
|
draw_waypoint_union(debug, current_w, next_w, cyan if current_w.is_junction else green, 60)
|
|
|
|
|
debug.draw_string(current_w.transform.location, str('%15.0f km/h' % (3.6 * math.sqrt(vector.x**2 + vector.y**2 + vector.z**2))), False, orange, 60)
|
|
|
|
|
draw_transform(debug, current_w.transform, white, 60)
|
|
|
|
|
|
|
|
|
|
# Update the current waypoint and sleep for some time
|
|
|
|
|
current_w = next_w
|
|
|
|
|
time.sleep(args.tick_time)
|
|
|
|
|
# ...
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
<button id="button1" class="CopyScript" onclick="CopyToClipboard('carla.DebugHelper.draw_string-code')">Copy snippet</button> <button id="button1" class="CloseSnipet" onclick="CloseSnipet()">Close snippet</button><br><br>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div id ="carla.Map.get_waypoint-snipet" style="display: none;">
|
|
|
|
|
<p class="SnipetFont">
|
|
|
|
|
Snippet for carla.Map.get_waypoint
|
|
|
|
|
</p>
|
|
|
|
|
<div id="carla.Map.get_waypoint-code" class="SnipetContent">
|
|
|
|
|
|
|
|
|
|
```py
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# This recipe shows the current traffic rules affecting the vehicle.
|
|
|
|
|
# Shows the current lane type and if a lane change can be done in the actual lane or the surrounding ones.
|
|
|
|
|
|
|
|
|
|
# ...
|
|
|
|
|
waypoint = world.get_map().get_waypoint(vehicle.get_location(),project_to_road=True, lane_type=(carla.LaneType.Driving | carla.LaneType.Shoulder | carla.LaneType.Sidewalk))
|
|
|
|
|
print("Current lane type: " + str(waypoint.lane_type))
|
|
|
|
|
# Check current lane change allowed
|
|
|
|
|
print("Current Lane change: " + str(waypoint.lane_change))
|
|
|
|
|
# Left and Right lane markings
|
|
|
|
|
print("L lane marking type: " + str(waypoint.left_lane_marking.type))
|
|
|
|
|
print("L lane marking change: " + str(waypoint.left_lane_marking.lane_change))
|
|
|
|
|
print("R lane marking type: " + str(waypoint.right_lane_marking.type))
|
|
|
|
|
print("R lane marking change: " + str(waypoint.right_lane_marking.lane_change))
|
|
|
|
|
# ...
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
<button id="button1" class="CopyScript" onclick="CopyToClipboard('carla.Map.get_waypoint-code')">Copy snippet</button> <button id="button1" class="CloseSnipet" onclick="CloseSnipet()">Close snippet</button><br><br>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<img src="/img/snipets_images/carla.Map.get_waypoint.jpg">
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div id ="carla.Sensor.listen-snipet" style="display: none;">
|
|
|
|
|
<p class="SnipetFont">
|
|
|
|
|
Snippet 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 snippet</button> <button id="button1" class="CloseSnipet" onclick="CloseSnipet()">Close snippet</button><br><br>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div id ="carla.TrafficLight.set_state-snipet" style="display: none;">
|
|
|
|
|
<p class="SnipetFont">
|
|
|
|
|
Snippet 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 snippet</button> <button id="button1" class="CloseSnipet" onclick="CloseSnipet()">Close snippet</button><br><br>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<img src="/img/snipets_images/carla.TrafficLight.set_state.gif">
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div id ="carla.Vehicle.set_wheel_steer_direction-snipet" style="display: none;">
|
|
|
|
|
<p class="SnipetFont">
|
|
|
|
|
Snippet for carla.Vehicle.set_wheel_steer_direction
|
|
|
|
|
</p>
|
|
|
|
|
<div id="carla.Vehicle.set_wheel_steer_direction-code" class="SnipetContent">
|
|
|
|
|
|
|
|
|
|
```py
|
|
|
|
|
|
|
|
|
|
# Sets the appearance of the vehicles front wheels to 40°. Vehicle physics will not be affected.
|
|
|
|
|
|
|
|
|
|
vehicle.set_wheel_steer_direction(carla.VehicleWheelLocation.FR_Wheel, 40.0)
|
|
|
|
|
vehicle.set_wheel_steer_direction(carla.VehicleWheelLocation.FL_Wheel, 40.0)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
<button id="button1" class="CopyScript" onclick="CopyToClipboard('carla.Vehicle.set_wheel_steer_direction-code')">Copy snippet</button> <button id="button1" class="CloseSnipet" onclick="CloseSnipet()">Close snippet</button><br><br>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div id ="carla.WalkerAIController.stop-snipet" style="display: none;">
|
|
|
|
|
<p class="SnipetFont">
|
|
|
|
|
Snippet 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 snippet</button> <button id="button1" class="CloseSnipet" onclick="CloseSnipet()">Close snippet</button><br><br>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div id ="carla.World.enable_environment_objects-snipet" style="display: none;">
|
|
|
|
|
<p class="SnipetFont">
|
|
|
|
|
Snippet for carla.World.enable_environment_objects
|
|
|
|
|
</p>
|
|
|
|
|
<div id="carla.World.enable_environment_objects-code" class="SnipetContent">
|
|
|
|
|
|
|
|
|
|
```py
|
|
|
|
|
|
|
|
|
|
# This recipe turn visibility off and on for two specifc buildings on the map
|
|
|
|
|
|
|
|
|
|
# Get the buildings in the world
|
|
|
|
|
world = client.get_world()
|
|
|
|
|
env_objs = world.get_environment_objects(carla.CityObjectLabel.Buildings)
|
|
|
|
|
|
|
|
|
|
# Access individual building IDs and save in a set
|
|
|
|
|
building_01 = env_objs[0]
|
|
|
|
|
building_02 = env_objs[1]
|
|
|
|
|
objects_to_toggle = {building_01.id, building_02.id}
|
|
|
|
|
|
|
|
|
|
# Toggle buildings off
|
|
|
|
|
world.enable_environment_objects(objects_to_toggle, False)
|
|
|
|
|
# Toggle buildings on
|
|
|
|
|
world.enable_environment_objects(objects_to_toggle, True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
<button id="button1" class="CopyScript" onclick="CopyToClipboard('carla.World.enable_environment_objects-code')">Copy snippet</button> <button id="button1" class="CloseSnipet" onclick="CloseSnipet()">Close snippet</button><br><br>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div id ="carla.World.get_spectator-snipet" style="display: none;">
|
|
|
|
|
<p class="SnipetFont">
|
|
|
|
|
Snippet for carla.World.get_spectator
|
|
|
|
|
</p>
|
|
|
|
|
<div id="carla.World.get_spectator-code" class="SnipetContent">
|
|
|
|
|
|
|
|
|
|
```py
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# This recipe spawns an actor and the spectator camera at the actor's location.
|
|
|
|
|
|
|
|
|
|
# ...
|
|
|
|
|
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())
|
|
|
|
|
# ...
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
<button id="button1" class="CopyScript" onclick="CopyToClipboard('carla.World.get_spectator-code')">Copy snippet</button> <button id="button1" class="CloseSnipet" onclick="CloseSnipet()">Close snippet</button><br><br>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div id ="carla.World.load_map_layer-snipet" style="display: none;">
|
|
|
|
|
<p class="SnipetFont">
|
|
|
|
|
Snippet for carla.World.load_map_layer
|
|
|
|
|
</p>
|
|
|
|
|
<div id="carla.World.load_map_layer-code" class="SnipetContent">
|
|
|
|
|
|
|
|
|
|
```py
|
|
|
|
|
|
|
|
|
|
# This recipe toggles on several layers in our "_Opt" maps
|
|
|
|
|
|
|
|
|
|
# Load town one with only minimum layout (roads, sidewalks, traffic lights and traffic signs)
|
|
|
|
|
world = client.load_world('Town01_Opt', carla.MapLayer.None)
|
|
|
|
|
|
|
|
|
|
# Toggle all buildings on
|
|
|
|
|
world.load_map_layer(carla.MapLayer.Buildings)
|
|
|
|
|
|
|
|
|
|
# Toggle all foliage on
|
|
|
|
|
world.load_map_layer(carla.MapLayer.Foliage)
|
|
|
|
|
|
|
|
|
|
# Toggle all parked vehicles on
|
|
|
|
|
world.load_map_layer(carla.MapLayer.ParkedVehicles)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
<button id="button1" class="CopyScript" onclick="CopyToClipboard('carla.World.load_map_layer-code')">Copy snippet</button> <button id="button1" class="CloseSnipet" onclick="CloseSnipet()">Close snippet</button><br><br>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div id ="carla.World.spawn_actor-snipet" style="display: none;">
|
|
|
|
|
<p class="SnipetFont">
|
|
|
|
|
Snippet for carla.World.spawn_actor
|
|
|
|
@ -4713,32 +4761,6 @@ lane_invasion_sensor = world.spawn_actor(sensor_lane_invasion_bp, transform, att
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div id ="carla.World.unload_map_layer-snipet" style="display: none;">
|
|
|
|
|
<p class="SnipetFont">
|
|
|
|
|
Snippet for carla.World.unload_map_layer
|
|
|
|
|
</p>
|
|
|
|
|
<div id="carla.World.unload_map_layer-code" class="SnipetContent">
|
|
|
|
|
|
|
|
|
|
```py
|
|
|
|
|
|
|
|
|
|
# This recipe toggles off several layers in our "_Opt" maps
|
|
|
|
|
|
|
|
|
|
# Load town one with minimum layout (roads, sidewalks, traffic lights and traffic signs)
|
|
|
|
|
# as well as buildings and parked vehicles
|
|
|
|
|
world = client.load_world('Town01_Opt', carla.MapLayer.Buildings | carla.MapLayer.ParkedVehicles)
|
|
|
|
|
|
|
|
|
|
# Toggle all buildings off
|
|
|
|
|
world.unload_map_layer(carla.MapLayer.Buildings)
|
|
|
|
|
|
|
|
|
|
# Toggle all parked vehicles off
|
|
|
|
|
world.unload_map_layer(carla.MapLayer.ParkedVehicles)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
<button id="button1" class="CopyScript" onclick="CopyToClipboard('carla.World.unload_map_layer-code')">Copy snippet</button> <button id="button1" class="CloseSnipet" onclick="CloseSnipet()">Close snippet</button><br><br>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|