Fdomf/docs (#1981)
* Added c++ doc section, Updated bp_library,docs improvements * Minor changes * Docs updates * Added c++ doc section, Updated bp_library,docs improvements * Minor changes * Docs updates * Updated jenkins file - master rebase * Updated Jenkins - rebase * Fixed doxygen link * Waypoint tutorial extended and fixes * Merge branch 'master' into fdomf/docs * Fixes * Merge branch 'fdomf/docs' of https://github.com/carla-simulator/carla into fdomf/docs * Updated some python API class & methods * Merge branch 'master' into fdomf/docs * updated python api * Updates * Fixed broken link in camera&sensors doc * Python API doc updated * Added python api * Added first lite version of python cookbook and docs related links * Bp_doc_gen * Merge branch 'master' into fdomf/docs * merge master python api docs * Updated doc * make PythonApi.docs * Merge branch 'master' into fdomf/docs * Updated python API doc generator * New debug recipe * Docs fixes
This commit is contained in:
parent
8cb378a612
commit
ecff54faf5
|
@ -3,7 +3,7 @@
|
|||

|
||||
|
||||
Sensors are a special type of actor able to measure and stream data. All the
|
||||
sensors have a `listen` method that registers the callback function that will
|
||||
sensors have a [`listen`](python_api.md#carla.Sensor.listen) method that registers the callback function that will
|
||||
be called each time the sensor produces a new measurement. Sensors are typically
|
||||
attached to vehicles and produce data either each simulation update, or when a
|
||||
certain event is registered.
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 928 KiB |
Binary file not shown.
After Width: | Height: | Size: 2.8 MiB |
Binary file not shown.
After Width: | Height: | Size: 918 KiB |
Binary file not shown.
After Width: | Height: | Size: 11 MiB |
|
@ -22,6 +22,7 @@
|
|||
|
||||
* [Python API reference](python_api.md)
|
||||
* [C++ Reference](cpp_reference.md)
|
||||
* [Python Cookbook](python_cookbook.md)
|
||||
* [Blueprint Library](bp_library.md)
|
||||
* [Running without display and selecting GPUs](carla_headless.md)
|
||||
* [Running in a Docker](carla_docker.md)
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
- [**Rigid**](#carla.AttachmentType.Rigid) <sub>_Instance variable_</sub>
|
||||
- [**SpringArm**](#carla.AttachmentType.SpringArm) <sub>_Instance variable_</sub>
|
||||
- [**BlueprintLibrary**](#carla.BlueprintLibrary) <sub>_Class_</sub>
|
||||
- [**find**(**self**)](#carla.BlueprintLibrary.find) <sub>_Method_</sub>
|
||||
- [**find**(**self**, **id**)](#carla.BlueprintLibrary.find) <sub>_Method_</sub>
|
||||
- [**filter**(**self**, **wildcard_pattern**)](#carla.BlueprintLibrary.filter) <sub>_Method_</sub>
|
||||
- [**\__getitem__**(**self**, **pos**)](#carla.BlueprintLibrary.__getitem__) <sub>_Method_</sub>
|
||||
- [**\__len__**(**self**)](#carla.BlueprintLibrary.__len__) <sub>_Method_</sub>
|
||||
|
@ -575,7 +575,7 @@ _</font>
|
|||
---
|
||||
|
||||
## carla.AttachmentType<a name="carla.AttachmentType"></a> <sub><sup>_class_</sup></sub>
|
||||
Class that defines the attachment options. See [carla.World.spawn_actor](#carla.World.spawn_actor).
|
||||
Class that defines the attachment options. See [carla.World.spawn_actor](#carla.World.spawn_actor).<br> Check out this [`recipe`](../python_cookbook/#attach-sensors-recipe)!
|
||||
|
||||
<h3>Instance Variables</h3>
|
||||
- <a name="carla.AttachmentType.Rigid"></a>**<font color="#f8805a">Rigid</font>**
|
||||
|
@ -589,7 +589,11 @@ Attachment that expands or retracts based on camera situation.
|
|||
Class that provides access to [blueprints](../bp_library/).
|
||||
|
||||
<h3>Methods</h3>
|
||||
- <a name="carla.BlueprintLibrary.find"></a>**<font color="#7fb800">find</font>**(<font color="#00a6ed">**self**</font>)
|
||||
- <a name="carla.BlueprintLibrary.find"></a>**<font color="#7fb800">find</font>**(<font color="#00a6ed">**self**</font>, <font color="#00a6ed">**id**</font>)
|
||||
Returns a [carla.ActorBlueprint](#carla.ActorBlueprint) through its id.
|
||||
- **Parameters:**
|
||||
- `id` (_str_)
|
||||
- **Return:** _[carla.ActorBlueprint](#carla.ActorBlueprint)_
|
||||
- <a name="carla.BlueprintLibrary.filter"></a>**<font color="#7fb800">filter</font>**(<font color="#00a6ed">**self**</font>, <font color="#00a6ed">**wildcard_pattern**</font>)
|
||||
Filters a list of ActorBlueprint with id or tags matching wildcard_pattern. The pattern is matched against each blueprint's id and tags.
|
||||
- **Parameters:**
|
||||
|
@ -608,7 +612,7 @@ _</font>
|
|||
---
|
||||
|
||||
## carla.ColorConverter<a name="carla.ColorConverter"></a> <sub><sup>_class_</sup></sub>
|
||||
Class that defines the color converter options.
|
||||
Class that defines the color converter options. Check out this [`recipe`](../python_cookbook/#converted-image-recipe)!
|
||||
|
||||
<h3>Instance Variables</h3>
|
||||
- <a name="carla.ColorConverter.Raw"></a>**<font color="#f8805a">Raw</font>**
|
||||
|
@ -650,7 +654,7 @@ Draws an arrow between two given locations.
|
|||
- `life_time` (_float_)
|
||||
- `persistent_lines` (_bool_) – _Deprecated, use `life_time = 0` instead_.
|
||||
- <a name="carla.DebugHelper.draw_box"></a>**<font color="#7fb800">draw_box</font>**(<font color="#00a6ed">**self**</font>, <font color="#00a6ed">**box**</font>, <font color="#00a6ed">**rotation**</font>, <font color="#00a6ed">**thickness**=0.1f</font>, <font color="#00a6ed">**color**=(255,0,0)</font>, <font color="#00a6ed">**life_time**=-1.0f</font>, <font color="#00a6ed">**persistent_lines**=True</font>)
|
||||
Draws the [carla.BoundingBox](#carla.BoundingBox) of a given bounding_box.
|
||||
Draws the [carla.BoundingBox](#carla.BoundingBox) of a given bounding_box.<br> Check out this [`recipe`](../python_cookbook/#debug-bounding-box-recipe)!
|
||||
- **Parameters:**
|
||||
- `box` (_[carla.BoundingBox](#carla.BoundingBox)_)
|
||||
- `rotation` (_[carla.Rotation](#carla.Rotation)_)
|
||||
|
@ -673,7 +677,7 @@ _</font>
|
|||
---
|
||||
|
||||
## carla.LaneChange<a name="carla.LaneChange"></a> <sub><sup>_class_</sup></sub>
|
||||
Class that defines the lane change options.
|
||||
Class that defines the lane change options. Check out this [`recipe`](../python_cookbook/#lanes-recipe)!
|
||||
|
||||
<h3>Instance Variables</h3>
|
||||
- <a name="carla.LaneChange.NONE"></a>**<font color="#f8805a">NONE</font>**
|
||||
|
@ -718,7 +722,7 @@ White by default.
|
|||
---
|
||||
|
||||
## carla.LaneMarkingType<a name="carla.LaneMarkingType"></a> <sub><sup>_class_</sup></sub>
|
||||
Class that defines the lane marking types that OpenDRIVE accepts.
|
||||
Class that defines the lane marking types accepted by OpenDRIVE. Check out this [`recipe`](../python_cookbook/#lanes-recipe)!
|
||||
|
||||
<h3>Instance Variables</h3>
|
||||
- <a name="carla.LaneMarkingType.NONE"></a>**<font color="#f8805a">NONE</font>**
|
||||
|
@ -741,7 +745,7 @@ Grass edge.
|
|||
---
|
||||
|
||||
## carla.LaneType<a name="carla.LaneType"></a> <sub><sup>_class_</sup></sub>
|
||||
All the possible lane types that OpenDRIVE accepts.
|
||||
All the possible lane types accepted by OpenDRIVE. Check out this [`recipe`](../python_cookbook/#lanes-recipe)!
|
||||
|
||||
<h3>Instance Variables</h3>
|
||||
- <a name="carla.LaneType.NONE"></a>**<font color="#f8805a">NONE</font>**
|
||||
|
@ -783,7 +787,7 @@ Sensor's transform when the data was generated.
|
|||
---
|
||||
|
||||
## carla.TrafficLightState<a name="carla.TrafficLightState"></a> <sub><sup>_class_</sup></sub>
|
||||
All possible states for traffic lights.
|
||||
All possible states for traffic lights. Check out this [`recipe`](../python_cookbook/#traffic-lights-recipe)!
|
||||
|
||||
<h3>Instance Variables</h3>
|
||||
- <a name="carla.TrafficLightState.Red"></a>**<font color="#f8805a">Red</font>**
|
||||
|
@ -875,9 +879,13 @@ Class that defines an attribute of a [carla.ActorBlueprint](#carla.ActorBlueprin
|
|||
|
||||
<h3>Instance Variables</h3>
|
||||
- <a name="carla.ActorAttribute.id"></a>**<font color="#f8805a">id</font>** (_str_)
|
||||
String identifier of the attribute.
|
||||
- <a name="carla.ActorAttribute.type"></a>**<font color="#f8805a">type</font>** (_[carla.ActorAttributeType](#carla.ActorAttributeType)_)
|
||||
The attribute parameter type.
|
||||
- <a name="carla.ActorAttribute.recommended_values"></a>**<font color="#f8805a">recommended_values</font>** (_list(str)_)
|
||||
List of recommended values that the attribute may have.
|
||||
- <a name="carla.ActorAttribute.is_modifiable"></a>**<font color="#f8805a">is_modifiable</font>** (_bool_)
|
||||
True if the attribute is modifiable.
|
||||
|
||||
<h3>Methods</h3>
|
||||
- <a name="carla.ActorAttribute.as_bool"></a>**<font color="#7fb800">as_bool</font>**(<font color="#00a6ed">**self**</font>)
|
||||
|
@ -905,12 +913,15 @@ Class that contains all the necessary information for spawning an Actor.
|
|||
|
||||
<h3>Instance Variables</h3>
|
||||
- <a name="carla.ActorBlueprint.id"></a>**<font color="#f8805a">id</font>** (_str_)
|
||||
Actor blueprint identifier, e.g. `walker.pedestrian.0001`.
|
||||
- <a name="carla.ActorBlueprint.tags"></a>**<font color="#f8805a">tags</font>** (_list(str)_)
|
||||
List of tags of an actor blueprint e.g. `['0001', 'pedestrian', 'walker']`.
|
||||
|
||||
<h3>Methods</h3>
|
||||
- <a name="carla.ActorBlueprint.has_tag"></a>**<font color="#7fb800">has_tag</font>**(<font color="#00a6ed">**self**</font>, <font color="#00a6ed">**tag**</font>)
|
||||
Returns `true` if an actor blueprint has the tag.
|
||||
- **Parameters:**
|
||||
- `tag` (_str_)
|
||||
- `tag` (_str_) – e.g. 'walker'.
|
||||
- **Return:** _bool_
|
||||
- <a name="carla.ActorBlueprint.match_tags"></a>**<font color="#7fb800">match_tags</font>**(<font color="#00a6ed">**self**</font>, <font color="#00a6ed">**wildcard_pattern**</font>)
|
||||
Test if any of the flags or id matches wildcard_pattern.
|
||||
|
@ -920,17 +931,22 @@ Test if any of the flags or id matches wildcard_pattern.
|
|||
- **Note:** <font color="#8E8E8E">_The wildcard_pattern follows Unix shell-style wildcards.
|
||||
_</font>
|
||||
- <a name="carla.ActorBlueprint.has_attribute"></a>**<font color="#7fb800">has_attribute</font>**(<font color="#00a6ed">**self**</font>, <font color="#00a6ed">**id**</font>)
|
||||
Returns `true` if the blueprint contains the specified attribute.
|
||||
- **Parameters:**
|
||||
- `id` (_str_)
|
||||
- `id` (_str_) – e.g 'gender'.
|
||||
- **Return:** _bool_
|
||||
- <a name="carla.ActorBlueprint.get_attribute"></a>**<font color="#7fb800">get_attribute</font>**(<font color="#00a6ed">**self**</font>, <font color="#00a6ed">**id**</font>)
|
||||
Returns the current actor attribute through its id.
|
||||
- **Parameters:**
|
||||
- `id` (_str_)
|
||||
- **Return:** _[carla.ActorAttribute](#carla.ActorAttribute)_
|
||||
- <a name="carla.ActorBlueprint.set_attribute"></a>**<font color="#7fb800">set_attribute</font>**(<font color="#00a6ed">**self**</font>, <font color="#00a6ed">**id**</font>, <font color="#00a6ed">**value**</font>)
|
||||
Sets an existing attribute to the actor's blueprint.
|
||||
- **Parameters:**
|
||||
- `id` (_str_)
|
||||
- `value` (_str_)
|
||||
- **Note:** <font color="#8E8E8E">_Attribute can only be set or changed if it is modifiable
|
||||
_</font>
|
||||
- <a name="carla.ActorBlueprint.__len__"></a>**<font color="#7fb800">\__len__</font>**(<font color="#00a6ed">**self**</font>)
|
||||
- <a name="carla.ActorBlueprint.__iter__"></a>**<font color="#7fb800">\__iter__</font>**(<font color="#00a6ed">**self**</font>)
|
||||
- <a name="carla.ActorBlueprint.__str__"></a>**<font color="#7fb800">\__str__</font>**(<font color="#00a6ed">**self**</font>)
|
||||
|
@ -946,12 +962,16 @@ Identifier of the actor snapshot.
|
|||
|
||||
<h3>Methods</h3>
|
||||
- <a name="carla.ActorSnapshot.get_transform"></a>**<font color="#7fb800">get_transform</font>**(<font color="#00a6ed">**self**</font>)
|
||||
Returns the current transform of the actor.
|
||||
- **Return:** _[carla.Transform](#carla.Transform)_
|
||||
- <a name="carla.ActorSnapshot.get_velocity"></a>**<font color="#7fb800">get_velocity</font>**(<font color="#00a6ed">**self**</font>)
|
||||
Returns the current 3D velocity of the actor.
|
||||
- **Return:** _[carla.Vector3D](#carla.Vector3D)_
|
||||
- <a name="carla.ActorSnapshot.get_angular_velocity"></a>**<font color="#7fb800">get_angular_velocity</font>**(<font color="#00a6ed">**self**</font>)
|
||||
Returns the current 3D angular velocity of the actor.
|
||||
- **Return:** _[carla.Vector3D](#carla.Vector3D)_
|
||||
- <a name="carla.ActorSnapshot.get_acceleration"></a>**<font color="#7fb800">get_acceleration</font>**(<font color="#00a6ed">**self**</font>)
|
||||
Returns the current 3D acceleration of the actor.
|
||||
- **Return:** _[carla.Vector3D](#carla.Vector3D)_
|
||||
- <a name="carla.ActorSnapshot.__self__"></a>**<font color="#7fb800">\__self__</font>**(<font color="#00a6ed">**self**</font>)
|
||||
|
||||
|
@ -1134,11 +1154,11 @@ Class that provides access to vehicle transmission details.
|
|||
|
||||
<h3>Instance Variables</h3>
|
||||
- <a name="carla.GearPhysicsControl.ratio"></a>**<font color="#f8805a">ratio</font>** (_float_)
|
||||
Gear ratio.
|
||||
The transmission ratio of the gear.
|
||||
- <a name="carla.GearPhysicsControl.down_ratio"></a>**<font color="#f8805a">down_ratio</font>** (_float_)
|
||||
Lower limit to gear down.
|
||||
The level of RPM (in relation to MaxRPM) where the gear autobox initiates shifting down.
|
||||
- <a name="carla.GearPhysicsControl.up_ratio"></a>**<font color="#f8805a">up_ratio</font>** (_float_)
|
||||
Upper limit to gear up.
|
||||
The level of RPM (in relation to MaxRPM) where the gear autobox initiates shifting up.
|
||||
|
||||
<h3>Methods</h3>
|
||||
- <a name="carla.GearPhysicsControl.__init__"></a>**<font color="#7fb800">\__init__</font>**(<font color="#00a6ed">**self**</font>, <font color="#00a6ed">**ratio**=1.0</font>, <font color="#00a6ed">**down_ratio**=0.5</font>, <font color="#00a6ed">**up_ratio**=0.65</font>)
|
||||
|
@ -1571,7 +1591,7 @@ WalkerControl constructor.
|
|||
---
|
||||
|
||||
## carla.Waypoint<a name="carla.Waypoint"></a> <sub><sup>_class_</sup></sub>
|
||||
3D directed point that stores information about the road definition that OpenDRIVE provides.
|
||||
3D directed point that stores information about the road definition provided by OpenDRIVE.
|
||||
|
||||
<h3>Instance Variables</h3>
|
||||
- <a name="carla.Waypoint.id"></a>**<font color="#f8805a">id</font>** (_int_)
|
||||
|
@ -1903,7 +1923,7 @@ Lidar sensor measurement data.
|
|||
|
||||
<h3>Instance Variables</h3>
|
||||
- <a name="carla.LidarMeasurement.horizontal_angle"></a>**<font color="#f8805a">horizontal_angle</font>** (_float_)
|
||||
Horizontal angle that the Lidar has rotated.
|
||||
Horizontal angle that the Lidar has rotated at the time of the measurement.
|
||||
- <a name="carla.LidarMeasurement.channels"></a>**<font color="#f8805a">channels</font>** (_int_)
|
||||
Number of lasers.
|
||||
- <a name="carla.LidarMeasurement.raw_data"></a>**<font color="#f8805a">raw_data</font>** (_bytes_)
|
||||
|
@ -1911,9 +1931,13 @@ List of 3D points.
|
|||
|
||||
<h3>Methods</h3>
|
||||
- <a name="carla.LidarMeasurement.get_point_count"></a>**<font color="#7fb800">get_point_count</font>**(<font color="#00a6ed">**self**</font>, <font color="#00a6ed">**channel**</font>)
|
||||
Retrieve the number of points that are generated by this channel.
|
||||
- **Parameters:**
|
||||
- `channel` (_int_)
|
||||
- **Note:** <font color="#8E8E8E">_Points are sorted by channel, so this method allows to identify the channel that generated each point.
|
||||
_</font>
|
||||
- <a name="carla.LidarMeasurement.save_to_disk"></a>**<font color="#7fb800">save_to_disk</font>**(<font color="#00a6ed">**self**</font>, <font color="#00a6ed">**path**</font>)
|
||||
Save point cloud to disk.
|
||||
- **Parameters:**
|
||||
- `path` (_str_)
|
||||
- <a name="carla.LidarMeasurement.__len__"></a>**<font color="#7fb800">\__len__</font>**(<font color="#00a6ed">**self**</font>)
|
||||
|
@ -1992,7 +2016,7 @@ Stops listening for data.
|
|||
---
|
||||
|
||||
## carla.TrafficLight<a name="carla.TrafficLight"></a><sub><sup>([carla.TrafficSign](#carla.TrafficSign))</sup></sub> <sub><sup>_class_</sup></sub>
|
||||
A traffic light actor.
|
||||
A traffic light actor. Check out this [`recipe`](../python_cookbook/#traffic-lights-recipe)!
|
||||
|
||||
<h3>Instance Variables</h3>
|
||||
- <a name="carla.TrafficLight.state"></a>**<font color="#f8805a">state</font>** (_[carla.TrafficLightState](#carla.TrafficLightState)_)
|
||||
|
@ -2143,10 +2167,13 @@ _</font>
|
|||
---
|
||||
|
||||
## command.ApplyAngularVelocity<a name="command.ApplyAngularVelocity"></a> <sub><sup>_class_</sup></sub>
|
||||
Set the actor's angular velocity.
|
||||
|
||||
<h3>Instance Variables</h3>
|
||||
- <a name="command.ApplyAngularVelocity.actor_id"></a>**<font color="#f8805a">actor_id</font>** (_int_)
|
||||
Actor affected by the command.
|
||||
- <a name="command.ApplyAngularVelocity.angular_velocity"></a>**<font color="#f8805a">angular_velocity</font>** (_[carla.Vector3D](#carla.Vector3D)_)
|
||||
The 3D angular velocity that will be applied to the actor.
|
||||
|
||||
<h3>Methods</h3>
|
||||
- <a name="command.ApplyAngularVelocity.__init__"></a>**<font color="#7fb800">\__init__</font>**(<font color="#00a6ed">**self**</font>, <font color="#00a6ed">**actor**</font>, <font color="#00a6ed">**angular_velocity**</font>)
|
||||
|
@ -2157,10 +2184,13 @@ _</font>
|
|||
---
|
||||
|
||||
## command.ApplyImpulse<a name="command.ApplyImpulse"></a> <sub><sup>_class_</sup></sub>
|
||||
Adds impulse to the actor.
|
||||
|
||||
<h3>Instance Variables</h3>
|
||||
- <a name="command.ApplyImpulse.actor_id"></a>**<font color="#f8805a">actor_id</font>** (_int_)
|
||||
Actor affected by the command.
|
||||
- <a name="command.ApplyImpulse.impulse"></a>**<font color="#f8805a">impulse</font>** (_[carla.Vector3D](#carla.Vector3D)_)
|
||||
Impulse applied to the actor.
|
||||
|
||||
<h3>Methods</h3>
|
||||
- <a name="command.ApplyImpulse.__init__"></a>**<font color="#7fb800">\__init__</font>**(<font color="#00a6ed">**self**</font>, <font color="#00a6ed">**actor**</font>, <font color="#00a6ed">**impulse**</font>)
|
||||
|
@ -2171,10 +2201,13 @@ _</font>
|
|||
---
|
||||
|
||||
## command.ApplyTransform<a name="command.ApplyTransform"></a> <sub><sup>_class_</sup></sub>
|
||||
Sets a new transform to the actor.
|
||||
|
||||
<h3>Instance Variables</h3>
|
||||
- <a name="command.ApplyTransform.actor_id"></a>**<font color="#f8805a">actor_id</font>** (_int_)
|
||||
Actor affected by the command.
|
||||
- <a name="command.ApplyTransform.transform"></a>**<font color="#f8805a">transform</font>** (_[carla.Transform](#carla.Transform)_)
|
||||
Transformation to be applied.
|
||||
|
||||
<h3>Methods</h3>
|
||||
- <a name="command.ApplyTransform.__init__"></a>**<font color="#7fb800">\__init__</font>**(<font color="#00a6ed">**self**</font>, <font color="#00a6ed">**actor**</font>, <font color="#00a6ed">**transform**</font>)
|
||||
|
@ -2185,10 +2218,13 @@ _</font>
|
|||
---
|
||||
|
||||
## command.ApplyVehicleControl<a name="command.ApplyVehicleControl"></a> <sub><sup>_class_</sup></sub>
|
||||
Apply control to the vehicle.
|
||||
|
||||
<h3>Instance Variables</h3>
|
||||
- <a name="command.ApplyVehicleControl.actor_id"></a>**<font color="#f8805a">actor_id</font>** (_int_)
|
||||
Vehicle actor affected by the command.
|
||||
- <a name="command.ApplyVehicleControl.control"></a>**<font color="#f8805a">control</font>** (_[carla.VehicleControl](#carla.VehicleControl)_)
|
||||
Vehicle control to be applied.
|
||||
|
||||
<h3>Methods</h3>
|
||||
- <a name="command.ApplyVehicleControl.__init__"></a>**<font color="#7fb800">\__init__</font>**(<font color="#00a6ed">**self**</font>, <font color="#00a6ed">**actor**</font>, <font color="#00a6ed">**control**</font>)
|
||||
|
@ -2199,10 +2235,13 @@ _</font>
|
|||
---
|
||||
|
||||
## command.ApplyVelocity<a name="command.ApplyVelocity"></a> <sub><sup>_class_</sup></sub>
|
||||
Sets actor's velocity.
|
||||
|
||||
<h3>Instance Variables</h3>
|
||||
- <a name="command.ApplyVelocity.actor_id"></a>**<font color="#f8805a">actor_id</font>** (_int_)
|
||||
Actor affected by the command.
|
||||
- <a name="command.ApplyVelocity.velocity"></a>**<font color="#f8805a">velocity</font>** (_[carla.Vector3D](#carla.Vector3D)_)
|
||||
The 3D velocity applied to the actor.
|
||||
|
||||
<h3>Methods</h3>
|
||||
- <a name="command.ApplyVelocity.__init__"></a>**<font color="#7fb800">\__init__</font>**(<font color="#00a6ed">**self**</font>, <font color="#00a6ed">**actor**</font>, <font color="#00a6ed">**velocity**</font>)
|
||||
|
@ -2213,10 +2252,13 @@ _</font>
|
|||
---
|
||||
|
||||
## command.ApplyWalkerControl<a name="command.ApplyWalkerControl"></a> <sub><sup>_class_</sup></sub>
|
||||
Apply control to the walker.
|
||||
|
||||
<h3>Instance Variables</h3>
|
||||
- <a name="command.ApplyWalkerControl.actor_id"></a>**<font color="#f8805a">actor_id</font>** (_int_)
|
||||
Walker actor affected by the command.
|
||||
- <a name="command.ApplyWalkerControl.control"></a>**<font color="#f8805a">control</font>** (_[carla.VehicleControl](#carla.VehicleControl)_)
|
||||
Walker control to be applied.
|
||||
|
||||
<h3>Methods</h3>
|
||||
- <a name="command.ApplyWalkerControl.__init__"></a>**<font color="#7fb800">\__init__</font>**(<font color="#00a6ed">**self**</font>, <font color="#00a6ed">**actor**</font>, <font color="#00a6ed">**control**</font>)
|
||||
|
@ -2227,11 +2269,15 @@ _</font>
|
|||
---
|
||||
|
||||
## command.ApplyWalkerState<a name="command.ApplyWalkerState"></a> <sub><sup>_class_</sup></sub>
|
||||
Apply a state to the walker actor.
|
||||
|
||||
<h3>Instance Variables</h3>
|
||||
- <a name="command.ApplyWalkerState.actor_id"></a>**<font color="#f8805a">actor_id</font>** (_int_)
|
||||
Walker actor affected by the command.
|
||||
- <a name="command.ApplyWalkerState.transform"></a>**<font color="#f8805a">transform</font>** (_[carla.Transform](#carla.Transform)_)
|
||||
Transform to be applied.
|
||||
- <a name="command.ApplyWalkerState.speed"></a>**<font color="#f8805a">speed</font>** (_float_)
|
||||
Speed to be applied.
|
||||
|
||||
<h3>Methods</h3>
|
||||
- <a name="command.ApplyWalkerState.__init__"></a>**<font color="#7fb800">\__init__</font>**(<font color="#00a6ed">**self**</font>, <font color="#00a6ed">**actor**</font>, <font color="#00a6ed">**transform**</font>, <font color="#00a6ed">**speed**</font>)
|
||||
|
@ -2243,9 +2289,11 @@ _</font>
|
|||
---
|
||||
|
||||
## command.DestroyActor<a name="command.DestroyActor"></a> <sub><sup>_class_</sup></sub>
|
||||
Tell the simulator to destroy this Actor, and return whether the actor was successfully destroyed. It has no effect if the Actor was already successfully destroyed.
|
||||
|
||||
<h3>Instance Variables</h3>
|
||||
- <a name="command.DestroyActor.actor_id"></a>**<font color="#f8805a">actor_id</font>** (_int_)
|
||||
Actor affected by the command.
|
||||
|
||||
<h3>Methods</h3>
|
||||
- <a name="command.DestroyActor.__init__"></a>**<font color="#7fb800">\__init__</font>**(<font color="#00a6ed">**self**</font>, <font color="#00a6ed">**actor**</font>)
|
||||
|
@ -2259,6 +2307,7 @@ Execution result of a command, contains either an error string or an actor ID, d
|
|||
|
||||
<h3>Instance Variables</h3>
|
||||
- <a name="command.Response.actor_id"></a>**<font color="#f8805a">actor_id</font>** (_int_)
|
||||
Actor affected by the command.
|
||||
- <a name="command.Response.error"></a>**<font color="#f8805a">error</font>** (_str_)
|
||||
|
||||
<h3>Methods</h3>
|
||||
|
@ -2267,10 +2316,13 @@ Execution result of a command, contains either an error string or an actor ID, d
|
|||
---
|
||||
|
||||
## command.SetAutopilot<a name="command.SetAutopilot"></a> <sub><sup>_class_</sup></sub>
|
||||
Switch on/off vehicle's server-side autopilot.
|
||||
|
||||
<h3>Instance Variables</h3>
|
||||
- <a name="command.SetAutopilot.actor_id"></a>**<font color="#f8805a">actor_id</font>** (_int_)
|
||||
Actor that is affected by the command.
|
||||
- <a name="command.SetAutopilot.enabled"></a>**<font color="#f8805a">enabled</font>** (_bool_)
|
||||
If the autopilot is enabled or not.
|
||||
|
||||
<h3>Methods</h3>
|
||||
- <a name="command.SetAutopilot.__init__"></a>**<font color="#7fb800">\__init__</font>**(<font color="#00a6ed">**self**</font>, <font color="#00a6ed">**actor**</font>, <font color="#00a6ed">**enabled**</font>)
|
||||
|
@ -2281,10 +2333,13 @@ Execution result of a command, contains either an error string or an actor ID, d
|
|||
---
|
||||
|
||||
## command.SetSimulatePhysics<a name="command.SetSimulatePhysics"></a> <sub><sup>_class_</sup></sub>
|
||||
Whether an actor will be affected by physics or not.
|
||||
|
||||
<h3>Instance Variables</h3>
|
||||
- <a name="command.SetSimulatePhysics.actor_id"></a>**<font color="#f8805a">actor_id</font>** (_int_)
|
||||
Actor affected by the command.
|
||||
- <a name="command.SetSimulatePhysics.enabled"></a>**<font color="#f8805a">enabled</font>** (_bool_)
|
||||
If physics will affect the actor.
|
||||
|
||||
<h3>Methods</h3>
|
||||
- <a name="command.SetSimulatePhysics.__init__"></a>**<font color="#7fb800">\__init__</font>**(<font color="#00a6ed">**self**</font>, <font color="#00a6ed">**actor**</font>, <font color="#00a6ed">**enabled**</font>)
|
||||
|
@ -2295,10 +2350,13 @@ Execution result of a command, contains either an error string or an actor ID, d
|
|||
---
|
||||
|
||||
## command.SpawnActor<a name="command.SpawnActor"></a> <sub><sup>_class_</sup></sub>
|
||||
Spawn an actor into the world based on the blueprint provided and the transform. If a parent is provided, the actor is attached to parent.
|
||||
|
||||
<h3>Instance Variables</h3>
|
||||
- <a name="command.SpawnActor.transform"></a>**<font color="#f8805a">transform</font>** (_[carla.Transform](#carla.Transform)_)
|
||||
Transform to be applied.
|
||||
- <a name="command.SpawnActor.parent_id"></a>**<font color="#f8805a">parent_id</font>** (_int_)
|
||||
Parent's actor id.
|
||||
|
||||
<h3>Methods</h3>
|
||||
- <a name="command.SpawnActor.__init__"></a>**<font color="#7fb800">\__init__</font>**(<font color="#00a6ed">**self**</font>)
|
||||
|
@ -2312,6 +2370,7 @@ Execution result of a command, contains either an error string or an actor ID, d
|
|||
- `transform` (_[carla.Transform](#carla.Transform)_)
|
||||
- `parent` (_[carla.Actor](#carla.Actor) or int_)
|
||||
- <a name="command.SpawnActor.then"></a>**<font color="#7fb800">then</font>**(<font color="#00a6ed">**self**</font>, <font color="#00a6ed">**command**</font>)
|
||||
Link another command to be executed right after.
|
||||
- **Parameters:**
|
||||
- `command` (_[carla.Command](#carla.Command)_) – CommandType.
|
||||
|
||||
|
|
|
@ -0,0 +1,238 @@
|
|||
|
||||
<h1> Python Cookbook </h1>
|
||||
|
||||
This section contains a list of recipes that complement the [tutorial](../python_api_tutorial/) and are used to
|
||||
illustrate the use of Python API methods.
|
||||
|
||||
Each recipe has a list of [python API classes](../python_api/), which is divided into those in which the recipe is centered,
|
||||
and those that need to be used.
|
||||
|
||||
There are more recipes to come!
|
||||
|
||||
## Actor Spectator Recipe
|
||||
|
||||
This recipe spawns an actor and the spectator camera at the actor's location.
|
||||
|
||||
Focused on:<br>
|
||||
[`carla.World`](../python_api/#carla.World)<br>
|
||||
[`carla.Actor`](../python_api/#carla.Actor)
|
||||
|
||||
Used:<br>
|
||||
[`carla.WorldSnapshot`](../python_api/#carla.WorldSnapshot)<br>
|
||||
[`carla.ActorSnapshot`](../python_api/#carla.ActorSnapshot)
|
||||
|
||||
```py
|
||||
# ...
|
||||
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())
|
||||
# ...
|
||||
```
|
||||
|
||||
## Attach Sensors Recipe
|
||||
|
||||
This recipe attaches different camera / sensors to a vehicle with different attachments.
|
||||
|
||||
Focused on:<br>
|
||||
[`carla.Sensor`](../python_api/#carla.Sensor)<br>
|
||||
[`carla.AttachmentType`](../python_api/#carla.AttachmentType)<br>
|
||||
|
||||
Used:<br>
|
||||
[`carla.World`](../python_api/#carla.World)
|
||||
|
||||
```py
|
||||
# ...
|
||||
camera = world.spawn_actor(rgb_camera_bp, transform, attach_to=vehicle, attachment_type=Attachment.SpringArm)
|
||||
# Default attachment: Attachment.Rigid
|
||||
gnss_sensor = world.spawn_actor(sensor_gnss_bp, transform, attach_to=vehicle)
|
||||
collision_sensor = world.spawn_actor(sensor_collision_bp, transform, attach_to=vehicle)
|
||||
lane_invasion_sensor = world.spawn_actor(sensor_lane_invasion_bp, transform, attach_to=vehicle)
|
||||
# ...
|
||||
```
|
||||
|
||||
## Actor Attribute Recipe
|
||||
|
||||
This recipe changes attributes of different type of blueprint actors.
|
||||
|
||||
Focused on:<br>
|
||||
[`carla.ActorAttribute`](../python_api/#carla.ActorAttribute)<br>
|
||||
[`carla.ActorBlueprint`](../python_api/#carla.ActorBlueprint)<br>
|
||||
|
||||
Used:<br>
|
||||
[`carla.World`](../python_api/#carla.World)<br>
|
||||
[`carla.BlueprintLibrary`](../python_api/#carla.BlueprintLibrary)<br>
|
||||
|
||||
```py
|
||||
# ...
|
||||
walker_bp = world.get_blueprint_library().filter('walker.pedestrian.0002')
|
||||
walker_bp.set_attribute('is_invincible', True)
|
||||
|
||||
# ...
|
||||
# Changes attribute randomly by the recommended value
|
||||
vehicle_bp = wolrd.get_blueprint_library().filter('vehicle.bmw.*')
|
||||
color = random.choice(vehicle_bp.get_attribute('color').recommended_values)
|
||||
vehicle_bp.set_attribute('color', color)
|
||||
|
||||
# ...
|
||||
|
||||
camera_bp = world.get_blueprint_library().filter('sensor.camera.rgb')
|
||||
camera_bp.set_attribute('image_size_x', 600)
|
||||
camera_bp.set_attribute('image_size_y', 600)
|
||||
# ...
|
||||
```
|
||||
|
||||
## Converted Image Recipe
|
||||
|
||||
This recipe applies a color conversion to the image taken by a camera sensor, so it is converted to a
|
||||
semantic segmentation image.
|
||||
|
||||
Focused on:<br>
|
||||
[`carla.ColorConverter`](../python_api/#carla.ColorConverter)<br>
|
||||
[`carla.Sensor`](../python_api/#carla.Sensor)
|
||||
|
||||
```py
|
||||
# ...
|
||||
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))
|
||||
# ...
|
||||
```
|
||||
|
||||
## Lanes Recipe
|
||||
|
||||
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.
|
||||
|
||||
Focused on:<br>
|
||||
[`carla.LaneMarking`](../python_api/#carla.LaneMarking)<br>
|
||||
[`carla.LaneMarkingType`](../python_api/#carla.LaneMarkingType)<br>
|
||||
[`carla.LaneChange`](../python_api/#carla.LaneChange)<br>
|
||||
[`carla.LaneType`](../python_api/#carla.LaneType)<br>
|
||||
|
||||
Used:<br>
|
||||
[`carla.Waypoint`](../python_api/#carla.Waypoint)<br>
|
||||
[`carla.World`](../python_api/#carla.World)
|
||||
|
||||
```py
|
||||
# ...
|
||||
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))
|
||||
# ...
|
||||
```
|
||||
|
||||

|
||||
|
||||
## Debug Bounding Box Recipe
|
||||
|
||||
This recipe shows how to draw traffic light actor bounding boxes from a world snapshot.
|
||||
|
||||
Focused on:<br>
|
||||
[`carla.DebugHelper`](../python_api/#carla.DebugHelper)<br>
|
||||
[`carla.BoundingBox`](../python_api/#carla.BoundingBox)
|
||||
|
||||
Used:<br>
|
||||
[`carla.ActorSnapshot`](../python_api/#carla.ActorSnapshot)<br>
|
||||
[`carla.Actor`](../python_api/#carla.Actor)<br>
|
||||
[`carla.Vector3D`](../python_api/#carla.Vector3D)<br>
|
||||
[`carla.Color`](../python_api/#carla.Color)
|
||||
|
||||
```py
|
||||
# ....
|
||||
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)
|
||||
# ...
|
||||
```
|
||||
|
||||

|
||||
|
||||
## Debug Vehicle Trail Recipe
|
||||
|
||||
This recipe is a modification of [`lane_explorer.py`](https://github.com/carla-simulator/carla/blob/master/PythonAPI/util/lane_explorer.py) example.
|
||||
It draws the path of an actor through the world, printing information at each waypoint.
|
||||
|
||||
Focused on:<br>
|
||||
[`carla.DebugHelper`](../python_api/#carla.DebugHelper)<br>
|
||||
[`carla.Waypoint`](../python_api/#carla.Waypoint)<br>
|
||||
[`carla.Actor`](../python_api/#carla.Actor)
|
||||
|
||||
Used:<br>
|
||||
[`carla.ActorSnapshot`](../python_api/#carla.ActorSnapshot)<br>
|
||||
[`carla.Vector3D`](../python_api/#carla.Vector3D)<br>
|
||||
[`carla.Color`](../python_api/#carla.Color)<br>
|
||||
[`carla.Map`](../python_api/#carla.Map)
|
||||
|
||||
```py
|
||||
# ...
|
||||
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 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)
|
||||
# ...
|
||||
```
|
||||
|
||||
The image below shows how a vehicle loses control and drives on a sidewalk. The trail shows the path it was following and the speed at each waypoint.
|
||||
|
||||

|
||||
|
||||
## Traffic lights Recipe
|
||||
|
||||
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.
|
||||
|
||||
Focused on:<br>
|
||||
[`carla.TrafficLight`](../python_api/#carla.TrafficLight)<br>
|
||||
[`carla.TrafficLightState`](../python_api/#carla.TrafficLightState)
|
||||
|
||||
Used:<br>
|
||||
[`carla.Vehicle`](../python_api/#carla.Vehicle)
|
||||
|
||||
```py
|
||||
# ...
|
||||
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)
|
||||
# ...
|
||||
```
|
||||
|
||||

|
|
@ -323,7 +323,7 @@
|
|||
- class_name: TrafficLightState
|
||||
# - DESCRIPTION ------------------------
|
||||
doc: >
|
||||
All possible states for traffic lights.
|
||||
All possible states for traffic lights. Check out this [`recipe`](../python_cookbook/#traffic-lights-recipe)!
|
||||
# - PROPERTIES -------------------------
|
||||
instance_variables:
|
||||
- var_name: Red
|
||||
|
@ -337,7 +337,7 @@
|
|||
parent: carla.TrafficSign
|
||||
# - DESCRIPTION ------------------------
|
||||
doc: >
|
||||
A traffic light actor.
|
||||
A traffic light actor. Check out this [`recipe`](../python_cookbook/#traffic-lights-recipe)!
|
||||
# - PROPERTIES -------------------------
|
||||
instance_variables:
|
||||
- var_name: state
|
||||
|
|
|
@ -90,15 +90,19 @@
|
|||
- var_name: id
|
||||
type: str
|
||||
doc: >
|
||||
String identifier of the attribute
|
||||
- var_name: type
|
||||
type: carla.ActorAttributeType
|
||||
doc: >
|
||||
The attribute parameter type
|
||||
- var_name: recommended_values
|
||||
type: list(str)
|
||||
doc: >
|
||||
List of recommended values that the attribute may have.
|
||||
- var_name: is_modifiable
|
||||
type: bool
|
||||
doc: >
|
||||
True if the attribute is modifiable.
|
||||
# - METHODS ----------------------------
|
||||
methods:
|
||||
- def_name: as_bool
|
||||
|
@ -156,9 +160,11 @@
|
|||
- var_name: id
|
||||
type: str
|
||||
doc: >
|
||||
Actor blueprint identifier, e.g. `walker.pedestrian.0001`.
|
||||
- var_name: tags
|
||||
type: list(str)
|
||||
doc: >
|
||||
List of tags of an actor blueprint e.g. `['0001', 'pedestrian', 'walker']`
|
||||
# - METHODS ----------------------------
|
||||
methods:
|
||||
- def_name: has_tag
|
||||
|
@ -166,7 +172,10 @@
|
|||
params:
|
||||
- param_name: tag
|
||||
type: str
|
||||
doc: >
|
||||
e.g. 'walker'
|
||||
doc: >
|
||||
Returns `true` if an actor blueprint has the tag.
|
||||
# --------------------------------------
|
||||
- def_name: match_tags
|
||||
return: bool
|
||||
|
@ -183,7 +192,10 @@
|
|||
params:
|
||||
- param_name: id
|
||||
type: str
|
||||
doc: >
|
||||
e.g 'gender'
|
||||
doc: >
|
||||
Returns `true` if the blueprint contains the specified attribute
|
||||
# --------------------------------------
|
||||
- def_name: get_attribute
|
||||
return: carla.ActorAttribute
|
||||
|
@ -191,6 +203,7 @@
|
|||
- param_name: id
|
||||
type: str
|
||||
doc: >
|
||||
Returns the current actor attribute through its id
|
||||
Return: carla.ActorAttribute
|
||||
# --------------------------------------
|
||||
- def_name: set_attribute
|
||||
|
@ -203,6 +216,9 @@
|
|||
type: str
|
||||
doc: >
|
||||
doc: >
|
||||
Sets an existing attribute to the actor's blueprint
|
||||
note: >
|
||||
Attribute can only be set or changed if it is modifiable
|
||||
# --------------------------------------
|
||||
- def_name: __len__
|
||||
doc: >
|
||||
|
@ -221,7 +237,12 @@
|
|||
# - METHODS ----------------------------
|
||||
methods:
|
||||
- def_name: find
|
||||
params:
|
||||
- param_name: id
|
||||
type: str
|
||||
return: carla.ActorBlueprint
|
||||
doc: >
|
||||
Returns a carla.ActorBlueprint through its id
|
||||
# --------------------------------------
|
||||
- def_name: filter
|
||||
params:
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
- var_name: actor_id
|
||||
type: int
|
||||
doc: >
|
||||
Actor affected by the command
|
||||
- var_name: error
|
||||
type: str
|
||||
doc: >
|
||||
|
@ -25,14 +26,18 @@
|
|||
- class_name: SpawnActor
|
||||
# - DESCRIPTION ------------------------
|
||||
doc: >
|
||||
Spawn an actor into the world based on the blueprint provided and the transform.
|
||||
If a parent is provided, the actor is attached to parent.
|
||||
# - PROPERTIES -------------------------
|
||||
instance_variables:
|
||||
- var_name: transform
|
||||
type: carla.Transform
|
||||
doc: >
|
||||
Transform to be applied
|
||||
- var_name: parent_id
|
||||
type: int
|
||||
doc: >
|
||||
Parent's actor id
|
||||
# - METHODS ----------------------------
|
||||
methods:
|
||||
- def_name: __init__
|
||||
|
@ -63,16 +68,21 @@
|
|||
doc: >
|
||||
CommandType.
|
||||
doc: >
|
||||
Link another command to be executed right after.
|
||||
# --------------------------------------
|
||||
|
||||
- class_name: DestroyActor
|
||||
# - DESCRIPTION ------------------------
|
||||
doc: >
|
||||
Tell the simulator to destroy this Actor, and return whether the actor was
|
||||
successfully destroyed. It has no effect if the Actor was already
|
||||
successfully destroyed.
|
||||
# - PROPERTIES -------------------------
|
||||
instance_variables:
|
||||
- var_name: actor_id
|
||||
type: int
|
||||
doc: >
|
||||
Actor affected by the command
|
||||
# - METHODS ----------------------------
|
||||
methods:
|
||||
- def_name: __init__
|
||||
|
@ -85,14 +95,17 @@
|
|||
- class_name: ApplyVehicleControl
|
||||
# - DESCRIPTION ------------------------
|
||||
doc: >
|
||||
Apply control to the vehicle.
|
||||
# - PROPERTIES -------------------------
|
||||
instance_variables:
|
||||
- var_name: actor_id
|
||||
type: int
|
||||
doc: >
|
||||
Vehicle actor affected by the command
|
||||
- var_name: control
|
||||
type: carla.VehicleControl
|
||||
doc: >
|
||||
Vehicle control to be applied
|
||||
# - METHODS ----------------------------
|
||||
methods:
|
||||
- def_name: __init__
|
||||
|
@ -107,14 +120,17 @@
|
|||
- class_name: ApplyWalkerControl
|
||||
# - DESCRIPTION ------------------------
|
||||
doc: >
|
||||
Apply control to the walker
|
||||
# - PROPERTIES -------------------------
|
||||
instance_variables:
|
||||
- var_name: actor_id
|
||||
type: int
|
||||
doc: >
|
||||
Walker actor affected by the command
|
||||
- var_name: control
|
||||
type: carla.VehicleControl
|
||||
doc: >
|
||||
Walker control to be applied
|
||||
# - METHODS ----------------------------
|
||||
methods:
|
||||
- def_name: __init__
|
||||
|
@ -129,14 +145,17 @@
|
|||
- class_name: ApplyTransform
|
||||
# - DESCRIPTION ------------------------
|
||||
doc: >
|
||||
Sets a new transform to the actor.
|
||||
# - PROPERTIES -------------------------
|
||||
instance_variables:
|
||||
- var_name: actor_id
|
||||
type: int
|
||||
doc: >
|
||||
Actor affected by the command
|
||||
- var_name: transform
|
||||
type: carla.Transform
|
||||
doc: >
|
||||
Transformation to be applied
|
||||
# - METHODS ----------------------------
|
||||
methods:
|
||||
- def_name: __init__
|
||||
|
@ -151,17 +170,21 @@
|
|||
- class_name: ApplyWalkerState
|
||||
# - DESCRIPTION ------------------------
|
||||
doc: >
|
||||
Apply a state to the walker actor
|
||||
# - PROPERTIES -------------------------
|
||||
instance_variables:
|
||||
- var_name: actor_id
|
||||
type: int
|
||||
doc: >
|
||||
Walker actor affected by the command
|
||||
- var_name: transform
|
||||
type: carla.Transform
|
||||
doc: >
|
||||
Transform to be applied
|
||||
- var_name: speed
|
||||
type: float
|
||||
doc: >
|
||||
Speed to be applied
|
||||
# - METHODS ----------------------------
|
||||
methods:
|
||||
- def_name: __init__
|
||||
|
@ -179,14 +202,17 @@
|
|||
- class_name: ApplyVelocity
|
||||
# - DESCRIPTION ------------------------
|
||||
doc: >
|
||||
Sets actor's velocity
|
||||
# - PROPERTIES -------------------------
|
||||
instance_variables:
|
||||
- var_name: actor_id
|
||||
type: int
|
||||
doc: >
|
||||
Actor affected by the command.
|
||||
- var_name: velocity
|
||||
type: carla.Vector3D
|
||||
doc: >
|
||||
The 3D velocity applied to the actor
|
||||
# - METHODS ----------------------------
|
||||
methods:
|
||||
- def_name: __init__
|
||||
|
@ -201,14 +227,17 @@
|
|||
- class_name: ApplyAngularVelocity
|
||||
# - DESCRIPTION ------------------------
|
||||
doc: >
|
||||
Set the actor's angular velocity
|
||||
# - PROPERTIES -------------------------
|
||||
instance_variables:
|
||||
- var_name: actor_id
|
||||
type: int
|
||||
doc: >
|
||||
Actor affected by the command
|
||||
- var_name: angular_velocity
|
||||
type: carla.Vector3D
|
||||
doc: >
|
||||
The 3D angular velocity that will be applied to the actor
|
||||
# - METHODS ----------------------------
|
||||
methods:
|
||||
- def_name: __init__
|
||||
|
@ -223,14 +252,17 @@
|
|||
- class_name: ApplyImpulse
|
||||
# - DESCRIPTION ------------------------
|
||||
doc: >
|
||||
Adds impulse to the actor
|
||||
# - PROPERTIES -------------------------
|
||||
instance_variables:
|
||||
- var_name: actor_id
|
||||
type: int
|
||||
doc: >
|
||||
Actor affected by the command
|
||||
- var_name: impulse
|
||||
type: carla.Vector3D
|
||||
doc: >
|
||||
Impulse applied to the actor
|
||||
# - METHODS ----------------------------
|
||||
methods:
|
||||
- def_name: __init__
|
||||
|
@ -245,14 +277,17 @@
|
|||
- class_name: SetSimulatePhysics
|
||||
# - DESCRIPTION ------------------------
|
||||
doc: >
|
||||
Whether an actor will be affected by physics or not.
|
||||
# - PROPERTIES -------------------------
|
||||
instance_variables:
|
||||
- var_name: actor_id
|
||||
type: int
|
||||
doc: >
|
||||
Actor affected by the command
|
||||
- var_name: enabled
|
||||
type: bool
|
||||
doc: >
|
||||
If physics will affect the actor
|
||||
# - METHODS ----------------------------
|
||||
methods:
|
||||
- def_name: __init__
|
||||
|
@ -267,14 +302,17 @@
|
|||
- class_name: SetAutopilot
|
||||
# - DESCRIPTION ------------------------
|
||||
doc: >
|
||||
Switch on/off vehicle's server-side autopilot
|
||||
# - PROPERTIES -------------------------
|
||||
instance_variables:
|
||||
- var_name: actor_id
|
||||
type: int
|
||||
doc: >
|
||||
Actor that is affected by the command.
|
||||
- var_name: enabled
|
||||
type: bool
|
||||
doc: >
|
||||
If the autopilot is enabled or not.
|
||||
# - METHODS ----------------------------
|
||||
methods:
|
||||
- def_name: __init__
|
||||
|
|
|
@ -170,17 +170,17 @@
|
|||
- var_name: ratio
|
||||
type: float
|
||||
doc: >
|
||||
Gear ratio.
|
||||
The transmission ratio of the gear.
|
||||
# --------------------------------------
|
||||
- var_name: down_ratio
|
||||
type: float
|
||||
doc: >
|
||||
Lower limit to gear down.
|
||||
The level of RPM (in relation to MaxRPM) where the gear autobox initiates shifting down.
|
||||
# --------------------------------------
|
||||
- var_name: up_ratio
|
||||
type: float
|
||||
doc: >
|
||||
Upper limit to gear up.
|
||||
The level of RPM (in relation to MaxRPM) where the gear autobox initiates shifting up.
|
||||
# - METHODS ----------------------------
|
||||
methods:
|
||||
- def_name: __init__
|
||||
|
|
|
@ -19,12 +19,15 @@ COLOR_WARNING = '#ED2F2F'
|
|||
|
||||
QUERY = re.compile(r'([cC]arla(\.[a-zA-Z0-9_]+)+)')
|
||||
|
||||
|
||||
def create_hyperlinks(text):
|
||||
return re.sub(QUERY, r'[\1](#\1)', text)
|
||||
|
||||
def join(elem, separator = ''):
|
||||
|
||||
def join(elem, separator=''):
|
||||
return separator.join(elem)
|
||||
|
||||
|
||||
class MarkdownFile:
|
||||
def __init__(self):
|
||||
self._data = ""
|
||||
|
@ -82,42 +85,55 @@ class MarkdownFile:
|
|||
return join(['```', language, '\n', self.list_depth(), buf, '\n', self.list_depth(), '```\n'])
|
||||
|
||||
def prettify_doc(self, doc):
|
||||
punctuation_marks = ['.', '!', '?']
|
||||
doc = doc.strip()
|
||||
doc += '' if doc[-1:] == '.' else '.'
|
||||
doc += '' if doc[-1:] in punctuation_marks else '.'
|
||||
return doc
|
||||
|
||||
|
||||
def italic(buf):
|
||||
return join(['_', buf, '_'])
|
||||
|
||||
|
||||
def bold(buf):
|
||||
return join(['**', buf, '**'])
|
||||
|
||||
|
||||
def code(buf):
|
||||
return join(['`', buf, '`'])
|
||||
|
||||
|
||||
def brackets(buf):
|
||||
return join(['[', buf, ']'])
|
||||
|
||||
|
||||
def parentheses(buf):
|
||||
return join(['(', buf, ')'])
|
||||
|
||||
|
||||
def small(buf):
|
||||
return join(['<sub><sup>', buf, '</sup></sub>'])
|
||||
|
||||
|
||||
def sub(buf):
|
||||
return join(['<sub>', buf, '</sub>'])
|
||||
|
||||
|
||||
def html_key(buf):
|
||||
return join(['<a name="', buf, '"></a>'])
|
||||
|
||||
|
||||
def color(col, buf):
|
||||
return join(['<font color="', col, '">', buf, '</font>'])
|
||||
|
||||
|
||||
def valid_dic_val(dic, value):
|
||||
return value in dic and dic[value]
|
||||
|
||||
|
||||
class YamlFile:
|
||||
"""Yaml file class"""
|
||||
|
||||
def __init__(self, path):
|
||||
self._path = path
|
||||
with open(path) as yaml_file:
|
||||
|
@ -167,15 +183,15 @@ class YamlFile:
|
|||
exit(0)
|
||||
if 'params' in met and met['params']:
|
||||
for param in met['params']:
|
||||
if 'param_name' not in param:
|
||||
if 'param_name' not in param:
|
||||
print('\n[ERROR] File: ' + self._path)
|
||||
print("'param_name' not found inside 'params' of class: " + cl['class_name'])
|
||||
exit(0)
|
||||
if 'param_name' in param and param['param_name'] is None:
|
||||
if 'param_name' in param and param['param_name'] is None:
|
||||
print('\n[ERROR] File: ' + self._path)
|
||||
print("'param_name' is empty in:")
|
||||
exit(0)
|
||||
if 'type' in param and param['type'] is None:
|
||||
if 'type' in param and param['type'] is None:
|
||||
print('\n[ERROR] File: ' + self._path)
|
||||
print("'type' is empty in:")
|
||||
exit(0)
|
||||
|
@ -192,7 +208,7 @@ def gen_stub_method_def(method):
|
|||
p_type = join([': ', str(p['type'])]) if 'type' in p else ''
|
||||
default = join([' = ', str(p['default'])]) if 'default' in p else ''
|
||||
param = join([param, p['param_name'], p_type, default, ', '])
|
||||
param = param[:-2] # delete the last ', '
|
||||
param = param[:-2] # delete the last ', '
|
||||
return_type = join([' -> ', method['return']]) if 'return' in method else ''
|
||||
return join([method_name, parentheses(param), return_type])
|
||||
|
||||
|
@ -213,7 +229,7 @@ def gen_doc_method_def(method, is_indx=False, with_self=True):
|
|||
method_name = bold(color(COLOR_METHOD, method_name))
|
||||
|
||||
if with_self:
|
||||
if not 'params' in method or method['params'] == None:
|
||||
if not 'params' in method or method['params'] is None:
|
||||
method['params'] = []
|
||||
method['params'].insert(0, {'param_name': 'self'})
|
||||
|
||||
|
@ -227,10 +243,10 @@ def gen_doc_method_def(method, is_indx=False, with_self=True):
|
|||
|
||||
if with_self:
|
||||
method['params'] = method['params'][1:]
|
||||
if not method['params']: # if is empty delete it
|
||||
if not method['params']: # if is empty delete it
|
||||
del method['params']
|
||||
|
||||
param = param[:-2] # delete the last ', '
|
||||
param = param[:-2] # delete the last ', '
|
||||
return join([method_name, parentheses(param)])
|
||||
|
||||
|
||||
|
@ -356,6 +372,7 @@ def add_doc_inst_var(md, inst_var, class_key):
|
|||
|
||||
md.list_pop()
|
||||
|
||||
|
||||
class Documentation:
|
||||
"""Main documentation class"""
|
||||
|
||||
|
@ -453,6 +470,7 @@ class Documentation:
|
|||
"""Generates the whole markdown file"""
|
||||
return join([self.gen_overview(), self.gen_body()], '\n').strip()
|
||||
|
||||
|
||||
def main():
|
||||
"""Main function"""
|
||||
print("Generating PythonAPI documentation...")
|
||||
|
@ -462,5 +480,6 @@ def main():
|
|||
md_file.write(docs.gen_markdown())
|
||||
print("Done!")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
- class_name: LaneType
|
||||
# - DESCRIPTION ------------------------
|
||||
doc: >
|
||||
All the possible lane types that OpenDRIVE accepts
|
||||
All the possible lane types accepted by OpenDRIVE. Check out this [`recipe`](../python_cookbook/#lanes-recipe)!
|
||||
# - PROPERTIES -------------------------
|
||||
instance_variables:
|
||||
- var_name: NONE
|
||||
|
@ -57,7 +57,7 @@
|
|||
- class_name: LaneChange
|
||||
# - DESCRIPTION ------------------------
|
||||
doc: >
|
||||
Class that defines the lane change options
|
||||
Class that defines the lane change options. Check out this [`recipe`](../python_cookbook/#lanes-recipe)!
|
||||
# - PROPERTIES -------------------------
|
||||
instance_variables:
|
||||
- var_name: NONE
|
||||
|
@ -98,7 +98,7 @@
|
|||
- class_name: LaneMarkingType
|
||||
# - DESCRIPTION ------------------------
|
||||
doc: >
|
||||
Class that defines the lane marking types that OpenDRIVE accepts.
|
||||
Class that defines the lane marking types accepted by OpenDRIVE. Check out this [`recipe`](../python_cookbook/#lanes-recipe)!
|
||||
# - PROPERTIES -------------------------
|
||||
instance_variables:
|
||||
- var_name: NONE
|
||||
|
@ -257,7 +257,7 @@
|
|||
- class_name: Waypoint
|
||||
# - DESCRIPTION ------------------------
|
||||
doc: >
|
||||
3D directed point that stores information about the road definition that OpenDRIVE provides.
|
||||
3D directed point that stores information about the road definition provided by OpenDRIVE.
|
||||
# - PROPERTIES -------------------------
|
||||
instance_variables:
|
||||
- var_name: id
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
- class_name: ColorConverter
|
||||
# - DESCRIPTION ------------------------
|
||||
doc: >
|
||||
Class that defines the color converter options.
|
||||
Class that defines the color converter options. Check out this [`recipe`](../python_cookbook/#converted-image-recipe)!
|
||||
# - PROPERTIES -------------------------
|
||||
instance_variables:
|
||||
- var_name: Raw
|
||||
|
@ -115,7 +115,7 @@
|
|||
- var_name: horizontal_angle
|
||||
type: float
|
||||
doc: >
|
||||
Horizontal angle that the Lidar has rotated
|
||||
Horizontal angle that the Lidar has rotated at the time of the measurement
|
||||
- var_name: channels
|
||||
type: int
|
||||
doc: >
|
||||
|
@ -131,12 +131,17 @@
|
|||
- param_name: channel
|
||||
type: int
|
||||
doc: >
|
||||
Retrieve the number of points that are generated by this channel.
|
||||
note: >
|
||||
Points are sorted by channel, so this method allows to identify the channel
|
||||
that generated each point.
|
||||
# --------------------------------------
|
||||
- def_name: save_to_disk
|
||||
params:
|
||||
- param_name: path
|
||||
type: str
|
||||
doc: >
|
||||
Save point cloud to disk
|
||||
# --------------------------------------
|
||||
- def_name: __len__
|
||||
doc: >
|
||||
|
|
|
@ -78,18 +78,22 @@
|
|||
- def_name: get_transform
|
||||
return: carla.Transform
|
||||
doc: >
|
||||
Returns the current transform of the actor
|
||||
# --------------------------------------
|
||||
- def_name: get_velocity
|
||||
return: carla.Vector3D
|
||||
doc: >
|
||||
Returns the current 3D velocity of the actor
|
||||
# --------------------------------------
|
||||
- def_name: get_angular_velocity
|
||||
return: carla.Vector3D
|
||||
doc: >
|
||||
Returns the current 3D angular velocity of the actor
|
||||
# --------------------------------------
|
||||
- def_name: get_acceleration
|
||||
return: carla.Vector3D
|
||||
doc: >
|
||||
Returns the current 3D acceleration of the actor
|
||||
# --------------------------------------
|
||||
- def_name: __self__
|
||||
doc: >
|
||||
|
|
|
@ -147,7 +147,9 @@
|
|||
- class_name: AttachmentType
|
||||
# - DESCRIPTION ------------------------
|
||||
doc: >
|
||||
Class that defines the attachment options. See carla.World.spawn_actor.
|
||||
Class that defines the attachment options. See carla.World.spawn_actor.<br>
|
||||
Check out this [`recipe`](../python_cookbook/#attach-sensors-recipe)!
|
||||
|
||||
# - PROPERTIES -------------------------
|
||||
instance_variables:
|
||||
- var_name: Rigid
|
||||
|
@ -410,7 +412,9 @@
|
|||
doc: >
|
||||
_Deprecated, use `life_time = 0` instead_
|
||||
doc: >
|
||||
Draws the carla.BoundingBox of a given bounding_box.
|
||||
Draws the carla.BoundingBox of a given bounding_box.<br>
|
||||
Check out this [`recipe`](../python_cookbook/#debug-bounding-box-recipe)!
|
||||
|
||||
# --------------------------------------
|
||||
- def_name: draw_string
|
||||
params:
|
||||
|
|
|
@ -18,6 +18,7 @@ nav:
|
|||
- Advanced topics:
|
||||
- 'Python API reference': 'python_api.md'
|
||||
- 'C++ reference' : 'cpp_reference.md'
|
||||
- 'Python Cookbook': 'python_cookbook.md'
|
||||
- 'Blueprint Library': 'bp_library.md'
|
||||
- 'Running without display and selecting GPUs': 'carla_headless.md'
|
||||
- 'Running in a Docker': 'carla_docker.md'
|
||||
|
|
Loading…
Reference in New Issue