carla/PythonAPI/docs/client.yml

236 lines
8.6 KiB
YAML
Raw Normal View History

2019-04-19 02:13:34 +08:00
---
2019-04-25 18:21:25 +08:00
- module_name: carla
2019-04-19 02:13:34 +08:00
doc: >
# - CLASSES ------------------------------
classes:
- class_name: Client
2019-05-03 18:18:02 +08:00
# - DESCRIPTION ------------------------
2019-04-19 02:13:34 +08:00
doc: >
Client used to connect to a Carla server
# - PROPERTIES -------------------------
instance_variables:
# - METHODS ----------------------------
methods:
- def_name: __init__
params:
- param_name: host
type: str
doc: >
IP address where a CARLA Simulator instance is running
2019-04-19 02:13:34 +08:00
- param_name: port
type: int
doc: >
TCP port where the CARLA Simulator instance is running
2019-04-19 02:13:34 +08:00
- param_name: worker_threads
type: int
default: 0
doc: >
Number of working threads used for background updates. If 0, use all
available concurrency.
2019-04-19 02:13:34 +08:00
doc: >
Client constructor
# --------------------------------------
- def_name: set_timeout
params:
- param_name: seconds
type: float
doc: >
New timeout value in seconds
doc: >
Set the timeout in seconds allowed to block when doing networking calls
2019-04-19 02:13:34 +08:00
# --------------------------------------
- def_name: get_client_version
params:
return: str
doc: >
Get the client version as a string
# --------------------------------------
- def_name: get_server_version
params:
return: str
doc: >
Get the server version as a string
# --------------------------------------
- def_name: get_world
params:
return: carla.World
2019-04-19 02:13:34 +08:00
doc: >
Get the world currently active in the simulation
2019-04-19 02:13:34 +08:00
# --------------------------------------
- def_name: get_available_maps
params:
return: list(str)
2019-04-19 02:13:34 +08:00
doc: >
Get a list of strings of the maps available on server. The result can be something like:
'/Game/Carla/Maps/Town01'
'/Game/Carla/Maps/Town02'
'/Game/Carla/Maps/Town03'
'/Game/Carla/Maps/Town04'
'/Game/Carla/Maps/Town05'
'/Game/Carla/Maps/Town06'
'/Game/Carla/Maps/Town07'
2019-04-19 02:13:34 +08:00
# --------------------------------------
- def_name: reload_world
params:
2019-04-25 18:21:25 +08:00
raises: RuntimeError
2019-04-19 02:13:34 +08:00
doc: >
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.
2019-04-19 02:13:34 +08:00
# --------------------------------------
- def_name: load_world
params:
- param_name: map_name
type: str
doc: >
Name of the map to load, accepts both full paths and map names, e.g.
'/Game/Carla/Maps/Town01' or 'Town01'.
doc: >
Load a new world with default settings using `map_name` map. All actors
present in the current world will be destroyed.
2019-04-19 02:13:34 +08:00
# --------------------------------------
- def_name: start_recorder
params:
- param_name: filename
type: str
doc: >
Name of the file to write the recorded data
2019-04-19 02:13:34 +08:00
doc: >
2019-04-25 18:00:31 +08:00
If we use a simple name like 'recording.log' then it will be saved at server folder 'CarlaUE4/Saved/recording.log'.
If we use some folder in the name, then it will be considered to be an absolute path, like '/home/carla/recording.log'.
2019-04-19 02:13:34 +08:00
# --------------------------------------
- def_name: stop_recorder
params:
doc: >
Stops the recording in progress.
2019-04-19 02:13:34 +08:00
# --------------------------------------
- def_name: show_recorder_file_info
params:
2019-04-25 18:00:31 +08:00
- param_name: filename
type: str
doc: >
Name of the recorded file to load
- param_name: show_all
type: bool
doc: >
Show all detailed info, or just a summary
2019-04-19 02:13:34 +08:00
doc: >
Will show info about the recorded file (frames, times, events, state, positions...)
2019-04-25 18:00:31 +08:00
We have the option to show all the details per frame, that includes all the traffic light states, position of all actors, and animations data.
2019-04-19 02:13:34 +08:00
# --------------------------------------
- def_name: show_recorder_collisions
params:
2019-04-25 18:00:31 +08:00
- param_name: filename
type: str
doc: >
Name of the recorded file to load
- param_name: category1
type: single char
doc: >
Character specifying the category of the first actor
- param_name: category2
type: single char
doc: >
Character specifying the category of the second actor
doc: >
This will show which collisions were recorded in the file. We can use a filter for the collisions we want, using two categories.
2019-05-03 18:18:02 +08:00
The categories can be:
'h' = Hero
'v' = Vehicle
'w' = Walker
't' = Traffic light
'o' = Other
'a' = Any
2019-04-25 18:00:31 +08:00
So, if you want to see only collisions about a vehicle and a walker, we would use for category1 'v' and category2 'w'.
Or if you want all the collisions (filter off) you can use 'a' as both categories.
2019-04-19 02:13:34 +08:00
# --------------------------------------
- def_name: show_recorder_actors_blocked
params:
2019-04-25 18:00:31 +08:00
- param_name: filename
type: str
doc: >
Name of the recorded file to load
- param_name: min_time
type: float
doc: >
How many seconds has to be stoped an actor to be considered as blocked
- param_name: min_distance
type: float
doc: >
How many centimeters needs to move the actor in order to be considered as moving, and not blocked
2019-04-19 02:13:34 +08:00
doc: >
2019-07-05 20:22:22 +08:00
Shows which actors seem blocked by some reason.
2019-04-25 18:00:31 +08:00
The idea is to calculate which actors are not moving as much as 'min_distance' for a period of 'min_time'.
By default min_time = 60 seconds (1 min) and min_distance = 100 centimeters (1 m).
2019-04-19 02:13:34 +08:00
# --------------------------------------
- def_name: replay_file
params:
2019-07-01 23:46:27 +08:00
- param_name: name
type: str
doc: >
Name of the file.
2019-04-25 18:00:31 +08:00
- param_name: start
type: float
doc: >
Time in seconds where to start the playback. If it is negative, then it starts from the end.
- param_name: duration
type: float
doc: >
Id of the actor to follow. If this is 0 then camera is disabled
2019-07-01 23:46:27 +08:00
- param_name: follow_id
type: int
doc: >
2019-04-19 02:13:34 +08:00
doc: >
2019-04-25 18:00:31 +08:00
Playback a file
2019-04-19 02:13:34 +08:00
# --------------------------------------
- def_name: set_replayer_time_factor
params:
2019-04-25 18:00:31 +08:00
- param_name: time_factor
type: float
doc: >
A value of 1.0 means normal time factor.
A value < 1.0 means slow motion (for example 0.5 is half speed)
A value > 1.0 means fast motion (for example 2.0 is double speed)
2019-04-19 02:13:34 +08:00
doc: >
2019-04-25 18:00:31 +08:00
Apply a different playback speed to current playback. Can be used several times while a playback is in curse.
2019-04-19 02:13:34 +08:00
# --------------------------------------
- def_name: apply_batch
params:
- param_name: commands
type: list
doc: >
2019-07-05 20:53:24 +08:00
A list of commands to execute in batch. Each command has a different number of parameters.
2019-07-09 23:23:35 +08:00
Currently, we can use these [commands](#command.ApplyAngularVelocity):
SpawnActor
DestroyActor
ApplyVehicleControl
ApplyWalkerControl
ApplyTransform
ApplyVelocity
AplyAngularVelocity
ApplyImpulse
SetSimulatePhysics
SetAutopilot
doc: >
This function executes the whole list of commands on a single simulation step.
2019-07-05 20:53:24 +08:00
For example, to set autopilot on some actors, we could use:
[sample_code](https://github.com/carla-simulator/carla/blob/10c5f6a482a21abfd00220c68c7f12b4110b7f63/PythonAPI/examples/spawn_npc.py#L126).
We don't have control about the response of each command. If we need that, we can use `apply_batch_sync()`.
2019-04-19 02:13:34 +08:00
# --------------------------------------
- def_name: apply_batch_sync
params:
- param_name: commands
type: list
doc: >
A list of commands to execute in batch. For a list of commands available see function above apply_batch().
return: list
2019-04-19 02:13:34 +08:00
doc: >
This function executes the whole list of commands on a single simulation
step, blocks until the commands are executed, and returns a list of
2019-07-09 23:23:35 +08:00
[`command.Response`](#command.Response) that can be used to determine whether a single
command succeeded or not.
[sample_code](https://github.com/carla-simulator/carla/blob/10c5f6a482a21abfd00220c68c7f12b4110b7f63/PythonAPI/examples/spawn_npc.py#L112-L116)
2019-07-04 21:50:10 +08:00
# --------------------------------------
2019-04-19 02:13:34 +08:00
...