personalrobotics / ada_feeding

Robot-assisted feeding demos and projects for the ADA robot

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[ROS2] Clean Termination of E-Stop Condition

amalnanavati opened this issue · comments

Currently, the e-stop condition doesn't close pyaudio or the stream. This can result in the number of channels detected for future calls to pyaudio being 0, until the machine restarts.

To address this, each watchdog condition should have a terminate method. The e-stop condition's terminate method specifically should contain:

self.stream.stop_stream()
self.stream.close()
self.audio.terminate()

Then, in ada_watchdog outside of the spin, we should call a terminate method of the watchdog, which in turn calls terminate for every condition.