OpenC3 / cosmos

OpenC3 COSMOS
https://openc3.com
Other
103 stars 29 forks source link

TCP Client Interface receiving muliple packet in one burst #1393

Open avan989 opened 1 month ago

avan989 commented 1 month ago

I am use the tcpip_client_interface.rb, and every time it reads "tlm", it reads multiple packets when I use the read_data in my custom PROTOCOL. How do I break the raw data into various packets/is there a way to return multiple raw data?

ryanmelt commented 1 month ago

You will need your protocol to return one packet worth of raw data and then queue up the rest into an internal instance variable.

Then on the next call to read_data it will first be passed an empty string which is your opportunity to return one of the queued additional packets.

avan989 commented 1 month ago

Wouldn’t this create a backlog, there is ~5 tlm in each “stream of data”, is there a way to speed up the call to read_data or a call to pass the raw data directly to tlm?

ryanmelt commented 1 month ago

In the end, the system has to be able to keep up with the interface. We have customers running at over 200 packets per second.

If you have interfaces receiving data at greater than 10Hz, try adding OPTION OPTIMIZE_THROUGHPUT 0.1 to your interfaces.

avan989 commented 1 month ago

If I could avoid the read_data, I think cosmos can keep up. I have ccsds packet wrap inside an ccsds packet, do u have a recommendation of getting the inner packet to tlm without using the read_data?

ryanmelt commented 1 month ago

Internal COSMOS processes packets. It is the interface (and protocols) job to inject those packets. read_data is the right place to do strip off layers.

The alternative is to leave the layered packet, and have your packet definitions expect that.