- Home /
Need help with using UDP joystick data properly with A.R. Drone SDK
Hello Unity Community!
I am trying to implement joystick data sent from C++ code with UDP packet to command an A.R. Drone 2.0. My codes are mostly based on scopus777/RiftDrone project on GitHub with some modifications. I can receive UDP data into Unity, but I'm having difficulty with implementing the UDP data to use as input commands for the drone. If anyone has any experience related to this and could give me some guidance, I would really appreciate it. Here is where I am at.
Approach 1: I can receive UDP data with a separate MonoBehaviour script within the same scene without any latency; however, I could not figure out a way to pass the data into the DroneControl code at run time without running into "Null Reference Exception". When I did some research about events, concurrent queue, etc... it looks like the codes would be similar to those of AR drone SDK. Thus, I tried approach 2.
Approach 2: I used similar method as RiftDorne or A.R. drone SDK for receiving navigation data. This approach kind of works but there is significant latency present at times, and the latency is not consistent. With this method, I could kind of give command such as changing the camera or even taking off and landing the drone based on the UDP data. But....when the data is utilized to take-off or land the drone, Unity sometimes crushes. I am suspecting that I am using the joystick UDP data in a way I am not supposed to. The codes to receive and handle the UDP data are attached in a zip file.
And I used like this in the DroneControl code.
My Unity and C# stills are still quite novice, so I might be making some big mistake. Please feel free to point them out. Thanks. link text
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
persistantdata deleted on steam build 0 Answers
How can I read data sent using the Transport API with python server 1 Answer
Finding scene names from a folder 1 Answer