Working network test
This commit is contained in:
parent
58605dbe85
commit
d2a4d93590
@ -1,8 +1,8 @@
|
|||||||
core:
|
core:
|
||||||
mode: winclient
|
mode: winclient
|
||||||
serverip: 192.168.1.20
|
serverip: 172.26.178.114
|
||||||
clientip: 192.168.1.21
|
clientip: 172.26.176.1
|
||||||
server: Hyper-V
|
server: Hyper-Vd
|
||||||
|
|
||||||
arm:
|
arm:
|
||||||
ip: 192.168.1.145
|
ip: 192.168.1.145
|
||||||
|
111
output.log
111
output.log
@ -263403,3 +263403,114 @@ Traceback (most recent call last):
|
|||||||
File "/usr/lib/python3.11/multiprocessing/pool.py", line 675, in _help_stuff_finish
|
File "/usr/lib/python3.11/multiprocessing/pool.py", line 675, in _help_stuff_finish
|
||||||
inqueue._rlock.acquire()
|
inqueue._rlock.acquire()
|
||||||
TypeError: killall() takes 0 positional arguments but 2 were given
|
TypeError: killall() takes 0 positional arguments but 2 were given
|
||||||
|
Process SpawnPoolWorker-2:
|
||||||
|
Traceback (most recent call last):
|
||||||
|
File "C:\Program Files\Python312\Lib\multiprocessing\process.py", line 314, in _bootstrap
|
||||||
|
self.run()
|
||||||
|
File "C:\Program Files\Python312\Lib\multiprocessing\process.py", line 108, in run
|
||||||
|
self._target(*self._args, **self._kwargs)
|
||||||
|
File "C:\Program Files\Python312\Lib\multiprocessing\pool.py", line 114, in worker
|
||||||
|
task = get()
|
||||||
|
^^^^^
|
||||||
|
File "C:\Program Files\Python312\Lib\multiprocessing\queues.py", line 366, in get
|
||||||
|
with self._rlock:
|
||||||
|
File "C:\Program Files\Python312\Lib\multiprocessing\synchronize.py", line 95, in __enter__
|
||||||
|
return self._semlock.__enter__()
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
KeyboardInterrupt
|
||||||
|
[__mp_main__:check_server_online]:Successfully connected to server.
|
||||||
|
Process SpawnPoolWorker-2:
|
||||||
|
Traceback (most recent call last):
|
||||||
|
File "C:\Program Files\Python312\Lib\multiprocessing\process.py", line 314, in _bootstrap
|
||||||
|
self.run()
|
||||||
|
File "C:\Program Files\Python312\Lib\multiprocessing\process.py", line 108, in run
|
||||||
|
self._target(*self._args, **self._kwargs)
|
||||||
|
File "C:\Program Files\Python312\Lib\multiprocessing\pool.py", line 114, in worker
|
||||||
|
task = get()
|
||||||
|
^^^^^
|
||||||
|
File "C:\Program Files\Python312\Lib\multiprocessing\queues.py", line 366, in get
|
||||||
|
with self._rlock:
|
||||||
|
File "C:\Program Files\Python312\Lib\multiprocessing\synchronize.py", line 95, in __enter__
|
||||||
|
return self._semlock.__enter__()
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
KeyboardInterrupt
|
||||||
|
[__mp_main__:send_ip_to_server]:Server response: IP Received
|
||||||
|
[__mp_main__:check_server_online]:Successfully connected to server.
|
||||||
|
Process SpawnPoolWorker-2:
|
||||||
|
Traceback (most recent call last):
|
||||||
|
File "C:\Program Files\Python312\Lib\multiprocessing\process.py", line 314, in _bootstrap
|
||||||
|
self.run()
|
||||||
|
File "C:\Program Files\Python312\Lib\multiprocessing\process.py", line 108, in run
|
||||||
|
self._target(*self._args, **self._kwargs)
|
||||||
|
File "C:\Program Files\Python312\Lib\multiprocessing\pool.py", line 114, in worker
|
||||||
|
task = get()
|
||||||
|
^^^^^
|
||||||
|
File "C:\Program Files\Python312\Lib\multiprocessing\queues.py", line 366, in get
|
||||||
|
with self._rlock:
|
||||||
|
File "C:\Program Files\Python312\Lib\multiprocessing\synchronize.py", line 95, in __enter__
|
||||||
|
return self._semlock.__enter__()
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
KeyboardInterrupt
|
||||||
|
Traceback (most recent call last):
|
||||||
|
File "c:\Users\cad05221\jukebox-software\run.py", line 268, in <module>
|
||||||
|
if setup_client(pool):
|
||||||
|
^^^^^^^^^^^^^^^^^^
|
||||||
|
File "c:\Users\cad05221\jukebox-software\run.py", line 184, in setup_client
|
||||||
|
firefox.get(config["core"]["serverip"])
|
||||||
|
File "C:\Users\cad05221\jukebox-software\venv\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 357, in get
|
||||||
|
self.execute(Command.GET, {"url": url})
|
||||||
|
File "C:\Users\cad05221\jukebox-software\venv\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 348, in execute
|
||||||
|
self.error_handler.check_response(response)
|
||||||
|
File "C:\Users\cad05221\jukebox-software\venv\Lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 229, in check_response
|
||||||
|
raise exception_class(message, screen, stacktrace)
|
||||||
|
selenium.common.exceptions.InvalidArgumentException: Message: Malformed URL: URL constructor: 172.26.178.114 is not a valid URL.
|
||||||
|
Stacktrace:
|
||||||
|
RemoteError@chrome://remote/content/shared/RemoteError.sys.mjs:8:8
|
||||||
|
WebDriverError@chrome://remote/content/shared/webdriver/Errors.sys.mjs:189:5
|
||||||
|
InvalidArgumentError@chrome://remote/content/shared/webdriver/Errors.sys.mjs:380:5
|
||||||
|
GeckoDriver.prototype.navigateTo@chrome://remote/content/marionette/driver.sys.mjs:851:11
|
||||||
|
|
||||||
|
Traceback (most recent call last):
|
||||||
|
File "c:\Users\cad05221\jukebox-software\run.py", line 268, in <module>
|
||||||
|
if setup_client(pool):
|
||||||
|
^^^^^^^^^^^^^^^^^^
|
||||||
|
File "c:\Users\cad05221\jukebox-software\run.py", line 184, in setup_client
|
||||||
|
firefox.get("http://" + config["core"]["serverip"] + ":8000")
|
||||||
|
File "C:\Users\cad05221\jukebox-software\venv\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 357, in get
|
||||||
|
self.execute(Command.GET, {"url": url})
|
||||||
|
File "C:\Users\cad05221\jukebox-software\venv\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 348, in execute
|
||||||
|
self.error_handler.check_response(response)
|
||||||
|
File "C:\Users\cad05221\jukebox-software\venv\Lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 229, in check_response
|
||||||
|
raise exception_class(message, screen, stacktrace)
|
||||||
|
selenium.common.exceptions.WebDriverException: Message: Reached error page: about:neterror?e=connectionFailure&u=http%3A//172.26.178.114%3A8000/&c=UTF-8&d=Firefox%20can%E2%80%99t%20establish%20a%20connection%20to%20the%20server%20at%20172.26.178.114%3A8000.
|
||||||
|
Stacktrace:
|
||||||
|
RemoteError@chrome://remote/content/shared/RemoteError.sys.mjs:8:8
|
||||||
|
WebDriverError@chrome://remote/content/shared/webdriver/Errors.sys.mjs:189:5
|
||||||
|
UnknownError@chrome://remote/content/shared/webdriver/Errors.sys.mjs:768:5
|
||||||
|
checkReadyState@chrome://remote/content/marionette/navigate.sys.mjs:58:24
|
||||||
|
onNavigation@chrome://remote/content/marionette/navigate.sys.mjs:324:39
|
||||||
|
emit@resource://gre/modules/EventEmitter.sys.mjs:154:20
|
||||||
|
receiveMessage@chrome://remote/content/marionette/actors/MarionetteEventsParent.sys.mjs:33:25
|
||||||
|
|
||||||
|
Traceback (most recent call last):
|
||||||
|
File "c:\Users\cad05221\jukebox-software\run.py", line 268, in <module>
|
||||||
|
if setup_client(pool):
|
||||||
|
^^^^^^^^^^^^^^^^^^
|
||||||
|
File "c:\Users\cad05221\jukebox-software\run.py", line 184, in setup_client
|
||||||
|
firefox.get("http://" + config["core"]["serverip"] + ":8000")
|
||||||
|
File "C:\Users\cad05221\jukebox-software\venv\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 357, in get
|
||||||
|
self.execute(Command.GET, {"url": url})
|
||||||
|
File "C:\Users\cad05221\jukebox-software\venv\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 348, in execute
|
||||||
|
self.error_handler.check_response(response)
|
||||||
|
File "C:\Users\cad05221\jukebox-software\venv\Lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 229, in check_response
|
||||||
|
raise exception_class(message, screen, stacktrace)
|
||||||
|
selenium.common.exceptions.WebDriverException: Message: Reached error page: about:neterror?e=connectionFailure&u=http%3A//172.26.178.114%3A8000/&c=UTF-8&d=Firefox%20can%E2%80%99t%20establish%20a%20connection%20to%20the%20server%20at%20172.26.178.114%3A8000.
|
||||||
|
Stacktrace:
|
||||||
|
RemoteError@chrome://remote/content/shared/RemoteError.sys.mjs:8:8
|
||||||
|
WebDriverError@chrome://remote/content/shared/webdriver/Errors.sys.mjs:189:5
|
||||||
|
UnknownError@chrome://remote/content/shared/webdriver/Errors.sys.mjs:768:5
|
||||||
|
checkReadyState@chrome://remote/content/marionette/navigate.sys.mjs:58:24
|
||||||
|
onNavigation@chrome://remote/content/marionette/navigate.sys.mjs:324:39
|
||||||
|
emit@resource://gre/modules/EventEmitter.sys.mjs:154:20
|
||||||
|
receiveMessage@chrome://remote/content/marionette/actors/MarionetteEventsParent.sys.mjs:33:25
|
||||||
|
|
||||||
|
86
run.py
86
run.py
@ -30,7 +30,7 @@ sensor_ready = False
|
|||||||
vm_ready = False
|
vm_ready = False
|
||||||
killme = None
|
killme = None
|
||||||
#pool = None
|
#pool = None
|
||||||
|
serverproc = None
|
||||||
|
|
||||||
def arm_start_callback(res):
|
def arm_start_callback(res):
|
||||||
global arm_ready
|
global arm_ready
|
||||||
@ -53,6 +53,7 @@ def vm_start_callback(res):
|
|||||||
vm_ready = True
|
vm_ready = True
|
||||||
|
|
||||||
def wait_for(val, name):
|
def wait_for(val, name):
|
||||||
|
#global val
|
||||||
if val is False:
|
if val is False:
|
||||||
fprint("waiting for " + name + " to complete...")
|
fprint("waiting for " + name + " to complete...")
|
||||||
while val is False:
|
while val is False:
|
||||||
@ -70,19 +71,8 @@ def start_server_socket():
|
|||||||
|
|
||||||
app.run(host='0.0.0.0', port=5000)
|
app.run(host='0.0.0.0', port=5000)
|
||||||
|
|
||||||
def start_client_socket(server_ip):
|
def start_client_socket():
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
server_url = 'http://' + server_ip + ':5000/report_ip'
|
|
||||||
|
|
||||||
|
|
||||||
def send_ip_to_server(server_url, client_ip):
|
|
||||||
try:
|
|
||||||
response = requests.post(server_url, json={'ip': client_ip}, timeout=1)
|
|
||||||
fprint(f"Server response: {response.text}")
|
|
||||||
return True
|
|
||||||
except requests.exceptions.RequestException as e:
|
|
||||||
fprint(f"Error sending IP to server: {e}")
|
|
||||||
return False
|
|
||||||
|
|
||||||
@app.route('/control_client', methods=['POST'])
|
@app.route('/control_client', methods=['POST'])
|
||||||
def message_from_server():
|
def message_from_server():
|
||||||
@ -91,13 +81,27 @@ def start_client_socket(server_ip):
|
|||||||
fprint(f"Message from server: {data.get('message')}")
|
fprint(f"Message from server: {data.get('message')}")
|
||||||
return "Message received", 200
|
return "Message received", 200
|
||||||
|
|
||||||
while not send_ip_to_server(server_url, config["core"]["clientip"]):
|
|
||||||
sleep(1)
|
|
||||||
global vm_ready
|
|
||||||
vm_ready = True
|
|
||||||
app.run(host='0.0.0.0', port=6000)
|
app.run(host='0.0.0.0', port=6000)
|
||||||
|
|
||||||
|
|
||||||
|
def check_server_online(serverip, clientip):
|
||||||
|
def send_ip_to_server(server_url, client_ip):
|
||||||
|
try:
|
||||||
|
response = requests.post(server_url, json={'ip': client_ip}, timeout=1)
|
||||||
|
fprint(f"Server response: {response.text}")
|
||||||
|
return True
|
||||||
|
except requests.exceptions.RequestException as e:
|
||||||
|
fprint(f"Error sending IP to server: {e}")
|
||||||
|
return False
|
||||||
|
|
||||||
|
server_url = 'http://' + serverip + ':5000/report_ip'
|
||||||
|
while not send_ip_to_server(server_url, clientip):
|
||||||
|
sleep(1)
|
||||||
|
|
||||||
|
fprint("Successfully connected to server.")
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
def setup_server(pool):
|
def setup_server(pool):
|
||||||
# linux server setup
|
# linux server setup
|
||||||
global config
|
global config
|
||||||
@ -106,21 +110,37 @@ def setup_server(pool):
|
|||||||
global camera_ready
|
global camera_ready
|
||||||
global led_ready
|
global led_ready
|
||||||
global arm_ready
|
global arm_ready
|
||||||
|
global serverproc
|
||||||
|
|
||||||
fprint("Starting Jukebox control system...")
|
fprint("Starting Jukebox control system...")
|
||||||
pool.apply_async(ur5_control.init, (config["arm"]["ip"],), callback=arm_start_callback)
|
pool.apply_async(ur5_control.init, (config["arm"]["ip"],), callback=arm_start_callback)
|
||||||
#pool.apply_async(led_control.init, callback=led_start_callback)
|
#pool.apply_async(led_control.init, callback=led_start_callback)
|
||||||
#pool.apply_async(camera_control.init, callback=camera_start_callback)
|
#pool.apply_async(camera_control.init, callback=camera_start_callback)
|
||||||
#pool.apply_async(sensor_control.init, callback=sensor_start_callback)
|
#pool.apply_async(sensor_control.init, callback=sensor_start_callback)
|
||||||
p = Process(target=start_server_socket)
|
serverproc = Process(target=start_server_socket)
|
||||||
p.start()
|
serverproc.start()
|
||||||
|
|
||||||
# wait for user to confirm init on webpage
|
# wait for user to confirm init on webpage
|
||||||
|
|
||||||
wait_for(led_ready, "LED controller initialization")
|
if led_ready is False:
|
||||||
wait_for(sensor_ready, "Sensor Initialization")
|
fprint("waiting for " + "LED controller initialization" + " to complete...")
|
||||||
wait_for(camera_ready, "Camera initilization")
|
while led_ready is False:
|
||||||
wait_for(arm_ready, "UR5 initilization")
|
sleep(0.1)
|
||||||
|
|
||||||
|
if sensor_ready is False:
|
||||||
|
fprint("waiting for " + "Sensor Initialization" + " to complete...")
|
||||||
|
while sensor_ready is False:
|
||||||
|
sleep(0.1)
|
||||||
|
|
||||||
|
if camera_ready is False:
|
||||||
|
fprint("waiting for " + "Camera initilization" + " to complete...")
|
||||||
|
while camera_ready is False:
|
||||||
|
sleep(0.1)
|
||||||
|
|
||||||
|
if arm_ready is False:
|
||||||
|
fprint("waiting for " + "UR5 initilization" + " to complete...")
|
||||||
|
while arm_ready is False:
|
||||||
|
sleep(0.1)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -150,7 +170,8 @@ def run_loading_app():
|
|||||||
def setup_client(pool):
|
def setup_client(pool):
|
||||||
# Windows client setup
|
# Windows client setup
|
||||||
global config
|
global config
|
||||||
|
global vm_ready
|
||||||
|
global serverproc
|
||||||
# Open loading wepage
|
# Open loading wepage
|
||||||
p = Process(target=run_loading_app)
|
p = Process(target=run_loading_app)
|
||||||
p.start()
|
p.start()
|
||||||
@ -164,11 +185,20 @@ def setup_client(pool):
|
|||||||
run_cmd("Start-VM -Name Jukebox*") # any and all VMs starting with "Jukebox"
|
run_cmd("Start-VM -Name Jukebox*") # any and all VMs starting with "Jukebox"
|
||||||
|
|
||||||
# Wait for VM to start and be reachable over the network
|
# Wait for VM to start and be reachable over the network
|
||||||
pool.apply_async(start_client_socket)
|
serverproc = Process(target=start_client_socket)
|
||||||
|
serverproc.start()
|
||||||
|
|
||||||
wait_for(vm_ready, "VM Startup")
|
pool.apply_async(check_server_online, (config["core"]["serverip"],config["core"]["clientip"]), callback=vm_start_callback)
|
||||||
|
|
||||||
|
#wait_for(vm_ready, "VM Startup")
|
||||||
|
|
||||||
|
#global vm_ready
|
||||||
|
if vm_ready is False:
|
||||||
|
fprint("waiting for " + "VM Startup" + " to complete...")
|
||||||
|
while vm_ready is False:
|
||||||
|
sleep(0.1)
|
||||||
p.terminate()
|
p.terminate()
|
||||||
firefox.get(config["core"]["serverip"])
|
firefox.get("http://" + config["core"]["serverip"] + ":5000")
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
@ -253,11 +283,13 @@ if __name__ == "__main__":
|
|||||||
if config["core"]["mode"] == "winclient":
|
if config["core"]["mode"] == "winclient":
|
||||||
from selenium import webdriver
|
from selenium import webdriver
|
||||||
if setup_client(pool):
|
if setup_client(pool):
|
||||||
|
fprint("Entering main loop...")
|
||||||
while(keeprunning):
|
while(keeprunning):
|
||||||
mainloop_client(pool)
|
mainloop_client(pool)
|
||||||
|
|
||||||
elif config["core"]["mode"] == "linuxserver":
|
elif config["core"]["mode"] == "linuxserver":
|
||||||
if setup_server(pool):
|
if setup_server(pool):
|
||||||
|
fprint("Entering main loop...")
|
||||||
while(keeprunning):
|
while(keeprunning):
|
||||||
mainloop_server(pool)
|
mainloop_server(pool)
|
||||||
|
|
||||||
|
@ -28,7 +28,13 @@ def init(ip):
|
|||||||
|
|
||||||
# init urx
|
# init urx
|
||||||
fprint("Connecting to arm at " + ip)
|
fprint("Connecting to arm at " + ip)
|
||||||
rob = urx.Robot(ip)
|
trying = True
|
||||||
|
while trying:
|
||||||
|
try:
|
||||||
|
rob = urx.Robot(ip)
|
||||||
|
trying = False
|
||||||
|
except:
|
||||||
|
time.sleep(1)
|
||||||
robotiqgrip = Robotiq_Two_Finger_Gripper(rob)
|
robotiqgrip = Robotiq_Two_Finger_Gripper(rob)
|
||||||
rob.set_tcp((0, 0, 0.15, 0, 0, 0))
|
rob.set_tcp((0, 0, 0.15, 0, 0, 0))
|
||||||
rob.set_payload(2, (0, 0, 0.1))
|
rob.set_payload(2, (0, 0, 0.1))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user