diff --git a/README.md b/README.md index a438dae..e767fa6 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,47 @@ # ets2-python-telemetry + ETS2 (Euro Truck Simulator 2) python telemetry reader for nlhans' [ets2-sdk-plugin](https://github.com/nlhans/ets2-sdk-plugin "https://github.com/nlhans/ets2-sdk-plugin") based on nlhans' telemetry client for python applications. -Numpy lib required. +## Installation +> 0. Login steam, download [Euro Truck Simulation2](https://eurotrucksimulator2.com/) +> 1. Hit the [link](https://github.com/nlhans/ets2-sdk-plugin "https://github.com/nlhans/ets2-sdk-plugin") above and follow instructions. +> 2. SDK file (DLL file) must be in `\bin\\plugins` +> > path would be like this: `C:\steam\steamapps\common\Euro Truck Simulation2\bin\win_x64\plugins` +> > if there is no plugins folder inside of win_x64, make "plugins" folder and put a DLL file in it + +## Usage +> 1. clone this repo. type it on terminal.
+> ```shell +> $ git clone https://github.com/comeeasy/ets2-python-telemetry.git +> ``` +> +> 2. run __Euro Truck Simulation2.exe__ +>
RubberDuck
+> +> 3. run code.
+> ```shell +> $ cd ets-python-telemetry +> $ python get.py +> ``` +> +>
RubberDuck
+ +## details + +### If you want other telemetry information +then, see [ets2sdkdata.py](https://github.com/comeeasy/ets2-python-telemetry/blob/master/ets2sdkdata.py) +and also here + +> most important code in `get.py` is just like below +```python +data = sm.update() +f.wrtie(data) +``` + +## Go Get some data from ET2! + + + + + -SCS SDK version implemented : 1.5 / Latest SCS SDK version : 1.9 diff --git a/get.py b/get.py new file mode 100644 index 0000000..91e3360 --- /dev/null +++ b/get.py @@ -0,0 +1,30 @@ +from ets2sdktelemetry import Ets2SdkTelemetry +from sharedmemory import SharedMemory +import time +from threading import Timer + + +def update(sm: SharedMemory, f): + Timer(1, update, [sm, f]).start() + tt0 = time.perf_counter() + data = sm.update() + _format = f"{data.coordinateX},{data.coordinateY},{data.rotationX * 360:.2f},{data.accelerationX},{data.accelerationY},{round(data.speed * 3.6)},{time.ctime(time.time())}\n" + + f.write(_format) + print(_format) + tt1 = time.perf_counter() + print(f"{(tt1 - tt0)*1000}ms, time: {time.ctime(time.time())}\n") + + +if __name__ == "__main__": + t = Ets2SdkTelemetry() + sm = SharedMemory() + sm.connect() + + fileName = 'test.csv' + f = open(fileName, 'w+') + f.write("GPS_X,GPS_Y,AZIMUTH,ACCELERATION_X,ACCELERATION_Y,SPEED,TIME\n") + update(sm, f) + + + diff --git a/imgs/run.png b/imgs/run.png new file mode 100644 index 0000000..555961d Binary files /dev/null and b/imgs/run.png differ diff --git a/imgs/start-sim.png b/imgs/start-sim.png new file mode 100644 index 0000000..ff440cc Binary files /dev/null and b/imgs/start-sim.png differ