Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible to send multiple vars in one request? #106

Open
vamshichittaluri opened this issue Aug 6, 2021 · 8 comments
Open

Possible to send multiple vars in one request? #106

vamshichittaluri opened this issue Aug 6, 2021 · 8 comments

Comments

@vamshichittaluri
Copy link

Hey,

when we set data on the aircraft, instead of individually setting variables is it possible to send them at once? i've been seeing some jittering when i send more than one var immediately. Please suggest. I understand that in the simulation variables there are no structs to send them in as a structure, but I need help figuring out how to solve the jitter issue, when we set multiple vars via simconnect.

Kind Regards
Vamshi

@fyyyyy
Copy link

fyyyyy commented Jan 11, 2022

If you send them within the same render cycle there should be no jitter?

@Taz5150
Copy link

Taz5150 commented Jul 26, 2022

Hi,

Not sure if I am having the same issue, but here it goes.

Lets say I want to read two SimVars, one after the other, during the same deltaTime (or render cycle as @fyyyyy suggests):

simvar_cn1 = aq.get("TURB_ENG_CORRECTED_N1:1")
simvar_fn = aq.get("TURB_ENG_JET_THRUST:1")

Somehow, if I do this, these two variables are read at different cycles (I can tell since I can relate one to the other due to configuration files). I have tested these with SimVar Watcher in MSFS2020, and as expected they are read at the same cycle; but not with SimConnect through Python.

Any ideas how to solve this issue? @fyyyyy, how do you suggest to send them during the same render cycle?

Thank you.

PS: @vamshichittaluri did you solve it?

@fyyyyy
Copy link

fyyyyy commented Jul 27, 2022

This is probably a limitation of SimConnect, not related to python or this library in particular.

@Taz5150
Copy link

Taz5150 commented Jul 27, 2022

This is probably a limitation of SimConnect, not related to python or this library in particular.

Not really, we can do that on C# and C++ by controlling reading and writing SimVars at every deltaTime (every frame); SimVar Watcher, for example, works as expected.

There is probably a way to do in Python-Simconnect, I'm just not sure and did not find any examples.

Thank you in any case @fyyyyy

@mracko
Copy link

mracko commented Jul 27, 2022

Have you thought about running Python SimConnect multi-threaded? It could potentially solve your issue. I'm using this trick to make the Mobile Companion App run more smoothly.

@Taz5150
Copy link

Taz5150 commented Jul 27, 2022

Have you thought about running Python SimConnect multi-threaded? It could potentially solve your issue. I'm using this trick to make the Mobile Companion App run more smoothly.

Not sure that would help, honestly. I am testing with very small python scripts and just a couple of simvars, so threading should not be the issue or solution in this case.

There has to be a way to read a number of SimVars at a given frame cycle, like SimVar Watcher does.

@fyyyyy
Copy link

fyyyyy commented Jul 28, 2022

probalby configured here, try changing these

enum def

# Object Data Request Period values

use:

# SIMCONNECTAPI SimConnect_RequestDataOnSimObject(

class SIMCONNECT_PERIOD(CtypesEnum):  #
	SIMCONNECT_PERIOD_NEVER = 0
	SIMCONNECT_PERIOD_ONCE = 1
	SIMCONNECT_PERIOD_VISUAL_FRAME = 2
	SIMCONNECT_PERIOD_SIM_FRAME = 3
	SIMCONNECT_PERIOD_SECOND = 4

@Taz5150
Copy link

Taz5150 commented Jul 28, 2022

probalby configured here, try changing these

enum def

# Object Data Request Period values

use:

# SIMCONNECTAPI SimConnect_RequestDataOnSimObject(

class SIMCONNECT_PERIOD(CtypesEnum):  #
	SIMCONNECT_PERIOD_NEVER = 0
	SIMCONNECT_PERIOD_ONCE = 1
	SIMCONNECT_PERIOD_VISUAL_FRAME = 2
	SIMCONNECT_PERIOD_SIM_FRAME = 3
	SIMCONNECT_PERIOD_SECOND = 4

Good idea. Will look at it ASAP!! Thank you!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants