Implements the packet parser for Gran Turismo 7 telemetry data, allowing a developer to retrieve data from a running game.

Overview

gran-turismo-query

ci workflow Crates.io

Implements the packet parser for Gran Turismo 7 telemetry data, allowing a developer to retrieve data from a running game.

Features

Any of the features below may be added in Cargo.toml when importing the library as such:

[dependencies]
gran-turismo-query = { version = "0.1.2", features = ["json"] }
  • json: adds serde's Serialize/Deserialize to the Packet struct.

Example

  1. Find the address of your PlayStation 5;
  2. Run the following code:
 // Create a UDP socket bound to any available address
let socket = UdpSocket::bind("0.0.0.0:33740").expect("Failed to bind socket");

// IP address and port to send/receive packets
let ip_address = "192.168.1.84"; // This will be the address of your PS5
let port = 33739; // Do NOT change this port, as the telemetry server listens to incoming packets on this port
let destination: SocketAddr = format!("{}:{}", ip_address, port)
    .parse()
    .expect("Invalid IP address or port");

// Send heartbeat packet to the telemetry server
socket
    .send_to(PACKET_HEARTBEAT_DATA, destination)
    .expect("Failed to send packet");

// Send a packet
loop {
    socket
        .send_to(PACKET_HEARTBEAT_DATA, destination)
        .expect("Failed to send packet");
    let mut buf = [0u8; PACKET_SIZE];
    socket
        .recv_from(&mut buf)
        .expect("Failed to receive packet");
    let packet = Packet::try_from(&buf).expect("Failed to parse packet");
    println!("{:#?}", packet);
    // Send hearbeat packet every 100 packets, otherwise the telemetry server will assume this client is dead
    if packet.packet_id % 100 == 0 {
        socket
            .send_to(PACKET_HEARTBEAT_DATA, destination)
            .expect("Failed to send packet");
    }   
}

You should see an output similar to this in your terminal:

Packet {
    position: [
        996.11865,
        95.22594,
        41.165268,
    ],
    velocity: [
        -25.783506,
        2.6718328,
        12.235032,
    ],
    rotation: [
        -0.012828048,
        0.83853436,
        -0.061140057,
    ],
    relative_orientation_to_north: 0.5412555,
    angular_velocity: [
        0.1495306,
        -0.5295577,
        0.19355063,
    ],
    body_height: 0.047546387,
    engine_rpm: 6040.0,
    gas_level: 100.0,
    gas_capacity: 100.0,
    meters_per_second: 28.656612,
    turbo_boost: 0.18931998,
    oil_pressure: 6.5625277,
    water_temperature: 85.0,
    oil_temperature: 110.0,
    tire_fl_surface_temperature: 90.79641,
    tire_fr_surface_temperature: 60.37589,
    tire_rl_surface_temperature: 70.37558,
    tire_rr_surface_temperature: 61.503597,
    packet_id: 143467,
    lap_count: 1,
    laps_in_race: 2,
    best_lap_time: -1,
    last_lap_time: -1,
    time_of_day_progression: 65438716,
    qualifying_position: -1,
    num_cars_pre_race: -1,
    alert_rpm_min: 7200,
    alert_rpm_max: 8000,
    calculated_max_speed: 279,
    flags: Some(
        PacketFlags(
            CarOnTrack | Paused | InGear | HasTurbo | ASMActive,
        ),
    ),
    current_gear: 2,
    suggested_gear: 15,
    throttle: 0,
    brake: 0,
    road_plane: [
        0.039712485,
        0.9897655,
        -0.13706571,
    ],
    road_plane_distance: -128.1198,
    wheel_fl_rps: -81.54625,
    wheel_fr_rps: -79.17614,
    wheel_rl_rps: -81.414276,
    wheel_rr_rps: -79.96095,
    tire_fl_radius: 0.35500002,
    tire_fr_radius: 0.35500002,
    tire_rl_radius: 0.35500002,
    tire_rr_radius: 0.35500002,
    tire_fl_suspension_height: 0.3052817,
    tire_fr_suspension_height: 0.28858984,
    tire_rl_suspension_height: 0.2946418,
    tire_rr_suspension_height: 0.2775881,
    clutch_pedal: 0.0,
    clutch_engagement: 1.0,
    rpm_from_clutch_to_gearbox: 6040.0,
    transmission_top_speed: 2.421,
    gear_ratios: [
        3.0000002,
        2.2350001,
        1.6320001,
        1.32,
        1.12,
        0.96000004,
        0.0,
    ],
    car_code: 3474,
}
You might also like...
Hypergraph is data structure library to create a directed hypergraph in which a hyperedge can join any number of vertices.

