Skip to content

Commit

Permalink
Merge branch 'feature/beambox'
Browse files Browse the repository at this point in the history
  • Loading branch information
simonxeko committed Jan 3, 2018
2 parents c7c4f39 + 1a13987 commit dbf334a
Show file tree
Hide file tree
Showing 21 changed files with 8,296 additions and 173 deletions.
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ lib64/
parts/
sdist/
var/
.idea/
*.egg-info/
*.eggs/
.installed.cfg
Expand Down Expand Up @@ -82,4 +83,9 @@ __vm/
*.sln.docstates
*.sln
*.vcxproj
*.vcxproj.filters
*.vcxproj.filters
old-workspace.jpg

workspace.png

workspace.jpg
4 changes: 2 additions & 2 deletions fluxclient/device/discover.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,10 +200,10 @@ def add_master_key(self, uuid, serial, master_key, disc_ver):
if uuid in self.devices:
device = self.devices[uuid]
if device.master_key != master_key:
raise Exception("Device %s got vart master keys" % device,
raise Exception("Device %s got conflict master keys" % device,
device.master_key, master_key)
if device.serial != serial:
raise Exception("Device %s got vart master keys" % device,
raise Exception("Device %s got conflict master keys" % device,
device.serial, serial)
return device
else:
Expand Down
2 changes: 1 addition & 1 deletion fluxclient/device/manager_backends/ssl1.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
__all__ = ["SSL1Backend"]

SHORT_PACKER = Struct("<H")
SUPPORT_VERSION = (StrictVersion("1.1a1"), StrictVersion("2.0a1"))
SUPPORT_VERSION = (StrictVersion("1.1.0"), StrictVersion("2.0a1"))


def raise_error(ret, **ref):
Expand Down
2 changes: 1 addition & 1 deletion fluxclient/device/manager_backends/udp1.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
CODE_SET_NETWORK = 0xa2
CODE_RESPONSE_SET_NETWORK = 0xa3

SUPPORT_VERSION = (StrictVersion("1.0b12"), StrictVersion("1.1b1"))
SUPPORT_VERSION = (StrictVersion("1.1.0"), StrictVersion("1.1b1"))


class Udp1Backend(ManagerAbstractBackend):
Expand Down
30 changes: 20 additions & 10 deletions fluxclient/fcode/f_to_g.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def __init__(self, buf=''):
if buf:
self.upload_content(buf)

def upload_content(self, buf):
def upload_content(self, buf, model='model-1'):
"""
upload fcode content in this object,
buf[in]: could be string indicating the path to .fcode or bytes
Expand All @@ -60,16 +60,26 @@ def upload_content(self, buf):
self.data = buf
if self.full_check():
md = self.get_metadata()
if float(md.get('MAX_X', 0)) > HW_PROFILE['model-1']['radius']:
return 'out_of_bound'
elif float(md.get('MAX_Y', 0)) > HW_PROFILE['model-1']['radius']:
return 'out_of_bound'
elif float(md.get('MAX_R', 0)) > HW_PROFILE['model-1']['radius']:
return 'out_of_bound'
elif float(md.get('MAX_Z', 0)) > HW_PROFILE['model-1']['height'] or float(md.get('MAX_Z', 0)) < 0:
return 'out_of_bound'
if model == 'beambox':
if float(md.get('MAX_X', 0)) > HW_PROFILE[model]['width']:
return 'out_of_bound'
elif float(md.get('MAX_Y', 0)) > HW_PROFILE[model]['length']:
return 'out_of_bound'
elif float(md.get('MAX_Z', 0)) > HW_PROFILE[model]['height'] or float(md.get('MAX_Z', 0)) < 0:
return 'out_of_bound'
else:
return 'ok'
else:
return 'ok'
if float(md.get('MAX_X', 0)) > HW_PROFILE[model]['radius']:
return 'out_of_bound'
elif float(md.get('MAX_Y', 0)) > HW_PROFILE[model]['radius']:
return 'out_of_bound'
elif float(md.get('MAX_R', 0)) > HW_PROFILE[model]['radius']:
return 'out_of_bound'
elif float(md.get('MAX_Z', 0)) > HW_PROFILE[model]['height'] or float(md.get('MAX_Z', 0)) < 0:
return 'out_of_bound'
else:
return 'ok'
else:
self.data = tmp_data
return 'broken'
Expand Down
24 changes: 24 additions & 0 deletions fluxclient/hw_profile/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
HW_PROFILE = {
'model-1': {
'plate_shape': 'elliptic',
'radius': 86.,
'scan_full_len': 360.,
'height': 240.,
Expand All @@ -11,5 +12,28 @@
# min_len_that_step_motor_can_move = 2.5
# step_len = alpha * scan_full_len / N
},
'beambox': {
'plate_shape': 'rectangular',
'width': 400,
'length': 400,
'height': 10,
'radius': 400
# 'nozzle_height': 4.45,
# 'step_setting': {400: (3, 2.7), 800: (7, 3.15)}
# 'step_setting': {100: (1, 3.6), 200: (1, 1.8), 400: (1, 0.9), 800: (1, 0.45), 1200: (1, 0.3)}
}
}
# HW_PROFILE['model-1']['radius']

class HardwareData(object):
def __init__(self, model):
self.model = model
self._genattr()

def _genattr(self):
profile = HW_PROFILE.get(self.model)
if not profile:
return None

for key, val in profile.items():
setattr(self, key, val)
5 changes: 3 additions & 2 deletions fluxclient/laser/laser_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def __init__(self):
# self.obj_height = 0.0 # plate

self.pixel_per_mm = 10 # sample rate for each point
self.radius = 85 # laser max radius = 85mm
self.radius = 150 # laser max radius = 85mm

# list holding current image
self.reset_image()
Expand Down Expand Up @@ -250,7 +250,8 @@ def rotate(x, y, rotation, cx=0., cy=0.):
# 2 3
ox2, oy2 = ox1, oy3
ox4, oy4 = ox3, oy1
pix = pix.resize(tuple(map(lambda x: int(x * self.pixel_per_mm), ((ox3 - ox1), (oy1 - oy3)))))

pix = pix.resize(tuple(map(lambda x: int(x * self.pixel_per_mm), ((ox3 - ox1), (oy3 - oy1)))))

# rotate four corner
ox1, oy1 = rotate(ox1, oy1, rotation, cx, cy)
Expand Down
4 changes: 4 additions & 0 deletions fluxclient/robot/robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,10 @@ def diagnosis(self, option):
def move(self, *ignore, **commands):
return self._backend.maintain_move(**commands)

@invalied_validator
def calibrate_beambox_camera(self):
return self._backend.calibrate_beambox_camera()

@invalied_validator
def load_filament(self, index=0, temperature=210.0,
process_callback=None):
Expand Down
7 changes: 7 additions & 0 deletions fluxclient/robot/robot_backend_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,13 @@ def maintain_move(self, *ignore, **commands):
if ret != "ok":
raise_error(ret)

def calibrate_beambox_camera(self, *ignore, **commands):
ret = self.make_cmd('calibrate_beambox_camera'.encode())
logger.info("calibrate_beambox_camera!!")
if ret != "ok":
logger.info("Return", ret)
raise_error(ret)

def __load_filament(self, instance, cmd, process_callback):
ret = self.make_cmd(cmd)

Expand Down
8 changes: 5 additions & 3 deletions fluxclient/toolpath/__init__.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@

from ._toolpath import (ToolpathProcessor,
from fluxclient.toolpath._toolpath import (ToolpathProcessor,
PyToolpathProcessor,
GCodeMemoryWriter,
GCodeFileWriter,
FCodeV1FileWriter,
FCodeV1MemoryWriter,
GCodeParser)
GCodeParser,
DitheringProcessor)
from ._fcode_parser import FCodeParser

__all__ = ["ToolpathProcessor",
Expand All @@ -15,4 +16,5 @@
"FCodeV1FileWriter",
"FCodeV1MemoryWriter",
"FCodeParser",
"GCodeParser"]
"GCodeParser",
"DitheringProcessor"]
Loading

0 comments on commit dbf334a

Please sign in to comment.