Compare commits
No commits in common. "9b85e3a633ab010fa348f2908233eef1aea6057a" and "7e764ddd777da6a7befd801eec82bc468db885f7" have entirely different histories.
9b85e3a633
...
7e764ddd77
@ -1,14 +1,11 @@
|
|||||||
FROM python:3.9
|
FROM python:3.9
|
||||||
|
|
||||||
ADD requirements.txt requirements.txt
|
ADD dual_ursim_control requirements.txt /dual_ursim_control/
|
||||||
RUN pip3 install -r requirements.txt
|
|
||||||
|
|
||||||
ADD dual_ursim_control /dual_ursim_control/
|
|
||||||
WORKDIR /dual_ursim_control/
|
WORKDIR /dual_ursim_control/
|
||||||
|
|
||||||
|
RUN pip3 install -r requirements.txt
|
||||||
|
|
||||||
ARG RELEASE_ID
|
ARG RELEASE_ID
|
||||||
ENV RELEASE_ID ${RELEASE_ID:-""}
|
ENV RELEASE_ID ${RELEASE_ID:-""}
|
||||||
|
|
||||||
EXPOSE 8888/tcp
|
|
||||||
|
|
||||||
CMD ["python3", "main.py"]
|
CMD ["python3", "main.py"]
|
@ -13,9 +13,7 @@ import openpyxl
|
|||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
import logging.config
|
import logging.config
|
||||||
from xmlrpc.server import SimpleXMLRPCServer
|
|
||||||
from configparser import ConfigParser
|
from configparser import ConfigParser
|
||||||
|
|
||||||
#from pynput.keyboard import Listener, Key
|
#from pynput.keyboard import Listener, Key
|
||||||
|
|
||||||
SCRIPT_DIR = os.path.dirname(__file__)
|
SCRIPT_DIR = os.path.dirname(__file__)
|
||||||
@ -40,11 +38,7 @@ j_acc = 0
|
|||||||
l_speed = 0
|
l_speed = 0
|
||||||
l_acc = 0
|
l_acc = 0
|
||||||
|
|
||||||
# jogging_wait = {"Master": False, "Slave": False}
|
jogging_wait = {"Master": False, "Slave": False}
|
||||||
jogging_event = {
|
|
||||||
'Master': threading.Event(),
|
|
||||||
'Slave': threading.Event()
|
|
||||||
}
|
|
||||||
|
|
||||||
path_master = {}
|
path_master = {}
|
||||||
path_slave = {}
|
path_slave = {}
|
||||||
@ -258,56 +252,50 @@ def read_path_waypoints_from_file():
|
|||||||
return path_master, path_slave
|
return path_master, path_slave
|
||||||
|
|
||||||
|
|
||||||
# def on_press(key):
|
def on_press(key):
|
||||||
# try:
|
try:
|
||||||
# # logging.debug("Key pressed: {0}".format(key))
|
# logging.debug("Key pressed: {0}".format(key))
|
||||||
#
|
|
||||||
# if hasattr(key, 'char'):
|
if hasattr(key, 'char'):
|
||||||
# if key.char == 'f':
|
if key.char == 'f':
|
||||||
# jogging_wait['Master'] = True
|
jogging_wait['Master'] = True
|
||||||
#
|
|
||||||
# elif key.char == 'e':
|
elif key.char == 'e':
|
||||||
# jogging_wait['Slave'] = True
|
jogging_wait['Slave'] = True
|
||||||
#
|
|
||||||
# except AttributeError:
|
except AttributeError:
|
||||||
# logging.debug("Special key pressed: {0}".format(key))
|
logging.debug("Special key pressed: {0}".format(key))
|
||||||
#
|
|
||||||
#
|
|
||||||
# def on_release(key):
|
def on_release(key):
|
||||||
# try:
|
try:
|
||||||
# # logging.debug("Key released: {0}".format(key))
|
# logging.debug("Key released: {0}".format(key))
|
||||||
#
|
|
||||||
# if hasattr(key, 'char'):
|
if hasattr(key, 'char'):
|
||||||
# if key.char == 'f':
|
if key.char == 'f':
|
||||||
# jogging_wait['Master'] = False
|
jogging_wait['Master'] = False
|
||||||
#
|
|
||||||
# elif key.char == 'e':
|
elif key.char == 'e':
|
||||||
# jogging_wait['Slave'] = False
|
jogging_wait['Slave'] = False
|
||||||
#
|
|
||||||
# except AttributeError:
|
except AttributeError:
|
||||||
# logging.debug("Special key pressed: {0}".format(key))
|
logging.debug("Special key pressed: {0}".format(key))
|
||||||
|
|
||||||
|
|
||||||
def master_jogging_wait():
|
def master_jogging_wait():
|
||||||
if config.getboolean('JOGGING_ENABLE'):
|
if config.getboolean('JOGGING_ENABLE'):
|
||||||
logging.debug("Master-Fred: Press 'f' to continue")
|
logging.debug("Master-Fred: Press 'f' to continue")
|
||||||
|
|
||||||
# while not jogging_wait['Master']:
|
while not jogging_wait['Master']:
|
||||||
# pass
|
pass
|
||||||
# jogging_wait['Master'] = False
|
|
||||||
jogging_event['Master'].clear()
|
|
||||||
jogging_event['Master'].wait()
|
|
||||||
|
|
||||||
|
|
||||||
def slave_jogging_wait():
|
def slave_jogging_wait():
|
||||||
if config.getboolean('JOGGING_ENABLE'):
|
if config.getboolean('JOGGING_ENABLE'):
|
||||||
logging.debug("Slave-Erik: Press 'e' to continue")
|
logging.debug("Slave-Erik: Press 'e' to continue")
|
||||||
|
|
||||||
# while not jogging_wait['Slave']:
|
while not jogging_wait['Slave']:
|
||||||
# pass
|
pass
|
||||||
# jogging_wait['Slave'] = False
|
|
||||||
jogging_event['Slave'].clear()
|
|
||||||
jogging_event['Slave'].wait()
|
|
||||||
|
|
||||||
|
|
||||||
def master_operate_gripper(target_width):
|
def master_operate_gripper(target_width):
|
||||||
@ -829,29 +817,6 @@ def slave_thread(sync_event, path):
|
|||||||
logging.info('Done')
|
logging.info('Done')
|
||||||
|
|
||||||
|
|
||||||
class RemoteFuncs:
|
|
||||||
def signalMaster(self):
|
|
||||||
# jogging_wait['Master'] = True
|
|
||||||
jogging_event['Master'].set()
|
|
||||||
return 0
|
|
||||||
|
|
||||||
def signalSlave(self):
|
|
||||||
# jogging_wait['Slave'] = True
|
|
||||||
jogging_event['Slave'].set()
|
|
||||||
return 0
|
|
||||||
|
|
||||||
|
|
||||||
class ServerThread(threading.Thread):
|
|
||||||
def __init__(self):
|
|
||||||
threading.Thread.__init__(self)
|
|
||||||
self.daemon = True
|
|
||||||
self.localServer = SimpleXMLRPCServer(('0.0.0.0', 8888))
|
|
||||||
self.localServer.register_instance(RemoteFuncs())
|
|
||||||
|
|
||||||
def run(self):
|
|
||||||
self.localServer.serve_forever()
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
||||||
logging.config.fileConfig(os.path.join(SCRIPT_DIR, 'log_config.ini'))
|
logging.config.fileConfig(os.path.join(SCRIPT_DIR, 'log_config.ini'))
|
||||||
@ -890,9 +855,7 @@ if __name__ == '__main__':
|
|||||||
'Slave': threading.Event()
|
'Slave': threading.Event()
|
||||||
}
|
}
|
||||||
|
|
||||||
logging.info('Spawning XMLRPC listener thread')
|
logging.info('Starting keyboard listener')
|
||||||
xmlrpcServer = ServerThread()
|
|
||||||
xmlrpcServer.start()
|
|
||||||
|
|
||||||
#listener = Listener(on_press=on_press, on_release=on_release)
|
#listener = Listener(on_press=on_press, on_release=on_release)
|
||||||
#listener.start()
|
#listener.start()
|
||||||
@ -916,3 +879,4 @@ if __name__ == '__main__':
|
|||||||
logging.info("Done")
|
logging.info("Done")
|
||||||
|
|
||||||
# TODO: export from ursimulator: root@xu:/var/snap/docker/common/var-lib-docker/volumes/dockursim/_data/programs.UR3#
|
# TODO: export from ursimulator: root@xu:/var/snap/docker/common/var-lib-docker/volumes/dockursim/_data/programs.UR3#
|
||||||
|
|
||||||
|
@ -1,8 +0,0 @@
|
|||||||
import xmlrpc.client
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
IP = '127.0.0.1'
|
|
||||||
PORT = '8888'
|
|
||||||
|
|
||||||
s = xmlrpc.client.ServerProxy("http://{0}:{1}".format(IP, PORT))
|
|
||||||
print(s.signalMaster())
|
|
@ -1,8 +0,0 @@
|
|||||||
import xmlrpc.client
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
IP = '127.0.0.1'
|
|
||||||
PORT = '8888'
|
|
||||||
|
|
||||||
s = xmlrpc.client.ServerProxy("http://{0}:{1}".format(IP, PORT))
|
|
||||||
print(s.signalSlave())
|
|
Loading…
Reference in New Issue
Block a user