UBC-Thunderbots / Software

Robot Soccer Playing AI
http://www.ubcthunderbots.ca
GNU Lesser General Public License v3.0
53 stars 111 forks source link

`ProtoUDPListener` should not stop listening if it times out #3010

Open nimazareian opened 1 year ago

nimazareian commented 1 year ago

Description of the task

ProtoUDPListener should not restart listening if it timesout. During Robocup this caused lots of "hiccups" with the robot, causing the robot to stop for short periods of time in the same intervals as defined in the code (possibly due to primitive timeouts?). We noticed that reverting the changes to this file introduced in #2906 fixes the issue. https://github.com/UBC-Thunderbots/Software/blob/aaea6b7a9f09ea4c7706b5543de89c6aa8872456/src/software/networking/proto_udp_listener.hpp#L191-L205

It's worth noting that this change was initially added to field test fixture tests can close and cleanup properly with all threads stopping (@PhilD71 can talk more about this). So an alternative solution might be needed. In the meantime, we can probably remove this change.

Acceptance criteria

Blocked By

itsarune commented 1 year ago

what might be happening here is that the callback is done before we start waiting for the condition variable lock timeout. So we accidentally miss the cv and wait another second.

Should be easy enough to fix, we just need to add a callback_done boolean before we wait for the condition variable like here: stackoverflow.com/a/43898389/22708148