Skip to content

Commit 64bc85e

Browse files
committed
Don't use a separate thread for the e-stop test, don't manually destroy the subscription to the MCU status topic
1 parent 119291a commit 64bc85e

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

clearpath_tests/clearpath_tests/estop_test.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@
2626
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
2727
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
2828
# POSSIBILITY OF SUCH DAMAGE.
29-
import threading
30-
3129
from clearpath_tests.test_node import ClearpathTestNode, ClearpathTestResult
3230

3331
from geometry_msgs.msg import TwistStamped
@@ -101,11 +99,9 @@ def run_test(self):
10199

102100
self.results = []
103101
self.test_done = False
104-
ui_thread = threading.Thread(target=self.run_ui)
105-
ui_thread.start()
106-
while not self.test_done:
107-
pass
108-
ui_thread.join()
102+
103+
self.run_ui()
104+
109105
return self.results
110106

111107
def cmd_vel_timer_callback(self):

clearpath_tests/clearpath_tests/mcu_test.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ def get_firmware_version(self):
185185
def mcu_callback(status):
186186
self.mcu_status = status
187187

188-
mcu_sub = self.node.create_subscription(
188+
self.mcu_sub = self.node.create_subscription(
189189
Status,
190190
f'/{self.namespace}/platform/mcu/status',
191191
mcu_callback,
@@ -196,7 +196,6 @@ def mcu_callback(status):
196196
timeout_duration = Duration(seconds=10)
197197
while self.get_clock().now() - start_at <= timeout_duration and self.mcu_status is None:
198198
pass
199-
mcu_sub.destroy()
200199

201200
if self.mcu_status is None:
202201
return (None, None)

0 commit comments

Comments
 (0)