This repository was archived by the owner on Feb 21, 2020. It is now read-only.
Conversation
These changes are based on networking/udp_client.py
Debug works by running sample_server.py and controller.py. sample_server sends header and payload messages using the format for OtherInfo defined in server_info.py. Graph will have output on main load cell plot. Note that graph may look strange due to calibration. Code is very hacky right now as it assumes nbytes=16 for all headers.
Not sure if this work was worthwhile, but oh well. Also added back some old code in sample_server.py in case anyone wants to use sample_client.py.
There seem to be minor timing issues when reconnecting, since the header and payload are both 16 bytes and interpreting one as the other messes things up. To fix this, we can combine the message types into one so ordering isn't an issue. For now the problem seems to have been solved by removing the 5ms delay between sending the header and payload. I'm not sure why this works though. Also removed the NWThread class. Instead a new thread is started using the @run_async decorator every time we connect. Threads using old socket information return automatically when the sockets are closed.
Read some stuff and learned that UDP communicates through datagrams, which are like discrete units. This is in contrast to TCP, which uses streams. sample_server.py now sends the header and a single payload in one datagram rather than in two separate datagrams. networker.py reads the header and all payload data in a single datagram. The method of reading a header then data doesn't work for UDP (I think, which explains the errors I was getting previously).
Found a bug where we weren't actually writing to the data logs. Good thing we found this before the test.
berkalpyakici
approved these changes
Feb 9, 2019
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Moved udp sample from sample_client.py into networker. Changed the sample code so it sends packages that follow the format of OtherInfo. Running sample_server.py with the GUI code shows dummy data in the load cell main plot.
Will update after I test this code (probably tomorrow)