Skip to content
This repository has been archived by the owner on Oct 17, 2023. It is now read-only.
/ car-data-sample Public archive

Python example code how to write car telemetry data into Quix platform

Notifications You must be signed in to change notification settings

quixio/car-data-sample

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Stream vehicle data from a CSV - sample code

Python code sample for writing vehicle telemetry data (time series parameters) into the Quix platform. The example file (cardata.csv) is data collected from a virtual F1 car in Codemasters 2019 racing game. This data was acquired using our Codemaster F1 2019 telemetry bridge.

Get started

Sign up for free Quix account here.

Create a workspace and then create a topic inside.

You can deploy this code directly to our serveless environment or setup local Python environment.

Local Python environment setup:

Code

Set up a connection to the broker and open a connection to your topic

# Create a client factory. Factory helps you create StreamingClient (see below) a little bit easier
security = SecurityOptions('../certificates/ca.cert', "<USERNAME>", "<PASSWORD>")
client = StreamingClient('<BROKER_ADDRESS>', security)

# Open output topic connection.
output_topic = client.open_output_topic('ORGANIZATION-WORKSPACE-TOPICNAME')

Then create a new stream in the topic:

stream = output_topic.create_stream()

A stream is a collection of data that belong to a single session of a single source. For example one race car for one race.

If you don't specify a stream id, a random GUID will be generated. Specify the a stream ID if you want to append data into the stream later. stream = output_topic.create_stream("my-own-stream-id")

Give the stream a human readable name. This name will appear in the data catalogue.

stream.properties.name = "cardata"

Read the csv file into a data frame.

df = pd.read_csv("cardata.csv")

Write the data frame to the topic.

stream.parameters.write(df)

A stream can be infinitely long or have start and end. If you send data into closed stream, it is automatically opened again.

stream.close()

See our documentation for more information on how to stream data to Quix using our SDK: Writting to Quix DOC

Full code example:

source/main.py

End result

After the car data is successfully streamed to Quix you can analyse it using Visualize page in Quix.

Next steps

You can connect a model to process this streamed data live [here], and consume the results into an application [here].

About

Python example code how to write car telemetry data into Quix platform

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published