diff --git a/.gitignore b/.gitignore
index f6c6e74..ab05e61 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,6 +3,7 @@ venv
__pycache__
# cable data folder(s)
cables
+cables_old
cables-sample.zip
# meilisearch (mainly where I've put the data volume for the container)
meili_data
diff --git a/cablesTF-1LF-006-RS5/part-hires.png b/cablesTF-1LF-006-RS5/part-hires.png
new file mode 100644
index 0000000..e3b458b
Binary files /dev/null and b/cablesTF-1LF-006-RS5/part-hires.png differ
diff --git a/config.yml b/config.yml
index 4d652d1..4da3b19 100644
--- a/config.yml
+++ b/config.yml
@@ -18,6 +18,9 @@ arm:
limb3: 0.1
limb_wrist: 0.0997
+cables:
+ port: 7900
+ directory: ./cables/ # must include trailing slash
#cable_map:
cameras:
@@ -30,7 +33,7 @@ led:
timeout: 1
controllers:
- universe: 1
- ip: 192.168.1.5
+ ip: 192.168.1.200
ledstart: 0
ledend: 143
mode: rgb
@@ -74,11 +77,11 @@ led:
ledstart: 1152
ledend: 1295
mode: rgb
- - universe: 0
- ip: 192.168.1.209
- ledstart: 1296
- ledend: 1365
- mode: rgbw
+ # - universe: 0
+ # ip: 192.168.1.209
+ # ledstart: 1296
+ # ledend: 1365
+ # mode: rgbw
map:
@@ -427,12 +430,12 @@ led:
pos: [65.991, -190.5]
# Strips
- - type: strip
- start: 1296
- size: 70
- length: 600
- angle: 270 # down
- pos: [375, 300]
+ # - type: strip
+ # start: 1296
+ # size: 70
+ # length: 600
+ # angle: 270 # down
+ # pos: [375, 300]
global_position_offset: [0,0] # default coordinate spce below as center of arm at 0,0 - adjust if necessary
animation_time: 200
diff --git a/fileserver.py b/fileserver.py
new file mode 100644
index 0000000..4caf16c
--- /dev/null
+++ b/fileserver.py
@@ -0,0 +1,16 @@
+import http.server
+import socketserver
+import os
+
+def run_server(port, directory):
+ """
+ Run a simple HTTP server serving files from the specified directory.
+ """
+ # Change the working directory to the specified directory
+ os.chdir(directory)
+
+ # Create the HTTP server
+ handler = http.server.SimpleHTTPRequestHandler
+ with socketserver.TCPServer(("", port), handler) as httpd:
+ print(f"Serving at port {port}")
+ httpd.serve_forever()
diff --git a/get_specs.py b/get_specs.py
index 36586bd..a775249 100755
--- a/get_specs.py
+++ b/get_specs.py
@@ -159,8 +159,9 @@ def touch(path):
-def get_multi(partnums, delay=0.25, dir="cables/", cache=True, bar=None):
+def get_multi(partnums, delay, dir, webport, cache=True, bar=None):
#with alive_bar(len(partnums) * 2, dual_line=True, calibrate=30, bar="classic2", spinner="classic", disable=True, file=sys.stdout) as bar:
+
failed = list()
actualpartnums = list()
def _try_download_datasheet(partnum, output_dir, dstype): # Guess datasheet URL
@@ -253,7 +254,7 @@ def get_multi(partnums, delay=0.25, dir="cables/", cache=True, bar=None):
os.remove(partnum + "/datasheet.pdf")
sys.exit()
- def __use_cached_datasheet(partnum, path, output_dir, dstype):
+ def __use_cached_datasheet(partnum, path, output_dir, dstype, weburl):
fprint("Using cached datasheet for " + partnum)
# bar.text = "Using cached datasheet for " + partnum
# bar(skipped=True)
@@ -262,7 +263,7 @@ def get_multi(partnums, delay=0.25, dir="cables/", cache=True, bar=None):
fprint("Parsing Datasheet contents of " + partnum)
# bar.text = "Parsing Datasheet contents of " + partnum + ".pdf..."
- out = read_datasheet.parse(path, output_dir, partnum, dstype)
+ out = read_datasheet.parse(path, output_dir, partnum, dstype, weburl)
# bar(skipped=False)
return out
else:
@@ -270,13 +271,13 @@ def get_multi(partnums, delay=0.25, dir="cables/", cache=True, bar=None):
# bar.text = "Datasheet already parsed for " + partnum + ".pdf"
# bar(skipped=True)
- def __downloaded_datasheet(partnum, path, output_dir, dstype):
+ def __downloaded_datasheet(partnum, path, output_dir, dstype, weburl):
fprint("Downloaded " + path)
# bar.text = "Downloaded " + path
# bar(skipped=False)
fprint("Parsing Datasheet contents of " + partnum)
# bar.text = "Parsing Datasheet contents of " + partnum + ".pdf..."
- out = read_datasheet.parse(path, output_dir, partnum, dstype)
+ out = read_datasheet.parse(path, output_dir, partnum, dstype, weburl)
# bar(skipped=False)
return out
@@ -289,6 +290,7 @@ def get_multi(partnums, delay=0.25, dir="cables/", cache=True, bar=None):
partnum = partnum.replace("/","_")
output_dir = dir + partnum
path = output_dir + "/datasheet.pdf"
+ weburl = ":" + str(webport) + "/" + partnum + "/"
bartext = "Downloading files for part " + partnum
# bar.text = bartext
partnum = oldpartnum.replace("_","/")
@@ -311,26 +313,27 @@ def get_multi(partnums, delay=0.25, dir="cables/", cache=True, bar=None):
if _download_image(search_result["image"], output_dir):
fprint("Downloaded hi-res part image for " + partnum)
returnval = [partnum, dstype, True, False]
- touch(output_dir + "/found_part_hires")
+ os.remove(output_dir + "/parsed")
+ touch(output_dir + "/found_part_hires")
else:
fprint("Using cached hi-res part image for " + partnum)
# Download datasheet from provided URL if needed
if os.path.exists(path) and os.path.getsize(path) > 1 and cache:
- out = __use_cached_datasheet(partnum, path, output_dir, dstype)
+ out = __use_cached_datasheet(partnum, path, output_dir, dstype, weburl)
returnval = [partnum, dstype, True, out]
elif _download_datasheet(search_result["datasheet"], output_dir) is not False:
- out = __downloaded_datasheet(partnum, path, output_dir, dstype)
+ out = __downloaded_datasheet(partnum, path, output_dir, dstype, weburl)
returnval = [partnum, dstype, True, out]
elif os.path.exists(path) and os.path.getsize(path) > 1 and cache:
- out = __use_cached_datasheet(partnum, path, output_dir, dstype)
+ out = __use_cached_datasheet(partnum, path, output_dir, dstype, weburl)
returnval = [partnum, dstype, True, out]
# If search fails, and we don't already have the datasheet, guess datasheet URL and skip the hires image download
elif _try_download_datasheet(partnum, output_dir, dstype) is not False:
- out = __downloaded_datasheet(partnum, path, output_dir, dstype)
+ out = __downloaded_datasheet(partnum, path, output_dir, dstype, weburl)
returnval = [partnum, dstype, False, out]
# Failed to download with search or guess :(
@@ -342,7 +345,7 @@ def get_multi(partnums, delay=0.25, dir="cables/", cache=True, bar=None):
# We already have a hi-res image and the datasheet - perfect!
else:
fprint("Using cached hi-res part image for " + partnum)
- out = __use_cached_datasheet(partnum, path, output_dir, dstype)
+ out = __use_cached_datasheet(partnum, path, output_dir, dstype, weburl)
returnval = [partnum, dstype, False, out]
actualpartnums.append(returnval)
return True
diff --git a/jukebox-web b/jukebox-web
index f3d8ec0..4cea1b0 160000
--- a/jukebox-web
+++ b/jukebox-web
@@ -1 +1 @@
-Subproject commit f3d8ec0cc421cb8f8b7bb4b30339f3663f70b297
+Subproject commit 4cea1b08329761fa5485686e0ff0871730f73820
diff --git a/led_control.py b/led_control.py
index e8a141e..01613ea 100755
--- a/led_control.py
+++ b/led_control.py
@@ -157,11 +157,12 @@ class LEDSystem():
# controller mapping
for ctrl in self.config["led"]["controllers"]:
- if len(self.controllers) < ctrl["universe"]+1:
- for x in range(ctrl["universe"]+1 - len(self.controllers)):
+ if len(self.controllers) < ctrl["universe"]:
+ print(ctrl["universe"])
+ for x in range(ctrl["universe"] - len(self.controllers)):
self.controllers.append(None)
- self.controllers[ctrl["universe"]] = (ctrl["ledstart"],ctrl["ledend"]+1,ctrl["ip"])
+ self.controllers[ctrl["universe"]-1] = (ctrl["ledstart"],ctrl["ledend"]+1,ctrl["ip"])
for x in range(ctrl["ledstart"],ctrl["ledend"]+1):
self.leds_size[x] = len(ctrl["mode"])
#fprint(controllers)
@@ -201,7 +202,7 @@ class LEDSystem():
time.sleep(1)
for x in range(len(self.controllers)):
- print("Activating controller", x, "at", self.controllers[x][2], "with", self.controllers[x][1]-self.controllers[x][0], "LEDs.")
+ print("Activating controller", x+1, "at", self.controllers[x][2], "with", self.controllers[x][1]-self.controllers[x][0], "LEDs.")
self.sender.activate_output(x+1) # start sending out data
self.sender[x+1].destination = self.controllers[x][2]
self.sender.manual_flush = True
@@ -246,7 +247,7 @@ class LEDSystem():
def fastsendall(self, datain):
# send all LED data to all controllers
# data must have all LED data in it as [(R,G,B,)] tuples in an array, 1 tuple per pixel
- self.sender.manual_flush = False
+ self.sender.manual_flush = True
#print(datain[self.controllers[0][0]:self.controllers[0][1]])
for x in range(len(self.controllers)):
self.sender[x+1].dmx_data = list(sum(datain[self.controllers[x][0]:self.controllers[x][1]] , ())) # flatten the subsection of the data array
@@ -528,15 +529,21 @@ class LEDSystem():
self.sender.stop()
return self
- def mapimage(self, image, fps=90):
- while uptime() - self.start < 1/fps:
- time.sleep(0.00001)
+ def mapimage(self, image, fps=30):
+
#fprint(1 / (uptime() - self.start))
self.start = uptime()
minsize = min(image.shape[0:2])
- leds_normalized2 = [(x * minsize,
- y * minsize)
- for x, y in self.leds_normalized]
+ if image.shape[1] > image.shape[0]:
+ offset = (image.shape[1] - image.shape[0])/2
+ leds_normalized2 = [(x * minsize + offset,
+ y * minsize)
+ for x, y in self.leds_normalized]
+ else:
+ offset = (image.shape[0] - image.shape[1])/2
+ leds_normalized2 = [(x * minsize,
+ y * minsize + offset)
+ for x, y in self.leds_normalized]
cv2.imshow("video", image)
cv2.waitKey(1)
@@ -563,6 +570,8 @@ class LEDSystem():
#avgy /= len(leds)
#print((avgx,avgy, max([led[0] for led in leds_adj]), max([led[1] for led in leds_adj]) , min(image.shape[0:2]) ))
self.fastsendall(self.data)
+ while self.start + 1.0/fps > uptime():
+ time.sleep(0.00001)
return self
def mainloop(self, stmode, ring = -1, fps = 100, preview = False):
@@ -646,12 +655,12 @@ if __name__ == "__main__":
import matplotlib.pyplot as plt
ledsys = LEDSystem()
ledsys.init()
- cap = cv2.VideoCapture('output.mp4')
+ cap = cv2.VideoCapture('badapple.mp4')
while cap.isOpened():
ret, frame = cap.read()
if not ret:
break
- ledsys.mapimage(frame, fps=90)
+ ledsys.mapimage(frame, fps=120)
show = False
ring = 1
diff --git a/map.png b/map.png
index 7b0880e..ab99b37 100644
Binary files a/map.png and b/map.png differ
diff --git a/read_datasheet.py b/read_datasheet.py
index 0d89a59..6e72d23 100755
--- a/read_datasheet.py
+++ b/read_datasheet.py
@@ -37,7 +37,7 @@ def extract_table_name(table_start, searchpage, reader, dstype, fallbackname):
ymax = table_start + 10
elif dstype == "Alphawire":
ymin = table_start - 5
- ymax = table_start + 10
+ ymax = table_start + 20
page = reader.pages[searchpage - 1]
parts = []
def visitor_body(text, cm, tm, fontDict, fontSize):
@@ -52,14 +52,30 @@ def extract_table_name(table_start, searchpage, reader, dstype, fallbackname):
return text_body
#fprint(text_body)
-def parse(filename, output_dir, partnum, dstype):
+def find_file_noext(directory, prefix="part-hires"):
+ """
+ Find files in the specified directory that start with the given prefix and have any extension.
+
+ :param directory: The directory to search in.
+ :param prefix: The prefix to search for.
+ :return: A list of matching file names.
+ """
+ # Get all files and directories in the specified directory
+ entries = os.listdir(directory)
+ # Filter files that match 'filename.EXTENSION'
+ matching_files = [file for file in entries if os.path.isfile(os.path.join(directory, file)) and file.split('.')[0] == prefix and len(file.split('.')) == 2]
+ print(directory, matching_files)
+ return matching_files
+
+
+def parse(filename, output_dir, partnum, dstype, weburl):
tables = []
# Extract table data
try:
if dstype == "Belden":
tables = camelot.read_pdf(filename, pages="1-end", flavor='lattice', backend="ghostscript", split_text=False, line_scale=100, process_background=True, resolution=600, interations=1, layout_kwargs={'detect_vertical': False, 'char_margin': 0.5}, shift_text=['r', 't'])
elif dstype == "Alphawire":
- tables = camelot.read_pdf(filename, pages="1-end", flavor='lattice', backend="ghostscript", split_text=False, line_scale=50, process_background=True, resolution=600, interations=1, layout_kwargs={'detect_vertical': True, 'char_margin': 0.5}, shift_text=['l', 't'])
+ tables = camelot.read_pdf(filename, pages="1-end", flavor='lattice', backend="ghostscript", split_text=False, line_scale=50, process_background=True, resolution=600, interations=1, layout_kwargs={'detect_vertical': True, 'char_margin': 0.5}, shift_text=['l', 'b'])
except (OSError, RuntimeError) as e:
print(e)
if win32:
@@ -95,11 +111,26 @@ def parse(filename, output_dir, partnum, dstype):
#fprint(table_start)
text_body = extract_table_name(table_start, table.page, reader, dstype, n)
-
+ #print(text_body)
table_list[text_body] = table.df
+ #print(table_list[text_body])
if dstype == "Alphawire":
- table_list_raw[text_body] = table
+
+ def reorder_row(row):
+ # Filter out NaNs and compute the original non-NaN values
+ non_nans = row[~row.isnull()]
+ # Create a new row with NaNs filled at the end
+ new_row = pd.Series(index=row.index)
+ new_row[:len(non_nans)] = non_nans
+ return new_row
+
+ # Apply the function to each row and return a new DataFrame
+
+ #table_list[text_body] = table.df.apply(reorder_row, axis=1)
+ #print(table_list[text_body])
+ table_list_raw[text_body] = table
+ #print(tbl)
#table.to_html("table" + str(n) + ".html")
#fprint(table.df)
@@ -133,6 +164,13 @@ def parse(filename, output_dir, partnum, dstype):
with open(output_dir + "/brand.png", "wb") as fp:
fp.write(image_file_object.data)
count += 1
+
+ if os.path.exists(output_dir + "/found_part_hires"):
+ img = weburl + find_file_noext(output_dir, prefix="part-hires")[0]
+ elif len(find_file_noext(output_dir, prefix="part")) > 0:
+ img = weburl + find_file_noext(output_dir, prefix="part")[0]
+ else:
+ img = None
# Table parsing and reordring
tables = dict()
@@ -141,6 +179,7 @@ def parse(filename, output_dir, partnum, dstype):
#print(table_list.keys())
for table_name in table_list.keys():
# determine shape: horizontal or vertical
+ #print(table_name)
table = table_list[table_name]
rows = table.shape[0]
cols = table.shape[1]
@@ -177,11 +216,11 @@ def parse(filename, output_dir, partnum, dstype):
if dstype == "Alphawire" and table_name_2.find("\n") >= 0:
torename[table_name_2] = table_name_2[0:table_name_2.find("\n")]
- if dstype == "Alphawire" and table_name_2.find(table.iloc[-1, 0]) >= 0:
- # Name taken from table directly above - this table does not have a name
- torename[table_name_2] = "Specs " + str(len(tables))
- #table_list["Specs " + str(len(tables))] = table_list[table_name_2] # rename table to arbitrary altername name
- break
+ # if dstype == "Alphawire" and table_name_2.find(table.iloc[-1, 0]) >= 0:
+ # # Name taken from table directly above - this table does not have a name
+ # torename[table_name_2] = "Specs " + str(len(tables))
+ # #table_list["Specs " + str(len(tables))] = table_list[table_name_2] # rename table to arbitrary altername name
+ # break
if vertical:
out = dict()
@@ -199,9 +238,9 @@ def parse(filename, output_dir, partnum, dstype):
out[col_data[0].replace("\n", " ")] = col_data[1:]
tables[table_name] = out
-
+ #print(out)
# multi-page table check, Alphawire
- if dstype == "Alphawire" and table_name.isdigit():
+ if dstype == "Alphawire" and table_name.isdigit() and previous_table != "":
# table continues from previous page or has name on previous page
thistbl = table_list_raw[table_name]
prevtbl = table_list_raw[previous_table]
@@ -294,15 +333,20 @@ def parse(filename, output_dir, partnum, dstype):
tables = replace_newlines_in_dict(tables)
# summary
-
+ #print(tables)
output_table = dict()
output_table["partnum"] = partnum
id = str(uuid.uuid4())
output_table["id"] = id
#output_table["position"] = id
- #output_table["brand"] = brand
- output_table["fullspecs"] = {"partnum": partnum, "id": id, **tables}
- output_table["searchspecs"] = {"partnum": partnum, **flatten(tables)}
+ output_table["brand"] = dstype
+ if img is not None:
+ output_table["image"] = img
+ output_table["fullspecs"] = {"partnum": partnum, "id": id, "brand": dstype, "image": img, **tables}
+ output_table["searchspecs"] = {"partnum": partnum, "brand": dstype, "image": img, **flatten(tables)}
+ else:
+ output_table["fullspecs"] = {"partnum": partnum, "id": id, "brand": dstype, **tables}
+ output_table["searchspecs"] = {"partnum": partnum, "brand": dstype, **flatten(tables)}
output_table["searchspecs"]["id"] = id
@@ -380,4 +424,4 @@ def flatten(tables):
if __name__ == "__main__":
- print(parse("cables/3050/datasheet.pdf", "cables/3050", "3050", "Alphawire"))
\ No newline at end of file
+ print(parse("cables/3050/datasheet-new.pdf", "cables/3050", "3050", "Alphawire"))
\ No newline at end of file
diff --git a/run.py b/run.py
index 9c608bd..1066aaa 100755
--- a/run.py
+++ b/run.py
@@ -29,6 +29,7 @@ from search import JukeboxSearch
#multiprocessing.set_start_method('spawn', True)
from pyModbusTCP.client import ModbusClient
from uptime import uptime
+import fileserver
# set to false to run without real hardware for development
real = False
@@ -161,7 +162,11 @@ def check_server():
tmp = list()
for idx in range(len(cable_list)):
if cable_list[idx] is not False:
- tmp1 = {"part_number": cable_list[idx], "position": idx, "name": cable_list[idx], "brand": "Belden", "description": "Blah", "short_description": "Bla"}
+ cabledata = jbs.get_position(str(idx))
+ if "image" in cabledata:
+ tmp1 = {"part_number": cable_list[idx], "position": idx, "name": cable_list[idx], "brand": cabledata["brand"], "image": cabledata["image"], "description": "Blah", "short_description": "Bla"}
+ else:
+ tmp1 = {"part_number": cable_list[idx], "position": idx, "name": cable_list[idx], "brand": cabledata["brand"], "description": "Blah", "short_description": "Bla"}
tmp.append(tmp1)
out = {"map": tmp}
fprint(out)
@@ -354,6 +359,9 @@ def setup_server(pool):
fprint("Starting websocket server...", sendqueue=to_server_queue)
websocket_process = server.start_websocket_server(to_server_queue, from_server_queue)
+ fprint("Starting image file server...", sendqueue=to_server_queue)
+ image_server_process = Process(target=fileserver.run_server, args=(config["cables"]["port"], config["cables"]["directory"]))
+ image_server_process.start()
return True
def handle_error(error):
@@ -379,13 +387,18 @@ def get_sensors():
out = list()
if real:
for reg in [352, 288, 304, 368]:
- val = mbconn.read_holding_registers(reg)[0]
- if val == 1:
- out.append(1)
- else:
- out.append(0)
+ val = mbconn.read_holding_registers(reg)
+ if val is not None:
+ val = val[0]
+ if val == 1:
+ out.append(1)
+ else:
+ out.append(0)
else:
out = [0, 0, 0, 0]
+
+ if len(out) != 4:
+ return -1
sensors = out
#fprint("Values: " + str(sensors))
#mbconn.close()
@@ -538,7 +551,7 @@ def mainloop_server(pool):
for idx in range(len(cable_list)):
cable_list_state.append(True)
- pool.apply_async(get_specs.get_multi, (cable_list, 0.3), callback=cable_search_callback, error_callback=handle_error)
+ pool.apply_async(get_specs.get_multi, (cable_list, 0.3, config["cables"]["directory"], config["cables"]["port"]), callback=cable_search_callback, error_callback=handle_error)
mode = "Parsing"
fprint("All cables scanned. Finding & parsing datasheets...")
if mode == "Parsing":
diff --git a/table0.html b/table0.html
new file mode 100644
index 0000000..ff32df4
--- /dev/null
+++ b/table0.html
@@ -0,0 +1,76 @@
+
+
+
+ |
+ 1 |
+ 2 |
+ 3 |
+ 4 |
+
+
+
+
+ 2 |
+ |
+ |
+ |
+ Diameters\n(In) |
+
+
+ 4 |
+ 1) Component\n1\n1 X 1 HOOKUP |
+ |
+ |
+ |
+
+
+ 6 |
+ a) Conductor\n24\n(7/32) AWG Tinned Copper |
+ |
+ |
+ 0.024 |
+
+
+ 8 |
+ b)\nInsulation\n0.016" Wall, Nom. PVC |
+ |
+ |
+ 0.056+/-\n0.002 |
+
+
+ 10 |
+ |
+ (1) Print |
+ ALPHA WIRE\nE163869-* RU AWM STYLES\n1569\n105C\nOR 1007\n80C 300V VW-1\nIEC 60332-2\n24 AWG\nOR CRU TR-64\n90C FT1 CE ROHS\n{0}\n* = Factory Code |
+ |
+
+
+ 12 |
+ |
+ (2) Color(s) |
+ WHITE, BLACK, GREEN,\nYELLOW, BLUE, BROWN, ORANGE\nSLATE, VIOLET, WHITE/BLACK, WHITE/RED |
+ |
+
+
+ 13 |
+ |
+ |
+ WHITE/GREEN, WHITE/YELLOW, WHITE/BLUE\nWHITE/BROWN, WHITE/ORANGE, WHITE/SLATE\nWHITE/VIOLET, GREEN/YELLOW,\nPINK, DK. BLUE |
+ |
+
+
+ 14 |
+ |
+ |
+ BROWN/BLACK, WHITE/PINK, BROWN/GREEN, BROWN/BLUE |
+ |
+
+
+ 15 |
+ |
+ |
+ RED |
+ |
+
+
+
\ No newline at end of file
diff --git a/table1.html b/table1.html
new file mode 100644
index 0000000..64c9ddb
--- /dev/null
+++ b/table1.html
@@ -0,0 +1,46 @@
+
+
+
+ |
+ 1 |
+ 2 |
+
+
+
+
+ 2 |
+ 1) UL |
+ AWM/STYLE\n1007\n80°C /\n300 VRMS |
+
+
+ 4 |
+ |
+ AWM/STYLE\n1569\n105°C /\n300 VRMS |
+
+
+ 6 |
+ |
+ VW-1 |
+
+
+ 8 |
+ 2) CSA International |
+ TR-64\n90°C |
+
+
+ 10 |
+ |
+ FT1 |
+
+
+ 12 |
+ 3)\nIEC |
+ EN 60332-2\nFlame Behavior |
+
+
+ 14 |
+ 4) CE: |
+ EU Low Voltage Directive\n2014/35/EU |
+
+
+
\ No newline at end of file
diff --git a/table2.html b/table2.html
new file mode 100644
index 0000000..1eacab7
--- /dev/null
+++ b/table2.html
@@ -0,0 +1,60 @@
+
+
+
+ |
+ 1 |
+ 2 |
+ 4 |
+
+
+
+
+ 2 |
+ 1)\nEU Directive\n2011/65/EU(RoHS2),\nEU Directive\n2015/863/EU (RoHS3): |
+ |
+ |
+
+
+ 4 |
+ |
+ |
+ All materials used in the manufacture of\nthis part\nare\nin compliance with European Directive\n2011/65/EU |
+
+
+ 5 |
+ |
+ |
+ and the\namending Directive\n2015/863/EU of\n4\nJune\n2015\nregarding the\nrestriction of use of\ncertain |
+
+
+ 6 |
+ |
+ |
+ hazardous\nsubstances\nin electrical\nand electronic\nequipment. |
+
+
+ 7 |
+ 2) REACH Regulation (EC 1907/2006): |
+ |
+ |
+
+
+ 8 |
+ |
+ |
+ This product does not\ncontain Substances of Very High Concern (SVHC)\nlisted on the\nEuropean Union's |
+
+
+ 9 |
+ |
+ |
+ REACH candidate\nlist\nin excess of\n0.1% mass of\nthe\nitem. |
+
+
+ 11 |
+ |
+ 3) California Proposition 65: |
+ This product may\ncontain substances\nknown to the\nState of California\nto cause Cancer or Reproductive\nHarm, but\nis\nexempt\nfrom labeling based on the Consent\nJudgement.\nSee\nthe Alpha Wire website\nfor more\ninformation. |
+
+
+
\ No newline at end of file
diff --git a/table3.html b/table3.html
new file mode 100644
index 0000000..ccd2aaf
--- /dev/null
+++ b/table3.html
@@ -0,0 +1,60 @@
+
+
+
+ |
+ 1 |
+ 2 |
+ 3 |
+
+
+
+
+ 2 |
+ |
+ Physical & Mechanical Properties |
+ |
+
+
+ 4 |
+ 1)\nTemperature Range |
+ |
+ -40\nto 105°C |
+
+
+ 6 |
+ 2) Bend Radius |
+ |
+ 10X Cable Diameter |
+
+
+ 8 |
+ 3) Pull\nTension |
+ |
+ 3.5\nLbs, Maximum |
+
+
+ 9 |
+ |
+ Electrical Properties\n(For\nEngineering purposes only) |
+ |
+
+
+ 11 |
+ 1) Voltage Rating |
+ |
+ 300 VRMS |
+
+
+ 13 |
+ 2)\nInductance |
+ |
+ 0.07 μH/ft, Nominal |
+
+
+ 15 |
+ 3) Conductor DCR |
+ |
+ 25 Ω/1000ft @20°C, Nominal |
+
+
+
\ No newline at end of file
diff --git a/table4.html b/table4.html
new file mode 100644
index 0000000..922ebae
--- /dev/null
+++ b/table4.html
@@ -0,0 +1,18 @@
+
+
+
+ |
+ 1 |
+
+
+
+
+ 2 |
+ Packaging\nFlange\nx\nTraverse\nx Barrel\n(inches) |
+
+
+ 3 |
+ a)\n32800\nFT\n23\nx\n15\nx\n0 Max.\n4\nseparate pieces; Min length/piece\n10000\nFT.\nb)\n10000\nFT\n12\nx\n5.94\nx\n5 Max.\n3\nseparate pieces; Min length/piece\n1000\nFT.\nc)\n5000\nFT\n10.5\nx\n5\nx\n3.5 Continuous\nlength\nd)\n1000\nFT\n6.5\nx\n2\nx\n1.9 Continuous\nlength\ne)\n100\nFT\n2.75\nx\n2\nx\n1.125 Continuous\nlength\n \n[Spool\ndimensions may\nvary\nslightly]\nNotes:\na) Certain color\nand put-up combinations may only be\navailable by\nspecial order. Minimums may\napply.\nb)\nTolerance on 32800\nft. Put-Up is +/-\n10% |
+
+
+
\ No newline at end of file
diff --git a/ur5_control.py b/ur5_control.py
index 08fcbb0..6c43e36 100755
--- a/ur5_control.py
+++ b/ur5_control.py
@@ -10,7 +10,7 @@ import yaml
import sys
from util import fprint
from pyModbusTCP.client import ModbusClient
-
+from multiprocessing import Queue
import subprocess
from util import win32
@@ -20,6 +20,7 @@ class Rob():
robot = None
#offset_x, offset_y, offset_z = (0, 0, 0.14) # Tool offset
#
+ pos_updates = Queue()
def __init__(self, config):
self.config = config
armc = config["arm"]
@@ -91,7 +92,6 @@ def connect(robot):
def init_arm(robot):
robot = connect(robot)
-
# init urx
#rob.set_payload(2, (0, 0, 0.1))
@@ -510,7 +510,7 @@ def holder_routine(robot, holder_index, pick_up, verbose=False):
goto_holder_index(robot, holder_index, 0.05, use_closest_path=False)
else:
goto_holder_index(robot, holder_index, 0.2, use_closest_path=False)
-
+ robot.pos_updates.put(1)
if pick_up:
open_gripper()
@@ -530,7 +530,7 @@ def holder_routine(robot, holder_index, pick_up, verbose=False):
new_pos[2] = 0.2
rob.movel(new_pos, vel=2, acc=1)
was_flipped = is_flipped(robot)
-
+ robot.pos_updates.put(2)
# goto_holder_index(robot, 25, z=0.2)
def pick_up_holder(robot, holder_index, verbose=False):
holder_routine(robot, holder_index, True, verbose=verbose)
@@ -613,6 +613,7 @@ def drop_off_tray(robot, slot=0):
def return_routine(robot, slot, holder_index=None, verbose=False):
+ # OLD UNUSED
robot = connect(robot)
rob = robot.robot
@@ -697,6 +698,12 @@ def close_gripper():
c.close()
#
+def get_position_thread(robot):
+ robot = connect(robot)
+ rob = robot.robot
+ vals = rob.getl()
+ robot.pos_updates.put(tuple(vals))
+
if __name__ == "__main__":
#init("192.168.1.145")
diff --git a/websocket_test.html b/websocket_test.html
index ab65944..4454bda 100644
--- a/websocket_test.html
+++ b/websocket_test.html
@@ -150,7 +150,7 @@
setInterval(updateClock, 100);
-
+