Actor Sensor is a module that allows you to filter other actors in the environment based on your own actor's location and field of view. It is built using the CARLA simulator and its Python API.
You need to get ego vehicle actor ID and set ego_player_id
in demo.py
accordingly,
then run example.
python3 demo.py
- CARLA simulator (version 0.9.13)
- Python 3.x
carla
Python module (version 0.9.13)
- Download and install the CARLA simulator.
- Clone or download the
actor_sensor.py
file from this repository. - Place the
actor_sensor.py
file in your CARLA Python client directory.
CARLA_EGG_FILE_PATH
: Update this variable to your carla .egg file inactor_sensor.py
- Import the
actor_sensor
function fromactor_sensor.py
:
from actor_sensor import actor_sensor
The actor_sensor()
function takes the following arguments:
- ego_player_id: The ID of the ego vehicle.
- world: The CARLA world.
- h_fov: The horizontal field of view (in degrees). Default is 45.
- v_fov: The vertical field of view (in degrees). Default is 1.
- show_transform: If set to True, draws lines to show the transforms of the actors within the field of view. Default is False.
- range_: The range (in meters) of the field of view. Default is 50.
- actor_filter: The actor filter to use. Default is 'vehicle.*'.
- Return the array containing filtered actors