dwilches/Ardity

queue is full dropping messege

Closed this issue · 8 comments

hello

im having some issues regarding the unity section.
my arduino is sending a counter to unity via blutooth which unity then uses for other purposes, however i keep running into the
"queue is full dropping message" error and my problem i think is mostly that i haven't been able to figure out what does it mean.

i have tried all sorts of things like changing baud rates and port settings but all ive done is make the same problem appear on a USB cable connection as well (which was fine beforehand).

so if possible, id really appreciate if you could send a sort of explanation about the error (what does it mean, what may cause it ,etc...)

Hello,
Messages sent from Arduino to Unity are stored in a queue until they are consumed by your C# script.
If the script doesn't read them quick enough, then the queue gets full and messages start being dropped.

You need to either:

  • Send fewer messages from Arduino (because anyways Unity is not being able to use all the messages you are sending).
  • Drop some of the messages in the C# script (depending on what you use the messages for, you'll need to decide how to choose which messages to drop)

Hope this helps
Regards.

How can i send fewer messeges?
Also is there a way to improve script performence speed?

To send fewer messages you'll need to update your Arduino code. For example, in every execution of your loop function don't send messages to Unity, but only do that once every 10ms.
If you don't have access to that Arduino code, the first option I mentioned is out of reach then.

The second option I mentioned is to change your Unity code to do fewer things on each Arduino message. For example, in the message listener, don't try to update the translation/rotation/scale of your GameObjects directly, but instead, store the most recent data in variables and in the Update method only use the latest piece of data reported by Arduino to do the heavy computations (translate/rotate/scale).

So if ill make listener script that only puts the messege in a variable and a script that takes it and uses it it should work faster?

Thx for the quick responses btw

So if ill make listener script that only puts the messege in a variable and a script that takes it and uses it it should work faster?

I expect so.

I am reporting that it hasnt had any effect

I have tried both a the sampleMessegeListener and a script that puts the messege in a string and both dont work.

The result is that im getting less actual messeges than
the queue is full messeges which doesnt make sense to me