Restart nvargus-daemon when argus_camera exits
Signed-off-by: Maxwell Henderson <mxwhenderson@gmail.com>
Change-Id: I5eaa1e2e7ef2ccf85eeb6d002c090e245f862e74
diff --git a/frc971/orin/argus_camera.cc b/frc971/orin/argus_camera.cc
index bb16674..a4dca06 100644
--- a/frc971/orin/argus_camera.cc
+++ b/frc971/orin/argus_camera.cc
@@ -565,6 +565,12 @@
if (buffer.nvbuf_surf() == nullptr) {
// TODO(austin): Control-C isn't working for some reason, debug it...
+ // We're restarting nvargus-daemon here because if we exit like this its
+ // likely that nvargus-daemon has run into an error that it can't
+ // recover from. Which means even if this program restarts it can't get
+ // new camera images.
+ CHECK_EQ(std::system("sudo systemctl restart nvargus-daemon.service"),
+ 0);
event_loop.Exit();
return;
}