+1 vote
asked by (13 points)
Hi all,

 

I am trying to use UDP to input/output data with X-Plane 11 Demo(looking to buy full, but trying out what I can do first).

I am using Ubuntu 17.04 64 bit. But was trying it in Windows with the same result.

 

I am able to pass data to simulator using some hardware components like joystick/buttons connected to Arduino and that works fine. When I am trying to receive data from X-Plane 11 all of them are null. E.g.

Bytes:

[68, 82, 69, 70, 43, 0, 0, 0, 0, 115, 105, 109, 47, 99, 111, 99, 107, 112, 105, 116, 50, 47, 99, 111, 110, 116, 114, 111, 108, 115, 47, 112, 97, 114, 107, 105, 110, 103, 95, 98, 114, 97, 107, 101, 95, 114, 97, 116, 105, 111, 91, 48, 93, 0, <0s to fill to 509 bytes>, 0]

String:

DREF+ sim/cockpit2/controls/parking_brake_ratio[0]

Formatted:

DREF0    | REF: sim/cockpit2/controls/parking_brake_ratio[0]    | VAL: 0.0

 

4 bytes that should be responsible for value are always 0, 0, 0, 0. I have to use UDP as it is part of my project.

However, if I try it with X-Plane 10 I am able to receive data without any issues.

Does anybody have the same problem?

 

Kind regards,

Igor

1 Answer

0 votes
answered by (20 points)
I have an example Android project that you can look at which implements receiving of UDP DataRef packets from X-Plane 11: https://github.com/waynepiekarski/XPlaneMonitor

You need to enable the sending of these packets in the X-Plane settings, and they arrive in a format like this:

["DREF+"=5bytes] [float=4bytes] ["label/name/var[0]\0"=remaining_bytes]

I noticed in earlier versions of X-Plane 11, you would get 0.0 valued floats when you enabled a dataref, and you had to exit and restart X-Plane to get actual updates. This was fixed recently, but would have been a problem when you wrote this question. You might want to try it again.

Just recently I found a great blog post which explains in great detail how to receive datarefs and also how to send them back to X-Plane, which is worth reading through: http://blog.shahada.abubakar.net/post/linux-udp-network-client-library-for-x-plane-10-and-11

Welcome to X-Plane Q&A, where you can ask support questions and get answers from members of the community.

This site is for X-Plane support questions only. Please search for existing answers before posting your question. Off-topic questions will be locked.

If you’re new, you’ll need to register before asking your first question.

If your question is answered, click on the check mark to select the best response.

Categories

...