From f02f5e6c4f8060fedb994c93478174b0a754e18c Mon Sep 17 00:00:00 2001 From: Emil Harlan <eharlan@uni-bremen.de> Date: Thu, 1 Jun 2023 14:01:23 +0200 Subject: [PATCH] a --- robomaster_pi/conn_vel.py | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/robomaster_pi/conn_vel.py b/robomaster_pi/conn_vel.py index deb5f32..66cbeca 100644 --- a/robomaster_pi/conn_vel.py +++ b/robomaster_pi/conn_vel.py @@ -39,17 +39,11 @@ class vel_from_ros_node(Node): self.my_ep_chassis.drive_speed(x = 0, y = 0, z = 0.5) - def isConnected(self): - try: - # connect to the host -- tells us if the host is actually - # reachable - sock = socket.create_connection(("www.google.de", 80)) - if sock is not None: - print('Clossing socket') - sock.close - return True - except OSError: - pass + def check_ip_reachability(self): + response = ping3.ping("192.168.1.5") + if response is not None: + return True + else: return False -- GitLab