-
Notifications
You must be signed in to change notification settings - Fork 105
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
Get data from other SimObjects? #78
Comments
Not really 100% on what you are asking for. Just to confirm "simvar watcher sample program"
Can you prove sample of how you receive the data in Simvars.exe |
Ok I may be able to help, how do you get the SimObject ObjectID? |
I think this is what you are looking for. Could you test the code below with the code form Tree https://github.com/odwdinc/Python-SimConnect/tree/AI-SimObject-Data-Test from SimConnect import *
import logging
from SimConnect.Enum import *
from time import sleep
logging.basicConfig(level=logging.DEBUG)
LOGGER = logging.getLogger(__name__)
LOGGER.info("START")
# creat simconnection and pass used user classes
sm = SimConnect()
aq = AircraftRequests(sm)
AI_OBJECT_ID = 2607
pa = aq.find("PLANE_ALTITUDE")
pa.OBJECT_ID = AI_OBJECT_ID
phdyt = aq.find("PLANE_HEADING_DEGREES_TRUE")
phdyt.OBJECT_ID = AI_OBJECT_ID
pla = aq.find("PLANE_LATITUDE")
pla.OBJECT_ID = AI_OBJECT_ID
plo = aq.find("PLANE_LONGITUDE")
plo.OBJECT_ID = AI_OBJECT_ID
while not sm.quit:
print("PLANE ALTITUDE:", pa.value)
print("PLANE HEADING DEGREES TRUE:", phdyt.value)
print("PLANE LATITUDE:", pla.value)
print("PLANE LONGITUDE:", plo.value)
sleep(2)
sm.exit()
quit() |
I am going to test that now. Right now though I am getting the SImObjectID from ... |
FANTASTIC that is working. Now to add on to that I would like to be able to do something like (Not great at python yet. I may not be using the correct language, but i hope you get the point.) Then I can have the Coordinates or each plane to plot on the map. |
I working out how to get the list of ID's in python. what I can tell form the documentation. Next to get a list of id's it looks like we need to call SimConnect_RequestDataOnSimObjectType
For testing I set up this request. from SimConnect import *
import logging
from SimConnect.Enum import *
from time import sleep
logging.basicConfig(level=logging.DEBUG)
LOGGER = logging.getLogger(__name__)
LOGGER.info("START")
# creat simconnection and pass used user classes
sm = SimConnect()
aq = AircraftRequests(sm)
pa = aq.find("PLANE_ALTITUDE")
pa._deff_test()
sm.dll.RequestDataOnSimObjectType(
sm.hSimConnect,
pa.DATA_REQUEST_ID.value,
pa.DATA_DEFINITION_ID.value,
DWORD(200000),
SIMCONNECT_SIMOBJECT_TYPE.SIMCONNECT_SIMOBJECT_TYPE_AIRCRAFT,
)
temp = DWORD(0)
sm.dll.GetLastSentPacketID(sm.hSimConnect, temp)
pa.LastID = temp.value
sleep(5)
sm.exit()
quit() For now you can hard-set with code below. Note: fill AI_OBJECT_ID_LIST with list of the ID's you want to check. from SimConnect import *
import logging
from SimConnect.Enum import *
from time import sleep
logging.basicConfig(level=logging.DEBUG)
LOGGER = logging.getLogger(__name__)
LOGGER.info("START")
# creat simconnection and pass used user classes
sm = SimConnect()
aq = AircraftRequests(sm)
pa = aq.find("PLANE_ALTITUDE")
phdyt = aq.find("PLANE_HEADING_DEGREES_TRUE")
pla = aq.find("PLANE_LATITUDE")
plo = aq.find("PLANE_LONGITUDE")
AI_OBJECT_ID_LIST = [1, 2607]
while not sm.quit:
for ob_id in AI_OBJECT_ID_LIST:
plo.OBJECT_ID = ob_id
pla.OBJECT_ID = ob_id
phdyt.OBJECT_ID = ob_id
pa.OBJECT_ID = ob_id
print("PLANE ALTITUDE:", pa.value)
print("PLANE HEADING DEGREES TRUE:", phdyt.value)
print("PLANE LATITUDE:", pla.value)
print("PLANE LONGITUDE:", plo.value)
sleep(2)
sm.exit()
quit() |
I am trying to pull the data from other SimObjects, such as AI aircraft.
I can use the simvar watcher sample program, to see that the data can be pulled. Just not sure how to do that with this program
The text was updated successfully, but these errors were encountered: