Giter Club home page Giter Club logo

pyirsdk's People

Contributors

fuzzwah avatar kutu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pyirsdk's Issues

Read Speed with the IBT Class

Hello, sorry if this is a silly question.
Python is new to me, and I'm just an engineer trying to perform some data analysis, not a programmer.

I'm attempting to extract data, such as speed, from an IBT file. According to the example in the tutorial, this should work. Reading the CarSetup, as mentioned in a previous question, works fine, but unfortunately, the speed extraction does not seem to be functioning: IndexError: list index out of range

image

Thank you for your great work!

Read Setup files wth the IBT Class

Hi,

Thanks for the amazing library.

Is it possible to read the Setup information from the IBT class as in the C++ version examples?

Thanks Chris

	if (1 == idk.getSessionStrVal("DriverInfo:DriverSetupName:", tstr, MAX_STR))
	{
		printf("CarSetupName: %s", tstr);

		if(1 == idk.getSessionStrVal("DriverInfo:DriverSetupLoadTypeName:", tstr, MAX_STR))
			printf(", %s", tstr);

		if(1 == idk.getSessionStrVal("DriverInfo:DriverSetupIsModified:", tstr, MAX_STR))
			if(atoi(tstr) == 1)
				printf(", modified");

		if(1 == idk.getSessionStrVal("DriverInfo:DriverSetupPassedTech:", tstr, MAX_STR))
			if(atoi(tstr) == 0)
				printf(", failed tech");

		printf("\n");
	}

	// get the current setup and dump it
	const char *sesStr = idk.getSessionStr();
	if(sesStr)
	{
		//****Note, this assumes CarSetup is the last section of the session string.
		const char *tstr = strstr(sesStr, "CarSetup:");
		if(tstr)
		{
			printf(tstr);
			printf("\n");
		}
	}

GPS location of car

Hi,

Great work, hopefully this is still a live project.

I have checked the vars.txt file but can't seem to find anything relating to exact GPS position on track. Latitude and Longitude would help.

Regards

Feature Requests

Would I be able to request two features for this:

  1. Different exit code from running irsdk.py --parse output.yaml
    successfully =0
    unsuccessfully = 1 (if there is a error (like when Sim is not running) )

  2. Option to output as JSON instead of YAML

ta

Track Usage

I'm looking for Track Usage in percent. I can see a summary of track usage "SessionTrackRubberState": "high usage" but not the percentage I can find in the Garage61 exports. Its possible this value comes from the IBT files.

I have asked on the iracing forum but the response from David was not definitive.

Any chance someone can shed light on it?

Thanks :)

Is there any metric that measures time for every sector?

I see at live sector times, but not sector attributes available apart from distances.
So, as far as I see, there are no metrics that are saving the sector times. Am I right?

Thus, all I can do is to get the lap time from ir['LapLastLapTime'] and do some estimations using the ir['lapDistPct'], ir['SplitTimeInfo']['Sectors'] and the current time which I use the value from ir['SessionTime']

Important values missing

Hey,

first up, thank you for this great library!
I would just like to know if it was possible to add values like hybrid regeneration / deploy or battery status since they are very important values if you drive a gtp. I am currently building my own dashboard since I have much more experience with python than with SimHub, however SimHub can read out these values.

Kind regards,
Jonas

pyirdk sometimes does not connect

Hi,

Sometimes (about 20% of the time) pyirsdk cannot initialize connection to the mmap file. I basically use code from example 3 and modified only loop() function to send telemetry over TCP. Some basic debug showed that mmap() is succesfull, but _header.version is 0, and _header.var_buf is "[]". I also tried to dump mmap with pyirsdk.exe but it failed to produce any file as well.

Restarting the script does not work. Only workaround is to close the sim and start it again. Sometimes I have to do this multiple times.

So it looks like the problem is iracing itself? Did you have same problem in the past?

Chat Example

Hi
chat_command(begin_chat) opens a new chat.
But how can I send now a chat message, for instance "clear #22 all your penalties have been cleared'
Thanks for your reply
Andi

bin files not closed after reading

Hi Kutu,

First of all thank you for this library!

I've been using *.bin files and I receive all the time that tracemalloc RuntimeWarning every time I ir.startup(test_file=my_bin_file).

Looking at the source code I see that the file is opened but not closed after reading. Is this on purpose?

pyirsdk/irsdk.py

Lines 415 to 418 in ad72f97

