.. _python_vru_awareness_service: ================================================== Vulnerable Road User (VRU) Awareness Service ================================================== The VRU Awareness basic service implements **ETSI TS 103 300-3 V2.3.1**. Pedestrians, cyclists, motorcyclists and road workers use it to announce their presence to nearby vehicles with VRU Awareness Messages (VAMs), sent with BTP-B on port 2018. Components ========== - ``VRUAwarenessService``: the service; it owns the transmission and reception management and, optionally, VRU clustering. - ``DeviceDataProvider``: the VRU device's station ID and type and its dynamics (heading, speed, acceleration), a frozen dataclass. - ``vru_service.vam_transmission_management``: the generation rules. A VAM is generated when the position changes by more than 4 m, the ground speed by more than 0.5 m/s or the orientation of the ground velocity by more than 4°, and at least every ``T_GenVamMax`` (5 s). - VRU clustering (``cluster_support=True``, the default): creation, joining, leaving and break-up of clusters as specified in clause 5.4 of TS 103 300-3. Clustering is available in the Python implementation only. Basic Usage =========== .. code-block:: python from flexstack.facilities.vru_awareness_service.vam_transmission_management import DeviceDataProvider from flexstack.facilities.vru_awareness_service.vru_awareness_service import VRUAwarenessService device_data_provider = DeviceDataProvider( station_id=7001, station_type=2, # cyclist (ETSI TS 102 894-2) ) vru_service = VRUAwarenessService( btp_router=btp_router, device_data_provider=device_data_provider, ldm=ldm, own_vru_profile="bicyclistAndLightVruVehicle", ) location_service.add_callback(vru_service.vam_transmission_management.location_service_callback) Received VAMs are decoded and stored in the LDM. A complete station that sends and receives secured VAMs is ``examples/secured_vam_sender_and_receiver.py`` in the FlexStack repository.