Telemetry in Raspberry PI - read telemetry via Python

Discussion in 'Automobilista 2 - Help & Support' started by 2dots, Aug 29, 2025 at 5:03 PM.

Tags:
  1. 2dots

    2dots New Member

    Joined:
    Jan 3, 2024
    Messages:
    2
    Likes Received:
    1
    Hello, as a side project I'm trying to build my own hardware dashboard to display speed, rpms, laps and other useful information with Raspberry Pi and some digital displays.

    I am currently working on a Python script (I decided that this would be the fastest way) that reads telemetry data via UDP. When processing the packets, I tried to base my work on the information contained in the “SharedMemory.h” file, but it had nothing to do with the order of the received data. I have already managed to read the speed, but I am having trouble detecting where the rest of the data is.
    Code:
    # speed in m/s
    speed = struct.unpack_from("<f", data, 0x078)[0]
    
    Can anyone help me identify where the individual data starts? Or the best idea will be to switch to c++ ;)
     
  2. CorvusCorax

    CorvusCorax Active Member AMS2 Club Member

    Joined:
    Oct 23, 2016
    Messages:
    210
    Likes Received:
    87
    The shared memory struct and the UDP packet formats are completely different, UDP is far more complicated as there are different payloads that can be sent with different frequencies.

    Your best bet – if you want to continue with UDP – would probably be to find an existing implementation to modify. Look for any for Project CARS 2, as I believe the UDP format is either substantially or entirely the same. Alternatively documentation for the Project CARS 2 UDP packets.

    Sadly the Slightly Mad Studios / Project CARS websites that had example code to download are long since gone.
     
    • Like Like x 1
  3. 2dots

    2dots New Member

    Joined:
    Jan 3, 2024
    Messages:
    2
    Likes Received:
    1
    • Like Like x 1
  4. wegreenall

    wegreenall Well-Known Member

    Joined:
    Oct 25, 2023
    Messages:
    556
    Likes Received:
    263
    Out of interest, if you CAN do shared memory, I would say it is worth it, as it has more information in it (including specifically the DRS state) - I wanted to make something that would light up an LED when DRS was on and that was the only way I could pull that information as that is new to AMS2 and not in PCARS2.

    I made a rust app that pulls from shared memory and I think you can basically just replicate the SharedMemory.h struct, state you want "C" encoding, and transmute the shared memory into an instance of that struct.
     

Share This Page