From db2697108ab22391bf3f78bc2e34519ef0839ecb Mon Sep 17 00:00:00 2001 From: Daniel Date: Wed, 24 Jul 2024 16:15:21 +0200 Subject: [PATCH 01/11] Fixed wrong `literal` in doc generation --- Docs/python_api.md | 2 +- PythonAPI/docs/sensor_data.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Docs/python_api.md b/Docs/python_api.md index a7ab163a2..ef39c7a20 100644 --- a/Docs/python_api.md +++ b/Docs/python_api.md @@ -931,7 +931,7 @@ Initializes a color, black by default. --- ## carla.GBufferTextureID -Defines the of each GBuffer texture (See the method `[carla.Sensor.listen_to_gbuffer](#carla.Sensor.listen_to_gbuffer)`). +Defines the identifiers of each GBuffer texture (See the method [carla.Sensor.listen_to_gbuffer](#carla.Sensor.listen_to_gbuffer)). ### Instance Variables - **SceneColor** diff --git a/PythonAPI/docs/sensor_data.yml b/PythonAPI/docs/sensor_data.yml index cdd394a56..1f7fdb9cd 100644 --- a/PythonAPI/docs/sensor_data.yml +++ b/PythonAPI/docs/sensor_data.yml @@ -880,7 +880,7 @@ - class_name: GBufferTextureID # - DESCRIPTION ------------------------ doc: > - Defines the of each GBuffer texture (See the method `carla.Sensor.listen_to_gbuffer`). + Defines the identifiers of each GBuffer texture (See the method carla.Sensor.listen_to_gbuffer). # - PROPERTIES ------------------------- instance_variables: - var_name: SceneColor From b5b1168892c421bebdfad7ded6f067edb4471f44 Mon Sep 17 00:00:00 2001 From: Daniel Date: Wed, 24 Jul 2024 18:06:10 +0200 Subject: [PATCH 02/11] Fix Spelling mistakes --- Docs/python_api.md | 26 +++++++++---------- .../carla/agents/navigation/basic_agent.py | 8 +++--- .../navigation/constant_velocity_agent.py | 2 +- .../carla/agents/navigation/controller.py | 2 +- .../carla/agents/navigation/local_planner.py | 4 +-- PythonAPI/docs/actor.yml | 14 +++++----- PythonAPI/docs/bp_doc_gen.py | 2 +- PythonAPI/docs/weather.yml | 2 +- PythonAPI/docs/world.yml | 18 ++++++------- 9 files changed, 39 insertions(+), 39 deletions(-) diff --git a/Docs/python_api.md b/Docs/python_api.md index ef39c7a20..faad5c525 100644 --- a/Docs/python_api.md +++ b/Docs/python_api.md @@ -95,21 +95,21 @@ _ ##### Getters - **get_acceleration**(**self**) -Returns the actor's 3D acceleration vector the client recieved during last tick. The method does not call the simulator. +Returns the actor's 3D acceleration vector the client received during last tick. The method does not call the simulator. - **Return:** _[carla.Vector3D](#carla.Vector3D) - m/s2_ - **get_angular_velocity**(**self**) -Returns the actor's angular velocity vector the client recieved during last tick. The method does not call the simulator. +Returns the actor's angular velocity vector the client received during last tick. The method does not call the simulator. - **Return:** _[carla.Vector3D](#carla.Vector3D) - deg/s_ - **get_location**(**self**) -Returns the actor's location the client recieved during last tick. The method does not call the simulator. +Returns the actor's location the client received during last tick. The method does not call the simulator. - **Return:** _[carla.Location](#carla.Location) - meters_ - **Setter:** _[carla.Actor.set_location](#carla.Actor.set_location)_ - **get_transform**(**self**) -Returns the actor's transform (location and rotation) the client recieved during last tick. The method does not call the simulator. +Returns the actor's transform (location and rotation) the client received during last tick. The method does not call the simulator. - **Return:** _[carla.Transform](#carla.Transform)_ - **Setter:** _[carla.Actor.set_transform](#carla.Actor.set_transform)_ - **get_velocity**(**self**) -Returns the actor's velocity vector the client recieved during last tick. The method does not call the simulator. +Returns the actor's velocity vector the client received during last tick. The method does not call the simulator. - **Return:** _[carla.Vector3D](#carla.Vector3D) - m/s_ - **get_world**(**self**) Returns the world this actor belongs to. @@ -2495,7 +2495,7 @@ Time register of the frame at which this measurement was taken given by the OS i ## carla.TrafficLight Inherited from _[carla.TrafficSign](#carla.TrafficSign)_
-A traffic light actor, considered a specific type of traffic sign. As traffic lights will mostly appear at junctions, they belong to a group which contains the different traffic lights in it. Inside the group, traffic lights are differenciated by their pole index. +A traffic light actor, considered a specific type of traffic sign. As traffic lights will mostly appear at junctions, they belong to a group which contains the different traffic lights in it. Inside the group, traffic lights are differentiated by their pole index. Within a group the state of traffic lights is changed in a cyclic pattern: one index is chosen and it spends a few seconds in green, yellow and eventually red. The rest of the traffic lights remain frozen in red this whole time, meaning that there is a gap in the last seconds of the cycle where all the traffic lights are red. However, the state of a traffic light can be changed manually. @@ -2957,7 +2957,7 @@ Returns the axis values for the vector parsed as string. ## carla.Vehicle Inherited from _[carla.Actor](#carla.Actor)_
-One of the most important groups of actors in CARLA. These include any type of vehicle from cars to trucks, motorbikes, vans, bycicles and also official vehicles such as police cars. A wide set of these actors is provided in [carla.BlueprintLibrary](#carla.BlueprintLibrary) to facilitate differente requirements. Vehicles can be either manually controlled or set to an autopilot mode that will be conducted client-side by the traffic manager. +One of the most important groups of actors in CARLA. These include any type of vehicle from cars to trucks, motorbikes, vans, bicycles and also official vehicles such as police cars. A wide set of these actors is provided in [carla.BlueprintLibrary](#carla.BlueprintLibrary) to facilitate different requirements. Vehicles can be either manually controlled or set to an autopilot mode that will be conducted client-side by the traffic manager. ### Instance Variables - **bounding_box** (_[carla.BoundingBox](#carla.BoundingBox)_) @@ -3515,7 +3515,7 @@ Will return None if the lane does not exist. ## carla.WeatherParameters This class defines objects containing lighting and weather specifications that can later be applied in [carla.World](#carla.World). So far, these conditions only intervene with [sensor.camera.rgb](ref_sensors.md#rgb-camera). They neither affect the actor's physics nor other sensors. - Each of these parameters acts indepently from the rest. Increasing the rainfall will not automatically create puddles nor change the road's humidity. That makes for a better customization but means that realistic conditions need to be scripted. However an example of dynamic weather conditions working realistically can be found [here](https://github.com/carla-simulator/carla/blob/master/PythonAPI/examples/dynamic_weather.py). + Each of these parameters acts independently from the rest. Increasing the rainfall will not automatically create puddles nor change the road's humidity. That makes for a better customization but means that realistic conditions need to be scripted. However an example of dynamic weather conditions working realistically can be found [here](https://github.com/carla-simulator/carla/blob/master/PythonAPI/examples/dynamic_weather.py). ### Instance Variables - **cloudiness** (_float_) @@ -3632,25 +3632,25 @@ Responsible for creating different shapes for debugging. Take a look at its clas ### Methods - **apply_color_texture_to_object**(**self**, **object_name**, **material_parameter**, **texture**) -Applies a `texture` object in the field corresponfing to `material_parameter` (normal, diffuse, etc) to the object in the scene corresponding to `object_name`. +Applies a `texture` object in the field corresponding to `material_parameter` (normal, diffuse, etc) to the object in the scene corresponding to `object_name`. - **Parameters:** - `object_name` (_str_) - `material_parameter` (_[carla.MaterialParameter](#carla.MaterialParameter)_) - `texture` (_TextureColor_) - **apply_color_texture_to_objects**(**self**, **objects_name_list**, **material_parameter**, **texture**) -Applies a `texture` object in the field corresponfing to `material_parameter` (normal, diffuse, etc) to the object in the scene corresponding to all objects in `objects_name_list`. +Applies a `texture` object in the field corresponding to `material_parameter` (normal, diffuse, etc) to the object in the scene corresponding to all objects in `objects_name_list`. - **Parameters:** - `objects_name_list` (_list(str)_) - `material_parameter` (_[carla.MaterialParameter](#carla.MaterialParameter)_) - `texture` (_TextureColor_) - **apply_float_color_texture_to_object**(**self**, **object_name**, **material_parameter**, **texture**) -Applies a `texture` object in the field corresponfing to `material_parameter` (normal, diffuse, etc) to the object in the scene corresponding to `object_name`. +Applies a `texture` object in the field corresponding to `material_parameter` (normal, diffuse, etc) to the object in the scene corresponding to `object_name`. - **Parameters:** - `object_name` (_str_) - `material_parameter` (_[carla.MaterialParameter](#carla.MaterialParameter)_) - `texture` (_TextureFloatColor_) - **apply_float_color_texture_to_objects**(**self**, **objects_name_list**, **material_parameter**, **texture**) -Applies a `texture` object in the field corresponfing to `material_parameter` (normal, diffuse, etc) to the object in the scene corresponding to all objects in `objects_name_list`. +Applies a `texture` object in the field corresponding to `material_parameter` (normal, diffuse, etc) to the object in the scene corresponding to all objects in `objects_name_list`. - **Parameters:** - `objects_name_list` (_list(str)_) - `material_parameter` (_[carla.MaterialParameter](#carla.MaterialParameter)_) @@ -3846,7 +3846,7 @@ _ - **set_pedestrians_seed**(**self**, **seed**) - **Parameters:** - `seed` (_int_) - Sets the seed to use for any random number generated in relation to pedestrians. - - **Note:** _Should be set before pedestrians are spawned. If you want to repeat the same exact bodies (blueprint) for each pedestrian, then use the same seed in the Python code (where the blueprint is choosen randomly) and here, otherwise the pedestrians will repeat the same paths but the bodies will be different. + - **Note:** _Should be set before pedestrians are spawned. If you want to repeat the same exact bodies (blueprint) for each pedestrian, then use the same seed in the Python code (where the blueprint is chosen randomly) and here, otherwise the pedestrians will repeat the same paths but the bodies will be different. _ - **set_weather**(**self**, **weather**) Changes the weather parameteres ruling the simulation to another ones defined in an object. diff --git a/PythonAPI/carla/agents/navigation/basic_agent.py b/PythonAPI/carla/agents/navigation/basic_agent.py index 2d0b9b91a..6413e65c7 100644 --- a/PythonAPI/carla/agents/navigation/basic_agent.py +++ b/PythonAPI/carla/agents/navigation/basic_agent.py @@ -6,7 +6,7 @@ """ This module implements an agent that roams around a track following random waypoints and avoiding other vehicles. The agent also responds to traffic lights. -It can also make use of the global route planner to follow a specifed route +It can also make use of the global route planner to follow a specified route """ import carla @@ -31,7 +31,7 @@ class BasicAgent(object): def __init__(self, vehicle, target_speed=20, opt_dict={}, map_inst=None, grp_inst=None): """ - Initialization the agent paramters, the local and the global planner. + Initialization the agent parameters, the local and the global planner. :param vehicle: actor to apply to agent logic onto :param target_speed: speed (in Km/h) at which the vehicle will move @@ -102,7 +102,7 @@ class BasicAgent(object): # Get the static elements of the scene self._lights_list = self._world.get_actors().filter("*traffic_light*") - self._lights_map = {} # Dictionary mapping a traffic light to a wp corrspoing to its trigger volume location + self._lights_map = {} # Dictionary mapping a traffic light to a wp corresponding to its trigger volume location def add_emergency_stop(self, control): """ @@ -325,7 +325,7 @@ class BasicAgent(object): """ Method to check if there is a vehicle in front of the agent blocking its path. - :param vehicle_list (list of carla.Vehicle): list contatining vehicle objects. + :param vehicle_list (list of carla.Vehicle): list containing vehicle objects. If None, all vehicle in the scene are used :param max_distance: max freespace to check for obstacles. If None, the base threshold value is used diff --git a/PythonAPI/carla/agents/navigation/constant_velocity_agent.py b/PythonAPI/carla/agents/navigation/constant_velocity_agent.py index 8d3b1c5aa..c6e0e2446 100644 --- a/PythonAPI/carla/agents/navigation/constant_velocity_agent.py +++ b/PythonAPI/carla/agents/navigation/constant_velocity_agent.py @@ -6,7 +6,7 @@ """ This module implements an agent that roams around a track following random waypoints and avoiding other vehicles. The agent also responds to traffic lights. -It can also make use of the global route planner to follow a specifed route +It can also make use of the global route planner to follow a specified route """ import carla diff --git a/PythonAPI/carla/agents/navigation/controller.py b/PythonAPI/carla/agents/navigation/controller.py index a87488c74..45bf373ad 100644 --- a/PythonAPI/carla/agents/navigation/controller.py +++ b/PythonAPI/carla/agents/navigation/controller.py @@ -199,7 +199,7 @@ class PIDLateralController(): def run_step(self, waypoint): """ Execute one step of lateral control to steer - the vehicle towards a certain waypoin. + the vehicle towards a certain waypoint. :param waypoint: target waypoint :return: steering control in the range [-1, 1] where: diff --git a/PythonAPI/carla/agents/navigation/local_planner.py b/PythonAPI/carla/agents/navigation/local_planner.py index e4f4b7fb7..717e6aefa 100644 --- a/PythonAPI/carla/agents/navigation/local_planner.py +++ b/PythonAPI/carla/agents/navigation/local_planner.py @@ -151,7 +151,7 @@ class LocalPlanner(object): def follow_speed_limits(self, value=True): """ - Activates a flag that makes the max speed dynamically vary according to the spped limits + Activates a flag that makes the max speed dynamically vary according to the speed limits :param value: bool :return: @@ -316,7 +316,7 @@ def _retrieve_options(list_waypoints, current_waypoint): options = [] for next_waypoint in list_waypoints: # this is needed because something we are linking to - # the beggining of an intersection, therefore the + # the beginning of an intersection, therefore the # variation in angle is small next_next_waypoint = next_waypoint.next(3.0)[0] link = _compute_connection(current_waypoint, next_next_waypoint) diff --git a/PythonAPI/docs/actor.yml b/PythonAPI/docs/actor.yml index f87120827..9642847a0 100644 --- a/PythonAPI/docs/actor.yml +++ b/PythonAPI/docs/actor.yml @@ -120,30 +120,30 @@ return: carla.Vector3D return_units: m/s2 doc: > - Returns the actor's 3D acceleration vector the client recieved during last tick. The method does not call the simulator. + Returns the actor's 3D acceleration vector the client received during last tick. The method does not call the simulator. # -------------------------------------- - def_name: get_angular_velocity return: carla.Vector3D return_units: deg/s doc: > - Returns the actor's angular velocity vector the client recieved during last tick. The method does not call the simulator. + Returns the actor's angular velocity vector the client received during last tick. The method does not call the simulator. # -------------------------------------- - def_name: get_location return: carla.Location return_units: meters doc: > - Returns the actor's location the client recieved during last tick. The method does not call the simulator. + Returns the actor's location the client received during last tick. The method does not call the simulator. # -------------------------------------- - def_name: get_transform return: carla.Transform doc: > - Returns the actor's transform (location and rotation) the client recieved during last tick. The method does not call the simulator. + Returns the actor's transform (location and rotation) the client received during last tick. The method does not call the simulator. # -------------------------------------- - def_name: get_velocity return: carla.Vector3D return_units: m/s doc: > - Returns the actor's velocity vector the client recieved during last tick. The method does not call the simulator. + Returns the actor's velocity vector the client received during last tick. The method does not call the simulator. # -------------------------------------- - def_name: get_world return: carla.World @@ -252,7 +252,7 @@ parent: carla.Actor # - DESCRIPTION ------------------------ doc: > - One of the most important groups of actors in CARLA. These include any type of vehicle from cars to trucks, motorbikes, vans, bycicles and also official vehicles such as police cars. A wide set of these actors is provided in carla.BlueprintLibrary to facilitate differente requirements. Vehicles can be either manually controlled or set to an autopilot mode that will be conducted client-side by the traffic manager. + One of the most important groups of actors in CARLA. These include any type of vehicle from cars to trucks, motorbikes, vans, bicycles and also official vehicles such as police cars. A wide set of these actors is provided in carla.BlueprintLibrary to facilitate different requirements. Vehicles can be either manually controlled or set to an autopilot mode that will be conducted client-side by the traffic manager. # - PROPERTIES ------------------------- instance_variables: - var_name: bounding_box @@ -591,7 +591,7 @@ parent: carla.TrafficSign # - DESCRIPTION ------------------------ doc: > - A traffic light actor, considered a specific type of traffic sign. As traffic lights will mostly appear at junctions, they belong to a group which contains the different traffic lights in it. Inside the group, traffic lights are differenciated by their pole index. + A traffic light actor, considered a specific type of traffic sign. As traffic lights will mostly appear at junctions, they belong to a group which contains the different traffic lights in it. Inside the group, traffic lights are differentiated by their pole index. Within a group the state of traffic lights is changed in a cyclic pattern: one index is chosen and it spends a few seconds in green, yellow and eventually red. The rest of the traffic lights remain frozen in red this whole time, meaning that there is a gap in the last seconds of the cycle where all the traffic lights are red. However, the state of a traffic light can be changed manually. # - PROPERTIES ------------------------- diff --git a/PythonAPI/docs/bp_doc_gen.py b/PythonAPI/docs/bp_doc_gen.py index ef78b1f29..a58cea180 100644 --- a/PythonAPI/docs/bp_doc_gen.py +++ b/PythonAPI/docs/bp_doc_gen.py @@ -23,7 +23,7 @@ except IndexError: print(" .---------------------------------------------------.") print(" | Make sure the python client is compiled! |") print(" '---------------------------------------------------'\n") - # We don't provide an error to prvent Travis checks failing + # We don't provide an error to prevent Travis checks failing sys.exit(0) import carla diff --git a/PythonAPI/docs/weather.yml b/PythonAPI/docs/weather.yml index c5189c68e..dfd6d8cc0 100644 --- a/PythonAPI/docs/weather.yml +++ b/PythonAPI/docs/weather.yml @@ -7,7 +7,7 @@ # - DESCRIPTION ------------------------ doc: > This class defines objects containing lighting and weather specifications that can later be applied in carla.World. So far, these conditions only intervene with [sensor.camera.rgb](ref_sensors.md#rgb-camera). They neither affect the actor's physics nor other sensors. - Each of these parameters acts indepently from the rest. Increasing the rainfall will not automatically create puddles nor change the road's humidity. That makes for a better customization but means that realistic conditions need to be scripted. However an example of dynamic weather conditions working realistically can be found [here](https://github.com/carla-simulator/carla/blob/master/PythonAPI/examples/dynamic_weather.py). + Each of these parameters acts independently from the rest. Increasing the rainfall will not automatically create puddles nor change the road's humidity. That makes for a better customization but means that realistic conditions need to be scripted. However an example of dynamic weather conditions working realistically can be found [here](https://github.com/carla-simulator/carla/blob/master/PythonAPI/examples/dynamic_weather.py). # - PROPERTIES ------------------------- instance_variables: - var_name: cloudiness diff --git a/PythonAPI/docs/world.yml b/PythonAPI/docs/world.yml index 5edd3b609..f694b4695 100644 --- a/PythonAPI/docs/world.yml +++ b/PythonAPI/docs/world.yml @@ -143,7 +143,7 @@ doc: > 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. + When disabled, pedestrians are simulated as ragdolls with more realistic simulation and collision but no determinism can be ensured. - var_name: tile_stream_distance type: float doc: > @@ -460,7 +460,7 @@ - var_name: id type: int doc: > - The ID of the episode associated with this world. Episodes are different sessions of a simulation. These change everytime a world is disabled or reloaded. Keeping track is useful to avoid possible issues. + The ID of the episode associated with this world. Episodes are different sessions of a simulation. These change every time a world is disabled or reloaded. Keeping track is useful to avoid possible issues. - var_name: debug type: carla.DebugHelper doc: > @@ -485,7 +485,7 @@ doc: > Function with a snapshot as compulsory parameter that will be called when the client receives a tick. doc: > - This method is used in [__asynchronous__ mode](https://carla.readthedocs.io/en/latest/adv_synchrony_timestep/). It starts callbacks from the client for the function defined as `callback`, and returns the ID of the callback. The function will be called everytime the server ticks. It requires a carla.WorldSnapshot as argument, which can be retrieved from __wait_for_tick()__. Use __remove_on_tick()__ to stop the callbacks. + This method is used in [__asynchronous__ mode](https://carla.readthedocs.io/en/latest/adv_synchrony_timestep/). It starts callbacks from the client for the function defined as `callback`, and returns the ID of the callback. The function will be called every time the server ticks. It requires a carla.WorldSnapshot as argument, which can be retrieved from __wait_for_tick()__. Use __remove_on_tick()__ to stop the callbacks. # -------------------------------------- - def_name: remove_on_tick params: @@ -744,7 +744,7 @@ doc: > New conditions to be applied. doc: > - Changes the weather parameteres ruling the simulation to another ones defined in an object. + Changes the weather parameters ruling the simulation to another ones defined in an object. # -------------------------------------- - def_name: cast_ray return: list(carla.LabelledPoint) @@ -831,7 +831,7 @@ Sets the seed to use for any random number generated in relation to pedestrians. note: > Should be set before pedestrians are spawned. - If you want to repeat the same exact bodies (blueprint) for each pedestrian, then use the same seed in the Python code (where the blueprint is choosen randomly) and here, otherwise the pedestrians will repeat the same paths but the bodies will be different. + If you want to repeat the same exact bodies (blueprint) for each pedestrian, then use the same seed in the Python code (where the blueprint is chosen randomly) and here, otherwise the pedestrians will repeat the same paths but the bodies will be different. # -------------------------------------- - def_name: apply_color_texture_to_object params: @@ -842,7 +842,7 @@ - param_name: texture type: TextureColor doc: > - Applies a `texture` object in the field corresponfing to `material_parameter` (normal, diffuse, etc) to the object in the scene corresponding to `object_name`. + Applies a `texture` object in the field corresponding to `material_parameter` (normal, diffuse, etc) to the object in the scene corresponding to `object_name`. # -------------------------------------- - def_name: apply_float_color_texture_to_object params: @@ -853,7 +853,7 @@ - param_name: texture type: TextureFloatColor doc: > - Applies a `texture` object in the field corresponfing to `material_parameter` (normal, diffuse, etc) to the object in the scene corresponding to `object_name`. + Applies a `texture` object in the field corresponding to `material_parameter` (normal, diffuse, etc) to the object in the scene corresponding to `object_name`. # -------------------------------------- - def_name: apply_textures_to_object params: @@ -879,7 +879,7 @@ - param_name: texture type: TextureColor doc: > - Applies a `texture` object in the field corresponfing to `material_parameter` (normal, diffuse, etc) to the object in the scene corresponding to all objects in `objects_name_list`. + Applies a `texture` object in the field corresponding to `material_parameter` (normal, diffuse, etc) to the object in the scene corresponding to all objects in `objects_name_list`. # -------------------------------------- - def_name: apply_float_color_texture_to_objects params: @@ -890,7 +890,7 @@ - param_name: texture type: TextureFloatColor doc: > - Applies a `texture` object in the field corresponfing to `material_parameter` (normal, diffuse, etc) to the object in the scene corresponding to all objects in `objects_name_list`. + Applies a `texture` object in the field corresponding to `material_parameter` (normal, diffuse, etc) to the object in the scene corresponding to all objects in `objects_name_list`. # -------------------------------------- - def_name: apply_textures_to_objects params: From fa0b470a782a0518d805f832efef8b32cca5d891 Mon Sep 17 00:00:00 2001 From: Daniel Date: Wed, 24 Jul 2024 18:13:32 +0200 Subject: [PATCH 03/11] Removed reintroduced code of overwritten property --- PythonAPI/docs/sensor.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/PythonAPI/docs/sensor.yml b/PythonAPI/docs/sensor.yml index 5885217cd..e7e076443 100644 --- a/PythonAPI/docs/sensor.yml +++ b/PythonAPI/docs/sensor.yml @@ -26,10 +26,6 @@ - [V2X sensor](ref_sensors.md#v2x-sensor) # - PROPERTIES ------------------------- instance_variables: - - var_name: is_listening - type: boolean - doc: > - When **True** the sensor will be waiting for data. # - METHODS ---------------------------- methods: - def_name: listen From fd8d6122dd92cac7782a998b6712a9ccd9cc3149 Mon Sep 17 00:00:00 2001 From: Daniel Date: Wed, 24 Jul 2024 18:16:23 +0200 Subject: [PATCH 04/11] Apply changes to .md output --- Docs/python_api.md | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/Docs/python_api.md b/Docs/python_api.md index faad5c525..e30667d51 100644 --- a/Docs/python_api.md +++ b/Docs/python_api.md @@ -2321,10 +2321,6 @@ Sensors compound a specific family of actors quite diverse and unique. They are - [Obstacle detector](ref_sensors.md#obstacle-detector)
- [V2X sensor](ref_sensors.md#v2x-sensor). -### Instance Variables -- **is_listening** (_boolean_) -When **True** the sensor will be waiting for data. - ### Methods - **disable_for_ros**(**self**) Commands the sensor to not be processed for publishing in ROS2 if there is no any listen to it. @@ -3626,7 +3622,7 @@ World objects are created by the client to have a place for the simulation to ha ### Instance Variables - **id** (_int_) -The ID of the episode associated with this world. Episodes are different sessions of a simulation. These change everytime a world is disabled or reloaded. Keeping track is useful to avoid possible issues. +The ID of the episode associated with this world. Episodes are different sessions of a simulation. These change every time a world is disabled or reloaded. Keeping track is useful to avoid possible issues. - **debug** (_[carla.DebugHelper](#carla.DebugHelper)_) Responsible for creating different shapes for debugging. Take a look at its class to learn more about it. @@ -3705,7 +3701,7 @@ Loads the selected layers to the level. If the layer is already loaded the call - `map_layers` (_[carla.MapLayer](#carla.MapLayer)_) - Mask of level layers to be loaded. - **Warning:** _This only affects "Opt" maps. The minimum layout includes roads, sidewalks, traffic lights and traffic signs._ - **on_tick**(**self**, **callback**) -This method is used in [__asynchronous__ mode](https://[carla.readthedocs.io](#carla.readthedocs.io)/en/latest/adv_synchrony_timestep/). It starts callbacks from the client for the function defined as `callback`, and returns the ID of the callback. The function will be called everytime the server ticks. It requires a [carla.WorldSnapshot](#carla.WorldSnapshot) as argument, which can be retrieved from __wait_for_tick()__. Use __remove_on_tick()__ to stop the callbacks. +This method is used in [__asynchronous__ mode](https://[carla.readthedocs.io](#carla.readthedocs.io)/en/latest/adv_synchrony_timestep/). It starts callbacks from the client for the function defined as `callback`, and returns the ID of the callback. The function will be called every time the server ticks. It requires a [carla.WorldSnapshot](#carla.WorldSnapshot) as argument, which can be retrieved from __wait_for_tick()__. Use __remove_on_tick()__ to stop the callbacks. - **Parameters:** - `callback` (_[carla.WorldSnapshot](#carla.WorldSnapshot)_) - Function with a snapshot as compulsory parameter that will be called when the client receives a tick. - **Return:** _int_ @@ -3849,7 +3845,7 @@ _
- **Note:** _Should be set before pedestrians are spawned. If you want to repeat the same exact bodies (blueprint) for each pedestrian, then use the same seed in the Python code (where the blueprint is chosen randomly) and here, otherwise the pedestrians will repeat the same paths but the bodies will be different. _ - **set_weather**(**self**, **weather**) -Changes the weather parameteres ruling the simulation to another ones defined in an object. +Changes the weather parameters ruling the simulation to another ones defined in an object. - **Parameters:** - `weather` (_[carla.WeatherParameters](#carla.WeatherParameters)_) - New conditions to be applied. - **Getter:** _[carla.World.get_weather](#carla.World.get_weather)_ @@ -3880,7 +3876,7 @@ The maximum number of physics substepping that are allowed. By default, the valu - **max_culling_distance** (_float_) Configure the max draw distance for each mesh of the level. - **deterministic_ragdolls** (_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 determinism can be ensured. - **tile_stream_distance** (_float_) Used for large maps only. Configures the maximum distance from the hero vehicle to stream tiled maps. Regions of the map within this range will be visible (and capable of simulating physics). Regions outside this region will not be loaded. - **actor_active_distance** (_float_) From a74476e9eb84509ad0709a83296a359939adcc96 Mon Sep 17 00:00:00 2001 From: Daniel Date: Wed, 24 Jul 2024 18:35:25 +0200 Subject: [PATCH 05/11] Added space between # and first heading in python_api.md --- Docs/python_api.md | 2 +- PythonAPI/docs/doc_gen.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Docs/python_api.md b/Docs/python_api.md index e30667d51..ac3248830 100644 --- a/Docs/python_api.md +++ b/Docs/python_api.md @@ -1,4 +1,4 @@ -#Python API reference +# Python API reference This reference contains all the details the Python API. To consult a previous reference for a specific CARLA release, change the documentation version using the panel in the bottom right corner.
This will change the whole documentation to a previous state. Remember that the latest version is the `dev` branch and may show features not available in any packaged versions of CARLA.
## carla.AckermannControllerSettings diff --git a/PythonAPI/docs/doc_gen.py b/PythonAPI/docs/doc_gen.py index 0031b70f5..7c1a7dee2 100755 --- a/PythonAPI/docs/doc_gen.py +++ b/PythonAPI/docs/doc_gen.py @@ -75,7 +75,7 @@ class MarkdownFile: def first_title(self): self._data = join([ - self._data, '#Python API reference\n']) + self._data, '# Python API reference\n']) def title(self, strongness, buf): self._data = join([ From dee22b138d292ddc54152cf9ab894f164008ed00 Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 29 Jul 2024 17:30:41 +0200 Subject: [PATCH 06/11] Added OpendriveGenerationParameters.__init__ --- Docs/python_api.md | 14 +++++++++++++- PythonAPI/docs/client.yml | 34 +++++++++++++++++++++++++++++++++- 2 files changed, 46 insertions(+), 2 deletions(-) diff --git a/Docs/python_api.md b/Docs/python_api.md index ac3248830..b8c231fe3 100644 --- a/Docs/python_api.md +++ b/Docs/python_api.md @@ -1845,7 +1845,19 @@ If __True__, the mesh at junctions will be smoothed to prevent issues where road - **enable_mesh_visibility** (_bool_) If __True__, the road mesh will be rendered. Setting this to __False__ should reduce the rendering overhead. __Default is `True`__. - **enable_pedestrian_navigation** (_bool_) -If __True__, Pedestrian navigation will be enabled using Recast tool. For very large maps it is recomended to disable this option. __Default is `True`__. +If __True__, Pedestrian navigation will be enabled using Recast tool. For very large maps it is recommended to disable this option. __Default is `True`__. + +### Methods +- **\__init__**(**self**, **vertex_distance**=2.0, **max_road_length**=50.0, **wall_height**=1.0, **additional_width**=0.6, **smooth_junctions**=True, **enable_mesh_visibility**=True, **enable_pedestrian_navigation**=True) +OpendriveGenerationParameters constructor. + - **Parameters:** + - `vertex_distance` (_float - meters_) + - `max_road_length` (_float - meters_) + - `wall_height` (_float - meters_) + - `additional_width` (_float - meters_) + - `smooth_junctions` (_bool_) + - `enable_mesh_visibility` (_bool_) + - `enable_pedestrian_navigation` (_bool_) --- diff --git a/PythonAPI/docs/client.yml b/PythonAPI/docs/client.yml index 2977c9337..e8a811162 100644 --- a/PythonAPI/docs/client.yml +++ b/PythonAPI/docs/client.yml @@ -793,4 +793,36 @@ - var_name: enable_pedestrian_navigation type: bool doc: > - If __True__, Pedestrian navigation will be enabled using Recast tool. For very large maps it is recomended to disable this option. __Default is `True`__. + If __True__, Pedestrian navigation will be enabled using Recast tool. For very large maps it is recommended to disable this option. __Default is `True`__. + # - METHODS ---------------------------- + methods: + - def_name: __init__ + params: + - param_name: vertex_distance + type: float + param_units: meters + default: 2.0 + - param_name: max_road_length + type: float + param_units: meters + default: 50.0 + - param_name: wall_height + type: float + param_units: meters + default: 1.0 + - param_name: additional_width + type: float + param_units: meters + default: 0.6 + - param_name: smooth_junctions + type: bool + default: true + - param_name: enable_mesh_visibility + type: bool + default: true + - param_name: enable_pedestrian_navigation + type: bool + default: true + doc: > + OpendriveGenerationParameters constructor + From 9bb1e52581a60ac6d3bca9af41036330bd50c315 Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 29 Jul 2024 18:51:27 +0200 Subject: [PATCH 07/11] Missing default value --- Docs/python_api.md | 2 +- PythonAPI/docs/client.yml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Docs/python_api.md b/Docs/python_api.md index b8c231fe3..5a411a2f0 100644 --- a/Docs/python_api.md +++ b/Docs/python_api.md @@ -545,7 +545,7 @@ Reload the current world, note that a new world is created with default settings - `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. -- **replay_file**(**self**, **name**, **start**, **duration**, **follow_id**, **replay_sensors**) +- **replay_file**(**self**, **name**, **start**, **duration**, **follow_id**, **replay_sensors**=False) 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. - **Parameters:** - `name` (_str_) - Name of the file containing the information of the simulation. diff --git a/PythonAPI/docs/client.yml b/PythonAPI/docs/client.yml index e8a811162..4b15bb7db 100644 --- a/PythonAPI/docs/client.yml +++ b/PythonAPI/docs/client.yml @@ -169,6 +169,7 @@ ID of the actor to follow. If this is 0 then camera is disabled. - param_name: replay_sensors type: bool + default: false doc: > Flag to enable or disable the spawn of sensors during playback. doc: > From e9d9a1cd366933aef0982bb060ed48c6fafc6fcc Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 1 Aug 2024 16:13:25 +0200 Subject: [PATCH 08/11] corrected World.spaw_actor wrong parameter name --- Docs/python_api.md | 8 ++++---- PythonAPI/docs/world.yml | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Docs/python_api.md b/Docs/python_api.md index 5a411a2f0..3ed66db63 100644 --- a/Docs/python_api.md +++ b/Docs/python_api.md @@ -3730,13 +3730,13 @@ Stops the callback for `callback_id` started with __on_tic - `callback_id` (_callback_) - The callback to be removed. The ID is returned when creating the callback. - **reset_all_traffic_lights**(**self**) Resets the cycle of all traffic lights in the map to the initial state. -- **spawn_actor**(**self**, **blueprint**, **transform**, **attach_to**=None, **attachment**=Rigid) +- **spawn_actor**(**self**, **blueprint**, **transform**, **attach_to**=None, **attachment_type**=Rigid) The method will create, return and spawn an actor into the world. The actor will need an available blueprint to be created and a transform (location and rotation). It can also be attached to a parent with a certain attachment type. - **Parameters:** - `blueprint` (_[carla.ActorBlueprint](#carla.ActorBlueprint)_) - The reference from which the actor will be created. - `transform` (_[carla.Transform](#carla.Transform)_) - Contains the location and orientation the actor will be spawned with. - `attach_to` (_[carla.Actor](#carla.Actor)_) - The parent object that the spawned actor will follow around. - - `attachment` (_[carla.AttachmentType](#carla.AttachmentType)_) - Determines how fixed and rigorous should be the changes in position according to its parent object. + - `attachment_type` (_[carla.AttachmentType](#carla.AttachmentType)_) - Determines how fixed and rigorous should be the changes in position according to its parent object. - **Return:** _[carla.Actor](#carla.Actor)_ - **tick**(**self**, **seconds**=10.0) This method is used in [__synchronous__ mode](https://[carla.readthedocs.io](#carla.readthedocs.io)/en/latest/adv_synchrony_timestep/), when the server waits for a client tick before computing the next frame. This method will send the tick, and give way to the server. It returns the ID of the new frame computed by the server. @@ -3745,13 +3745,13 @@ This method is used in [__synchronous__ mode](https://[carla.readthedocs.io](#ca - **Return:** _int_ - **Note:** _If no tick is received in synchronous mode, the simulation will freeze. Also, if many ticks are received from different clients, there may be synchronization issues. Please read the docs about [synchronous mode](https://[carla.readthedocs.io](#carla.readthedocs.io)/en/latest/adv_synchrony_timestep/) to learn more. _ -- **try_spawn_actor**(**self**, **blueprint**, **transform**, **attach_to**=None, **attachment**=Rigid) +- **try_spawn_actor**(**self**, **blueprint**, **transform**, **attach_to**=None, **attachment_type**=Rigid) Same as __spawn_actor()__ but returns None on failure instead of throwing an exception. - **Parameters:** - `blueprint` (_[carla.ActorBlueprint](#carla.ActorBlueprint)_) - The reference from which the actor will be created. - `transform` (_[carla.Transform](#carla.Transform)_) - Contains the location and orientation the actor will be spawned with. - `attach_to` (_[carla.Actor](#carla.Actor)_) - The parent object that the spawned actor will follow around. - - `attachment` (_[carla.AttachmentType](#carla.AttachmentType)_) - Determines how fixed and rigorous should be the changes in position according to its parent object. + - `attachment_type` (_[carla.AttachmentType](#carla.AttachmentType)_) - Determines how fixed and rigorous should be the changes in position according to its parent object. - **Return:** _[carla.Actor](#carla.Actor)_ - **unload_map_layer**(**self**, **map_layers**) Unloads the selected layers to the level. If the layer is already unloaded the call has no effect. diff --git a/PythonAPI/docs/world.yml b/PythonAPI/docs/world.yml index f694b4695..7e0346212 100644 --- a/PythonAPI/docs/world.yml +++ b/PythonAPI/docs/world.yml @@ -538,7 +538,7 @@ default: None doc: > The parent object that the spawned actor will follow around. - - param_name: attachment + - param_name: attachment_type type: carla.AttachmentType default: Rigid doc: > @@ -562,7 +562,7 @@ default: None doc: > The parent object that the spawned actor will follow around. - - param_name: attachment + - param_name: attachment_type type: carla.AttachmentType default: Rigid doc: > From cdb2664350abaf814bcfeba1965426b3677da9fb Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 1 Aug 2024 17:05:36 +0200 Subject: [PATCH 09/11] Added inverse_transform and fixes for Transform inverse_transform from #7999 highlighted in-place character --- Docs/python_api.md | 14 +++++++++----- PythonAPI/docs/geom.yml | 17 +++++++++++++---- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/Docs/python_api.md b/Docs/python_api.md index 3ed66db63..1237d7381 100644 --- a/Docs/python_api.md +++ b/Docs/python_api.md @@ -2794,14 +2794,18 @@ Describes a rotation for an object according to Unreal Engine's axis system. - **Parameters:** - `location` (_[carla.Location](#carla.Location)_) - `rotation` (_[carla.Rotation](#carla.Rotation) - degrees (pitch, yaw, roll)_) +- **inverse_transform**(**self**, **in_point**) +Applies the inverse of `transform` by translating a 3D point in place from global to local coordinates using the current transformation as frame of reference. + - **Parameters:** + - `in_point` (_[carla.Vector3D](#carla.Vector3D)_) - Location in the space to which the inverse transformation will be applied. - **transform**(**self**, **in_point**) -Translates a 3D point from local to global coordinates using the current transformation as frame of reference. +Translates a 3D point in place from local to global coordinates using the current transformation as frame of reference. - **Parameters:** - - `in_point` (_[carla.Location](#carla.Location)_) - Location in the space to which the transformation will be applied. -- **transform_vector**(**self**, **in_vector**) -Rotates a vector using the current transformation as frame of reference, without applying translation. Use this to transform, for example, a velocity. + - `in_point` (_[carla.Vector3D](#carla.Vector3D)_) - Location in the space to which the transformation will be applied. +- **transform_vector**(**self**, **in_point**) +Rotates a vector in place using the current transformation as frame of reference, without applying translation. Use this to transform, for example, a velocity. - **Parameters:** - - `in_vector` (_[carla.Vector3D](#carla.Vector3D)_) - Vector to which the transformation will be applied. + - `in_point` (_[carla.Vector3D](#carla.Vector3D)_) - Vector to which the transformation will be applied. ##### Getters - **get_forward_vector**(**self**) diff --git a/PythonAPI/docs/geom.yml b/PythonAPI/docs/geom.yml index eb71836e4..03e5fdf48 100644 --- a/PythonAPI/docs/geom.yml +++ b/PythonAPI/docs/geom.yml @@ -438,20 +438,29 @@ - def_name: transform params: - param_name: in_point - type: carla.Location + type: carla.Vector3D doc: > Location in the space to which the transformation will be applied. doc: > - Translates a 3D point from local to global coordinates using the current transformation as frame of reference. + Translates a 3D point in place from local to global coordinates using the current transformation as frame of reference. + # -------------------------------------- + - def_name: inverse_transform + params: + - param_name: in_point + type: carla.Vector3D + doc: > + Location in the space to which the inverse transformation will be applied. + doc: > + Applies the inverse of `transform` by translating a 3D point in place from global to local coordinates using the current transformation as frame of reference. # -------------------------------------- - def_name: transform_vector params: - - param_name: in_vector + - param_name: in_point type: carla.Vector3D doc: > Vector to which the transformation will be applied. doc: > - Rotates a vector using the current transformation as frame of reference, without applying translation. Use this to transform, for example, a velocity. + Rotates a vector in place using the current transformation as frame of reference, without applying translation. Use this to transform, for example, a velocity. # -------------------------------------- - def_name: get_forward_vector return: carla.Vector3D From 944d0e225e8cb46b2540ff74fbab3f4b480b054f Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 15 Aug 2024 22:57:28 +0200 Subject: [PATCH 10/11] Better clarification of WorldSnapshot - removed deprecated frame_count from example - also exposed WorldSnapshot.elapsed_seconds --- Docs/python_api.md | 2 ++ PythonAPI/docs/snapshot.yml | 5 +++++ PythonAPI/examples/V2XDemo.py | 6 +++--- PythonAPI/examples/automatic_control.py | 8 ++++---- PythonAPI/examples/manual_control.py | 7 ++++--- PythonAPI/examples/manual_control_carsim.py | 7 ++++--- PythonAPI/examples/manual_control_chrono.py | 7 ++++--- PythonAPI/examples/manual_control_steeringwheel.py | 7 ++++--- PythonAPI/examples/no_rendering_mode.py | 6 +++--- PythonAPI/examples/rss/manual_control_rss.py | 7 ++++--- 10 files changed, 37 insertions(+), 25 deletions(-) diff --git a/Docs/python_api.md b/Docs/python_api.md index 1237d7381..8b1e00b00 100644 --- a/Docs/python_api.md +++ b/Docs/python_api.md @@ -3934,6 +3934,8 @@ This snapshot comprises all the information for every actor on scene at a certai A value unique for every snapshot to differentiate them. - **frame** (_int_) Simulation frame in which the snapshot was taken. +- **elapsed_seconds** (_float - seconds_) +Simulated seconds elapsed since the beginning of the current episode. - **timestamp** (_[carla.Timestamp](#carla.Timestamp) - seconds_) Precise moment in time when snapshot was taken. This class works in seconds as given by the operative system. diff --git a/PythonAPI/docs/snapshot.yml b/PythonAPI/docs/snapshot.yml index 9a9c7f2e6..bc5e72767 100644 --- a/PythonAPI/docs/snapshot.yml +++ b/PythonAPI/docs/snapshot.yml @@ -17,6 +17,11 @@ type: int doc: > Simulation frame in which the snapshot was taken. + - var_name: elapsed_seconds + type: float + var_units: seconds + doc: > + Simulated seconds elapsed since the beginning of the current episode. - var_name: timestamp type: carla.Timestamp var_units: seconds diff --git a/PythonAPI/examples/V2XDemo.py b/PythonAPI/examples/V2XDemo.py index eedfae968..0c4736ab5 100644 --- a/PythonAPI/examples/V2XDemo.py +++ b/PythonAPI/examples/V2XDemo.py @@ -685,11 +685,11 @@ class HUD(object): self._show_ackermann_info = False self._ackermann_control = carla.VehicleAckermannControl() - def on_world_tick(self, timestamp): + def on_world_tick(self, world_snapshot): self._server_clock.tick() self.server_fps = self._server_clock.get_fps() - self.frame = timestamp.frame - self.simulation_time = timestamp.elapsed_seconds + self.frame = world_snapshot.frame + self.simulation_time = world_snapshot.elapsed_seconds def tick(self, world, clock): self._notifications.tick(world, clock) diff --git a/PythonAPI/examples/automatic_control.py b/PythonAPI/examples/automatic_control.py index 330d9afe4..6950db492 100755 --- a/PythonAPI/examples/automatic_control.py +++ b/PythonAPI/examples/automatic_control.py @@ -282,12 +282,12 @@ class HUD(object): self._info_text = [] self._server_clock = pygame.time.Clock() - def on_world_tick(self, timestamp): - """Gets informations from the world at every tick""" + def on_world_tick(self, world_snapshot): + """Gets information from the world at every tick""" self._server_clock.tick() self.server_fps = self._server_clock.get_fps() - self.frame = timestamp.frame_count - self.simulation_time = timestamp.elapsed_seconds + self.frame = world_snapshot.frame + self.simulation_time = world_snapshot.elapsed_seconds def tick(self, world, clock): """HUD method for every tick""" diff --git a/PythonAPI/examples/manual_control.py b/PythonAPI/examples/manual_control.py index c35019ecb..7073d5289 100755 --- a/PythonAPI/examples/manual_control.py +++ b/PythonAPI/examples/manual_control.py @@ -685,11 +685,12 @@ class HUD(object): self._show_ackermann_info = False self._ackermann_control = carla.VehicleAckermannControl() - def on_world_tick(self, timestamp): + def on_world_tick(self, world_snapshot): + """Gets information from the world at every tick""" self._server_clock.tick() self.server_fps = self._server_clock.get_fps() - self.frame = timestamp.frame - self.simulation_time = timestamp.elapsed_seconds + self.frame = world_snapshot.frame + self.simulation_time = world_snapshot.elapsed_seconds def tick(self, world, clock): self._notifications.tick(world, clock) diff --git a/PythonAPI/examples/manual_control_carsim.py b/PythonAPI/examples/manual_control_carsim.py index bf476338f..904664d94 100644 --- a/PythonAPI/examples/manual_control_carsim.py +++ b/PythonAPI/examples/manual_control_carsim.py @@ -575,11 +575,12 @@ class HUD(object): self._info_text = [] self._server_clock = pygame.time.Clock() - def on_world_tick(self, timestamp): + def on_world_tick(self, world_snapshot): + """Gets information from the world at every tick""" self._server_clock.tick() self.server_fps = self._server_clock.get_fps() - self.frame = timestamp.frame - self.simulation_time = timestamp.elapsed_seconds + self.frame = world_snapshot.frame + self.simulation_time = world_snapshot.elapsed_seconds def tick(self, world, clock): self._notifications.tick(world, clock) diff --git a/PythonAPI/examples/manual_control_chrono.py b/PythonAPI/examples/manual_control_chrono.py index f72bc7ecf..54f034756 100644 --- a/PythonAPI/examples/manual_control_chrono.py +++ b/PythonAPI/examples/manual_control_chrono.py @@ -594,11 +594,12 @@ class HUD(object): self._info_text = [] self._server_clock = pygame.time.Clock() - def on_world_tick(self, timestamp): + def on_world_tick(self, world_snapshot): + """Gets information from the world at every tick""" self._server_clock.tick() self.server_fps = self._server_clock.get_fps() - self.frame = timestamp.frame - self.simulation_time = timestamp.elapsed_seconds + self.frame = world_snapshot.frame + self.simulation_time = world_snapshot.elapsed_seconds def tick(self, world, clock): self._notifications.tick(world, clock) diff --git a/PythonAPI/examples/manual_control_steeringwheel.py b/PythonAPI/examples/manual_control_steeringwheel.py index 3977263ec..fd109d48a 100755 --- a/PythonAPI/examples/manual_control_steeringwheel.py +++ b/PythonAPI/examples/manual_control_steeringwheel.py @@ -399,11 +399,12 @@ class HUD(object): self._info_text = [] self._server_clock = pygame.time.Clock() - def on_world_tick(self, timestamp): + def on_world_tick(self, world_snapshot): + """Gets information from the world at every tick""" self._server_clock.tick() self.server_fps = self._server_clock.get_fps() - self.frame = timestamp.frame - self.simulation_time = timestamp.elapsed_seconds + self.frame = world_snapshot.frame + self.simulation_time = world_snapshot.elapsed_seconds def tick(self, world, clock): self._notifications.tick(world, clock) diff --git a/PythonAPI/examples/no_rendering_mode.py b/PythonAPI/examples/no_rendering_mode.py index 075290411..4cfd01f4e 100755 --- a/PythonAPI/examples/no_rendering_mode.py +++ b/PythonAPI/examples/no_rendering_mode.py @@ -993,7 +993,7 @@ class World(object): # Register event for receiving server tick weak_self = weakref.ref(self) - self.world.on_tick(lambda timestamp: World.on_world_tick(weak_self, timestamp)) + self.world.on_tick(lambda world_snapshot: World.on_world_tick(weak_self, world_snapshot)) def select_hero_actor(self): """Selects only one hero actor if there are more than one. If there are not any, it will spawn one.""" @@ -1081,7 +1081,7 @@ class World(object): self._hud.add_info('HERO', hero_mode_text) @staticmethod - def on_world_tick(weak_self, timestamp): + def on_world_tick(weak_self, world_snapshot): """Updates the server tick""" self = weak_self() if not self: @@ -1089,7 +1089,7 @@ class World(object): self.server_clock.tick() self.server_fps = self.server_clock.get_fps() - self.simulation_time = timestamp.elapsed_seconds + self.simulation_time = world_snapshot.elapsed_seconds def _show_nearby_vehicles(self, vehicles): """Shows nearby vehicles of the hero actor""" diff --git a/PythonAPI/examples/rss/manual_control_rss.py b/PythonAPI/examples/rss/manual_control_rss.py index ff0b7e1c5..357685c02 100755 --- a/PythonAPI/examples/rss/manual_control_rss.py +++ b/PythonAPI/examples/rss/manual_control_rss.py @@ -616,11 +616,12 @@ class HUD(object): self._server_clock = pygame.time.Clock() self.rss_state_visualizer = RssStateVisualizer(self.dim, self._font_mono, self._world) - def on_world_tick(self, timestamp): + def on_world_tick(self, world_snapshot): + """Gets information from the world at every tick""" self._server_clock.tick() self.server_fps = self._server_clock.get_fps() - self.frame = timestamp.frame - self.simulation_time = timestamp.elapsed_seconds + self.frame = world_snapshot.frame + self.simulation_time = world_snapshot.elapsed_seconds def tick(self, player, clock): self._notifications.tick(clock) From dad5f5dc7bab5b52d81f3880b47b14da4407f197 Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 22 Aug 2024 12:44:56 +0200 Subject: [PATCH 11/11] Added and fixed Client.apply_batch signature --- Docs/python_api.md | 7 ++++--- PythonAPI/docs/client.yml | 9 +++++++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/Docs/python_api.md b/Docs/python_api.md index 8b1e00b00..a0344c0c7 100644 --- a/Docs/python_api.md +++ b/Docs/python_api.md @@ -505,15 +505,16 @@ Client constructor. - `host` (_str_) - IP address where a CARLA Simulator instance is running. Default is localhost (127.0.0.1). - `port` (_int_) - TCP port where the CARLA Simulator instance is running. Default are 2000 and the subsequent 2001. - `worker_threads` (_int_) - Number of working threads used for background updates. If 0, use all available concurrency. -- **apply_batch**(**self**, **commands**) +- **apply_batch**(**self**, **commands**, **do_tick**=False) Executes a list of commands on a single simulation step and retrieves no information. If you need information about the response of each command, use the __apply_batch_sync()__ method. [Here](https://github.com/carla-simulator/carla/blob/master/PythonAPI/examples/generate_traffic.py) is an example on how to delete the actors that appear in [carla.ActorList](#carla.ActorList) all at once. - **Parameters:** - `commands` (_list_) - A list of commands to execute in batch. Each command is different and has its own parameters. They appear listed at the bottom of this page. -- **apply_batch_sync**(**self**, **commands**, **due_tick_cue**=False) + - `do_tick` (_bool_) - A boolean parameter to specify whether or not to perform a [carla.World.tick](#carla.World.tick) after applying the batch in _synchronous mode_. Defaults to __False__. +- **apply_batch_sync**(**self**, **commands**, **do_tick**=False) Executes a list of commands on a single simulation step, blocks until the commands are linked, and returns a list of command.Response that can be used to determine whether a single command succeeded or not. [Here](https://github.com/carla-simulator/carla/blob/master/PythonAPI/examples/generate_traffic.py) is an example of it being used to spawn actors. - **Parameters:** - `commands` (_list_) - A list of commands to execute in batch. The commands available are listed right above, in the method **apply_batch()**. - - `due_tick_cue` (_bool_) - A boolean parameter to specify whether or not to perform a [carla.World.tick](#carla.World.tick) after applying the batch in _synchronous mode_. It is __False__ by default. + - `do_tick` (_bool_) - A boolean parameter to specify whether or not to perform a [carla.World.tick](#carla.World.tick) after applying the batch in _synchronous mode_. Defaults to __False__. - **Return:** _list(command.Response)_ - **generate_opendrive_world**(**self**, **opendrive**, **parameters**=(2.0, 50.0, 1.0, 0.6, true, true), **reset_settings**=True) Loads a new world with a basic 3D topology generated from the content of an OpenDRIVE file. This content is passed as a `string` parameter. It is similar to `client.load_world(map_name)` but allows for custom OpenDRIVE maps in server side. Cars can drive around the map, but there are no graphics besides the road and sidewalks. diff --git a/PythonAPI/docs/client.yml b/PythonAPI/docs/client.yml index 4b15bb7db..8b3247e9a 100644 --- a/PythonAPI/docs/client.yml +++ b/PythonAPI/docs/client.yml @@ -41,6 +41,11 @@ type: list doc: > A list of commands to execute in batch. Each command is different and has its own parameters. They appear listed at the bottom of this page. + - param_name: do_tick + type: bool + default: false + doc: > + A boolean parameter to specify whether or not to perform a carla.World.tick after applying the batch in _synchronous mode_. Defaults to __False__. doc: > Executes a list of commands on a single simulation step and retrieves no information. If you need information about the response of each command, use the __apply_batch_sync()__ method. [Here](https://github.com/carla-simulator/carla/blob/master/PythonAPI/examples/generate_traffic.py) is an example on how to delete the actors that appear in carla.ActorList all at once. @@ -51,11 +56,11 @@ type: list doc: > A list of commands to execute in batch. The commands available are listed right above, in the method **apply_batch()**. - - param_name: due_tick_cue + - param_name: do_tick type: bool default: false doc: > - A boolean parameter to specify whether or not to perform a carla.World.tick after applying the batch in _synchronous mode_. It is __False__ by default. + A boolean parameter to specify whether or not to perform a carla.World.tick after applying the batch in _synchronous mode_. Defaults to __False__. return: list(command.Response) doc: > Executes a list of commands on a single simulation step, blocks until the commands are linked, and returns a list of command.Response that can be used to determine whether a single command succeeded or not. [Here](https://github.com/carla-simulator/carla/blob/master/PythonAPI/examples/generate_traffic.py) is an example of it being used to spawn actors.