diff --git a/Docs/python_api.md b/Docs/python_api.md index a0db5d637..546c002d0 100644 --- a/Docs/python_api.md +++ b/Docs/python_api.md @@ -165,13 +165,13 @@ - [**load_world**(**self**, **map_name**)](#carla.Client.load_world) _Method_ - [**start_recorder**(**self**, **filename**)](#carla.Client.start_recorder) _Method_ - [**stop_recorder**(**self**)](#carla.Client.stop_recorder) _Method_ - - [**show_recorder_file_info**(**self**, **filename**, **show_all**=False)](#carla.Client.show_recorder_file_info) _Method_ - - [**show_recorder_collisions**(**self**, **filename**, **category1**='a', **category2**='a')](#carla.Client.show_recorder_collisions) _Method_ - - [**show_recorder_actors_blocked**(**self**, **filename**, **min_time**=60.0, **min_distance**=100.0)](#carla.Client.show_recorder_actors_blocked) _Method_ - - [**replay_file**(**self**, **filename**, **start**=0.0, **duration**=0.0, **camera**=0)](#carla.Client.replay_file) _Method_ + - [**show_recorder_file_info**(**self**, **filename**, **show_all**)](#carla.Client.show_recorder_file_info) _Method_ + - [**show_recorder_collisions**(**self**, **filename**, **category1**, **category2**)](#carla.Client.show_recorder_collisions) _Method_ + - [**show_recorder_actors_blocked**(**self**, **filename**, **min_time**, **min_distance**)](#carla.Client.show_recorder_actors_blocked) _Method_ + - [**replay_file**(**self**, **start**, **duration**)](#carla.Client.replay_file) _Method_ - [**set_replayer_time_factor**(**self**, **time_factor**)](#carla.Client.set_replayer_time_factor) _Method_ - - [**apply_batch**(**self**)](#carla.Client.apply_batch) _Method_ - - [**apply_batch_sync**(**self**)](#carla.Client.apply_batch_sync) _Method_ + - [**apply_batch**(**self**, **commands**)](#carla.Client.apply_batch) _Method_ + - [**apply_batch_sync**(**self**, **commands**)](#carla.Client.apply_batch_sync) _Method_ - [**CollisionEvent**](#carla.CollisionEvent) _Class_ - [**actor**](#carla.CollisionEvent.actor) _Instance variable_ - [**other_actor**](#carla.CollisionEvent.other_actor) _Instance variable_ @@ -375,7 +375,7 @@ - [**\__ne__**(**self**, **other**)](#carla.Location.__ne__) _Method_ - [**Sensor**](#carla.Sensor) _Class_ - [**is_listening**](#carla.Sensor.is_listening) _Instance variable_ - - [**listen**(**self**)](#carla.Sensor.listen) _Method_ + - [**listen**(**self**, **callback**)](#carla.Sensor.listen) _Method_ - [**stop**(**self**)](#carla.Sensor.stop) _Method_ - [**TrafficLight**](#carla.TrafficLight) _Class_ - [**state**](#carla.TrafficLight.state) _Instance variable_ @@ -778,59 +778,81 @@ Get the client version as a string. Get the server version as a string. - **Return:** _str_ - **get_world**(**self**) -Get the server version as a string. +Get the world object from where we can get other information about the map. - **get_available_maps**(**self**) +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'. - **reload_world**(**self**) +Start again current world. - **Raises:** RuntimeError - **load_world**(**self**, **map_name**) +Load one of the available worlds on server. - **Parameters:** - - `map_name` (_str_) – Name of the map to load. + - `map_name` (_str_) – Name of the map to load, like '/Game/Carla/Maps/Town01'. - **start_recorder**(**self**, **filename**) 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'. - **Parameters:** - - `filename` (_str_) – Name of the file to create. + - `filename` (_str_) – Name of the file to write the recorded data. - **stop_recorder**(**self**) Stops the recording in curse. -- **show_recorder_file_info**(**self**, **filename**, **show_all**=False) -Will show info about the recorded file. 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. +- **show_recorder_file_info**(**self**, **filename**, **show_all**) +Will show info about the recorded file (frames, times, events, state, positions...) 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. - **Parameters:** - `filename` (_str_) – Name of the recorded file to load. - `show_all` (_bool_) – Show all detailed info, or just a summary. -- **show_recorder_collisions**(**self**, **filename**, **category1**='a', **category2**='a') +- **show_recorder_collisions**(**self**, **filename**, **category1**, **category2**) This will show which collisions were recorded in the file. We can use a filter for the collisions we want, using two categories. The categories can be: - \- `h` = Hero - \- `v` = Vehicle - \- `w` = Walker - \- `t` = Traffic light - \- `o` = Other - \- `a` = Any -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 categories. + 'h' = Hero + 'v' = Vehicle + 'w' = Walker + 't' = Traffic light + 'o' = Other + 'a' = Any +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. - **Parameters:** - `filename` (_str_) – Name of the recorded file to load. - `category1` (_single char_) – Character specifying the category of the first actor. - `category2` (_single char_) – Character specifying the category of the second actor. -- **show_recorder_actors_blocked**(**self**, **filename**, **min_time**=60.0, **min_distance**=100.0) +- **show_recorder_actors_blocked**(**self**, **filename**, **min_time**, **min_distance**) Shows which actors seems blocked by some reason. 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). - **Parameters:** - `filename` (_str_) – Name of the recorded file to load. - `min_time` (_float_) – How many seconds has to be stoped an actor to be considered as blocked. - - `min_distance` (_float_) – How many centimeters needs to displace an actor in order to not be considered as blocked. -- **replay_file**(**self**, **filename**, **start**=0.0, **duration**=0.0, **camera**=0) + - `min_distance` (_float_) – How many centimeters needs to move the actor in order to be considered as moving, and not blocked. +- **replay_file**(**self**, **start**, **duration**) Playback a file. - **Parameters:** - - `filename` (_str_) – Name of the recorded file to play. - `start` (_float_) – Time in seconds where to start the playback. If it is negative, then it starts from the end. - - `duration` (_float_) – Time of playback, after that time the playback stops and all the actors are left driving in autopilot. A value of 0 means playback until the end. - - `camera` (_int_) – Id of the actor to follow. If this is 0 then camera is disabled. + - `duration` (_int_) – Id of the actor to follow. If this is 0 then camera is disabled. - **set_replayer_time_factor**(**self**, **time_factor**) Apply a different playback speed to current playback. Can be used several times while a playback is in curse. - **Parameters:** - - `time_factor` (_float_) – These values means: - \- 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). -- **apply_batch**(**self**) -- **apply_batch_sync**(**self**) + - `time_factor` (_float_) – 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). +- **apply_batch**(**self**, **commands**) +This function executes some commands altogether as fast as it can. For example, to set autopilot on 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(). + - **Parameters:** + - `commands` (_list_) – A list of commands to execute in batch. Each command have a different number of parameters. Currently we can use these [commands](#commands.ApplyAngularVelocity): + SpawnActor + DestroyActor + ApplyVehicleControl + ApplyWalkerControl + ApplyTransform + ApplyVelocity + AplyAngularVelocity + ApplyImpulse + SetSimulatePhysics + SetAutopilot. +- **apply_batch_sync**(**self**, **commands**) +This function executes some commands altogether as fast as it can one after the other, and returns another list with all the responses from each command. [sample_code](https://github.com/carla-simulator/carla/blob/10c5f6a482a21abfd00220c68c7f12b4110b7f63/PythonAPI/examples/spawn_npc.py#L112-L116). + - **Parameters:** + - `commands` (_list_) – A list of commands to execute in batch. For a list of commands available see function above apply_batch(). + - **Return:** _list_ --- @@ -1041,24 +1063,32 @@ Vector 3D helper class. VehicleControl is used for controlling the basic movement of a vehicle.