I send sensor data from my robot via a wireless link to my PC. There Processing is used to process the data.
At the moment I use Stings to send the messages.
Is there a way to submit the data in a more compressed form?
Is there a way to submit the data in a more compressed form?
Yes, but you loose the ability to sync messages. If a byte get lost, and that DOES happen, ASCII messages are easy to re-sync. Binary messages are MUCH harder to re-sync.
Is there a way to submit the data in a more compressed form?
Yes, but you loose the ability to sync messages. If a byte get lost, and that DOES happen, ASCII messages are easy to re-sync. Binary messages are MUCH harder to re-sync.
Do you have some sample code for resyncing. At the moment I do only fire the messages. If they are unvalid I drop them But it might still happen that the message is valid but the sensor reading got changed.
I also still need to implement kind of a handover procedure so that not both sides try to send messages at the same time.
PaulS:
1.523434
Are 6 decimal places reasonable?
I can certainly cut on this one. Done. I cut it down to 4 decimal places.
How do you determine that a packet is invalid? It's rather hard to answer generic questions. Seeing your code would make it much more specific, and easier to answer.
So if the # ist lost or any number is no longe a falid float - the message will cause an exception and will be droped. But as long as the basic structure isn't changed the message is still valid.
So far I didn't notice bad effects from altered messages. There is a non valid one once in a while. But more often my commands sent from the PC to the robot are dropped because hte robot is currently sending. So I need to implement a kind of "allowance to talk" whcih gets handed over between the two. Some true message validation wouldn't hurt either.
I gave it a short try. Works great for positive integers.
I struggle with reconstructing negative integers and floats on the processing side. I will need to spend some more time on it.