if test_file:
f = open(test_file, 'rb')
self._shared_mem = mmap.mmap(f.fileno(), 0, access=mmap.ACCESS_READ)
self.__is_using_test_file = True

Right now I am supressing that warning to not overwhelm my console log, but I was wondering if this could be fixed somehow.

I am happy to help by sending a PR fixing this if you want but maybe there's something that i am missing out.

Thanks again in advance!

Unable to find live BrakeBias

I'm unable to find the live brake bias from the telemetry. The only key I can find that contains something similar is under 'CarSetup' (which isn't in the vars.txt) - maybe I'm missing something crucial.

iRacing Shared memory information

Hello, I found your code for obtaining iRacing telemetry data on Github. I want to DIY a dashboard and need to obtain iRacing telemetry data, but I don’t have a parsing document for iRacing shared memory. Could you please give me? Looking forward to your help

Documentation of "indexed" variables?

The name of these indexed variables is a bit misleading. - e.g. CarIdxBestLapNum, CarIdxBestLapTime, CarIdxLastLapTime

I've tried accessing via ir['CarIdxBestLapNum'] and ir['CarIdxBestLapNum', 0] however I am always ever returned arrays of -1 or an error if the latter is tried. It is an array that is returned implying this is a list of all cars bestLapTime not a specific car index's lap time and not a specific provided car index?

Documentation currently says "Cars best lap number". "All cars best lap number" would be more precise.

Can you please update the vars.txt with that info.

Getting logged in users ID

I am trying to get the iracing ID of the logged in user. I assumed this would do it: PlayerCarIdx

        t = ir['PlayerCarIdx']
        print('players iracingid:', t)

But that only give me 0. (I joined a Official Practice session and ran it). My other code works ok.

Am I reading that description wrong?

Question regarding `CarIdxEstTime`

Is this setting:
CarIdxEstTime Estimated time to reach current location on track, s
talking about the estimated time for me to reach the position of the other cars (by index), or the estimated time for them to reach that position?

mmap.mmap() returns "TypeError: an integer is required (got type str)"

Hello,

I have just installed pyirsdk and I tried to run the basics example :

import irsdk
ir = irsdk.IRSDK()
ir.startup()
print(ir['Speed'])

And I get the following error :

~/.local/lib/python3.6/site-packages/irsdk.py in startup(self, test_file, dump_to)
354 self.__is_using_test_file = True
355 else:
--> 356 self._shared_mem = mmap.mmap(0, MEMMAPFILESIZE, MEMMAPFILE, access=mmap.ACCESS_READ)
357
358 if self._shared_mem:

TypeError: an integer is required (got type str)

Do you have any idea how I can fix it ?

"TreadRemaining" always returns "100%, 100%, 100%".

I am using the pyirsdk to build a dashboard interface and I always get "100%, 100%, 100%" for the "TreadRemaining" property of each tire. I know that this info only updates after a pit (to replicate crew inspection), but even when I run a bunch of laps, go into the pits, change tires, leave the pits, and see that the Black Box has updated with the tire wear numbers, the API is still giving me the 3x 100%s. Any idea why this is happening? I am running the DW12 in a Practice session.

Thanks!

loss of control

Hi kutu
Many thanks for the great SDK, it works like a charm:-)
Regarding incidents: there is only the incidents counter in the "DriverInfo" available right?
So, the way to detect the type of incident ist to store the old incident count and subtract the new.
So you get x1, x2 and x4 incidents, right?
Is there another approach to detect the incidents?
The off track can be detected reading the CarIdxTrackSurface, but how can I detect "loss of control" and "light contact with another driver" (0x0)?
Hope you can give me a direction, thanks in advance, Andi

error on car formula renault 2.0

code error when use car formula renault2.0.
Other cars no error! (I tested on skip barber and bmw. This car no problem)
sorry for my bad english.


Traceback (most recent call last):
File "C:\Users\cenanw8-1user\Downloads\datamonitorW161020.py", line 210, in
databox(ysX+0,30,d1_List,"LFshockDefl (m)",1000)
File "C:\Users\cenanw8-1user\Downloads\datamonitorW161020.py", line 120, in databox
if maxdata<i:maxdata=i
TypeError: unorderable types: float() < NoneType()


IsOnTrackCar and TireRF_RumblePitch

Hi @kutu,

I think something is not right in the latest December build of the iRacing.

The IsOnTrackCar is returning True when the car is not on the track.

The rumble pitch variables (like TireRF_RumblePitch) are always returning 0.

Any idea if they changed the sdk?

No hot pressures