Hypergraph is data structure library to create a directed hypergraph in which a hyperedge can join any number of vertices.

Blazingly fast data generation & seeding for MongoDB

Planter Blazingly fast and simple data generation & seeding for MongoDB Installation Use the package manager cargo to install planter. Add the followi

Zenith substitutes PostgreSQL storage layer and redistributes data across a cluster of nodes

Zenith substitutes PostgreSQL storage layer and redistributes data across a cluster of nodes

It's not a novel data sturcture just AVL and Btree for rust

This crate named as ABtree but this not means it is a novel data sturcture. It’s just AVL tree and Btree. For the Btree, what makes it different from

RedisJSON - a JSON data type for Redis

RedisJSON RedisJSON is a Redis module that implements ECMA-404 The JSON Data Interchange Standard as a native data type. It allows storing, updating a

A Rust application that inserts Discogs data dumps into Postgres

Discogs-load A Rust application that inserts Discogs data dumps into Postgres. Discogs-load uses a simple state machine with the quick-xml Rust librar

SQLite compiled to WASM with pluggable data storage

wasm-sqlite SQLite compiled to WASM with pluggable data storage. Useful to save SQLite in e.g. Cloudflare Durable Objects (example: https://github.com

Databend aimed to be an open source elastic and reliable serverless data warehouse,
Databend aimed to be an open source elastic and reliable serverless data warehouse,

An elastic and reliable Serverless Data Warehouse, offers Blazing Fast Query and combines Elasticity, Simplicity, Low cost of the Cloud, built to make the Data Cloud easy

Open Data Access Layer that connect the whole world together

OpenDAL Open Data Access Layer that connect the whole world together. Status OpenDAL is in alpha stage and has been early adopted by databend. Welcome

Owner
Carlos Menezes
Carlos Menezes
A CRUD library for Holochain zomes that implements the CAPS pattern (Chained, Action ID, Permalink, State-based)

Holochain CRUD Library (CAPS pattern) A CRUD library for Holochain zomes that implement the CAPS pattern (Chained, Action, Permalink, State-based) Hol

Matthew Brisebois 3 Dec 3, 2022
Running SQL-like queries on files.

filesql Running SQL-like queries on files. Features Supported: REPL Basic SQL expressions. INSERT clause. (which inserts data into another file) WHERE

Zhang Li 1 Nov 15, 2021
Scalable and fast data store optimised for time series data such as financial data, events, metrics for real time analysis

OnTimeDB Scalable and fast data store optimised for time series data such as financial data, events, metrics for real time analysis OnTimeDB is a time

Stuart 2 Apr 5, 2022
a nom parser combinator that matches a psql statement.

psql_splitter a nom parser combinator that matches a psql statement. Postgres has a dialect of SQL that I'm going to call pgsql. Postgres also has a c

Steven Kalt 1 Dec 6, 2021
Rust library to parse, deparse and normalize SQL queries using the PostgreSQL query parser

This Rust library uses the actual PostgreSQL server source to parse SQL queries and return the internal PostgreSQL parse tree.

pganalyze 37 Dec 18, 2022
a tokio-enabled data store for triple data

terminusdb-store, a tokio-enabled data store for triple data Overview This library implements a way to store triple data - data that consists of a sub

TerminusDB 307 Dec 18, 2022
A Modern Real-Time Data Processing & Analytics DBMS with Cloud-Native Architecture, built to make the Data Cloud easy

A Modern Real-Time Data Processing & Analytics DBMS with Cloud-Native Architecture, built to make the Data Cloud easy

Datafuse Labs 5k Jan 9, 2023
Materialize simplifies application development with streaming data. Incrementally-updated materialized views - in PostgreSQL and in real time. Materialize is powered by Timely Dataflow.

Materialize is a streaming database for real-time applications. Get started Check out our getting started guide. About Materialize lets you ask questi

Materialize, Inc. 4.7k Jan 8, 2023
🐸Slippi DB ingests Slippi replays and puts the data into a SQLite database for easier parsing.

The primary goal of this project is to make it easier to analyze large amounts of Slippi data. Its end goal is to create something similar to Ballchasing.com but for Melee.

Max Timkovich 20 Jan 2, 2023
A Key-Value data storage system. - dorea db

Dorea DB ?? Dorea is a key-value data storage system. It is based on the Bitcask storage model Documentation | Crates.io | API Doucment 简体中文 | English

ZhuoEr Liu 112 Dec 2, 2022