Seems to be that the 'official' C code pulls in the hot tire pressures (on cars that have the sensors) and the python version does not.

Get fuel level in team races

Currently, when a teammate is running in a team race, ir['FuelLevel'] always returns 0. However, as spotter/CC, I can see my teammates current fuel level.

Is it possible to get the fuel level via pyirsdk?

Add support for multiple test files

Hello,

It would extremely useful to be able to pass several binary files on startup, and have the sdk cycle through them whenever the freeze_var_buffer_latest() function is called.
It would allow easier testing of behavior that depends on specific conditions.

Would you review a PR with this feature?

PlayerCarPowerAdjust mirrors PlayerCarPosition (maybe)

Hi,

This might be an iRacing issue. I don't think its my issue but it could be.

I have these two lines:
data['PlayerCarPosition'] = self.ir['PlayerCarPosition'] data['PlayerCarPowerAdjust'] = self.ir['PlayerCarPowerAdjust']

ir is an instance of irsdk.IRSDK() and data is a my structure going forward. If I print these out I get the same number.

'PlayerCarPosition': 19, 'PlayerCarPowerAdjust': 19,

I'm not sure that car position and power adjust would be the same assuming power adjust is the same as we see in the BOP.

How do you use LapLastNLapTime?

I can't seem to get anything but "0.0" Perhaps I misunderstand what it's supposed to provide. The documentation's explanation isn't very description of how to use it. Thanks!

Advance the tick on IBT file?

Hi, thanks for all the hard work.

I wanted to move from my rig to development machine for some testing, and I've ported over to IBT to do that with an ibt file. I can't see an obvious way to advance the tick on that ibt file – am I missing something or is it just not possible?

Error on _check_sim_status

Hi @kutu, I have one customer (only one from thousands) that is facing the issue below:

At first the problem would happen all the time, then I noticed that I was using an old version of the pyirsdk, I just update to latest version, the customer tried and 3 starts were successfully, but on the 4th the issue came back again.

11-16 19:20:38 SimRacingStudioApp.MainLoopThread.excepthook DEBUG Traceback (most recent call last):
File "backend\listeners\gameListener.py", line 464, in run
File "backend\listeners\gameListener.py", line 551, in mainloop
File "backend\listeners\iracingListener.py", line 19, in checkStatus
File "irsdk.py", line 400, in startup
File "irsdk.py", line 500, in _check_sim_status
File "http\client.py", line 475, in read
File "http\client.py", line 627, in _safe_read
http.client.IncompleteRead: IncompleteRead(0 bytes read, 35 more expected)

Any idea what could be causing this?

Thanks

How do I use a bin file with developing purposes

Hello,
thank you rally much for this big contribution to the racing world. I want to develop a tool for my SimRacing team, but I don't have iRacing, so I'm really keen on using a data.bin file to debug the code before using it with the drivers.

My question is, how do I simulate the time in IRSDK with this mode of test_file? I mean, I can print the speed for example, just by doing ir['Speed'], but it says 0.0 all the time. How can I move forward in the recorded time?

Thank you very much.

Example how to use SessionFlags

Can you please provide an example how to use the Flags class and the SessionFlags variable?

When I print the sessionflags, I just get a big int number.

Thanks!

Read .ibt file

I would like to know if it is possible to use this project to read the ibt files (telemetry) since I imagine they are quite similar.

I can read data from the file, but it only shows me the first sample and I don't know how to move it to the next ones ...

import irsdk
ir = irsdk.IRSDK()
ir.startup(test_file='test.ibt')

Is there a variable for battery?

Hey folks, appreciate the SDK. Its been really nice & well documented so far.

I was wondering if there is a variable (like ir['battery']) for the hybrid battery in cars for the GTP class.
I was unable to find it, maybe it exists or maybe it doesn't. (I assume its just a variable I overlooked)

Again, good work on the repo, its well made :)

What is csMode for?

The csMode class (irsdk.py, line 156) seems to remain unused in the rest of the lib.

Is there a way to tell iRacing to use one of these "auto-director" modes for a replay?

setup.py doesn't work when PyYAML is not preinstalled

I've discovered that installing the package through the setup.py doesn't work when PyYAML is not preinstalled.
That's because setup.py uses this line:
from irsdk import VERSION.

irsdk file is of course dependent on PyYAML.

Quick fix: move VERSION to different file like version.py and change line
from irsdk import VERSION
to
from version import VERSION

This is not a critical problem, but worth to resolve.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.