apockill / uArmCreatorStudio

uArm Creator Studio is a Visual Programming Language for robot arms, with a heavy emphasis on computer vision and usability for both low experience and high experience programmers. It's written entirely in Python, and supports python scripting within the application.
82 stars 39 forks source link

calibration range #20

Open wisechengyi opened 7 years ago

wisechengyi commented 7 years ago

Currently the ranges are hardcoded https://github.com/apockill/uArmCreatorStudio/blob/47a8acd039897ac4eec353996975d312b8100305/CalibrationsGUI.py#L800-L818, but in practice, the real range also depends on how camera is mounted or zoomed in. For example, the effective range my camera can see for x axis is (-10, 10) whereas it's hardcoded (-20, 20). Hence I would like to propose to collect (x,y,z) at the 4 corners (mostly x and y) in order to determine the range and how fine-grained the calibration should be.

Example partial diff. Actual values should come from user assistance. Also append is used instead of += for performance reasons because += is making a new array on every use.

(venv)[tw-mbp-yic uArmCreatorStudio (master)]$ git diff
diff --git a/CalibrationsGUI.py b/CalibrationsGUI.py
index d50a6d3..97e3328 100644
--- a/CalibrationsGUI.py
+++ b/CalibrationsGUI.py
@@ -798,24 +798,22 @@ class CWPage5(QtWidgets.QWizardPage):

         # Test the z on 3 xy points
         zTest = int(round(zLower, 0))  # Since range requires an integer, round zLower just for this case
-        for x in range(  -20, 20, 4): testCoords += [[x,  15,    11]]  # Center of XYZ grid
-        for y in range(    8, 24, 4): testCoords += [[ 0,  y,    11]]
-        for z in range(zTest, 19, 1): testCoords += [[ 0, 15,     z]]
+        for x in range(  -10, 10, 1): testCoords.append([x,  15,    11])  # Center of XYZ grid
+        for y in range(    8, 24, 4): testCoords.append([ 0,  y,    11])
+        for z in range(zTest, 19, 1): testCoords.append([ 0, 15,     z])

         # for x in range(  -20, 20, 1): testCoords += [[x,  15, zTest]]  # Center of XY, Bottom z
         # for y in range(    8, 25, 1): testCoords += [[ 0,  y, zTest]]
         # for z in range(zTest, 25): testCoords += [[ 0, 15,     z]]

-        for x in range(  -20, 20, 4): testCoords += [[x,  15,    17]]  # Center of XY, top z
-        for y in range(   12, 24, 4): testCoords += [[ 0,  y,    17]]
+        for x in range(  -10, 10, 1): testCoords.append([x,  15,    17])  # Center of XY, top z
+        for y in range(   12, 24, 4): testCoords.append([ 0,  y,    17])

-
-
-        direction  = int(1)
+        direction = int(1)
         for y in range(12, 25, 2):
-            for x in range(-20 * direction, 20 * direction, 2 * direction):
-                testCoords += [[x, y, zTest]]
-            direction *= -1
+          for x in range(-10 * direction, 10 * direction, 2 * direction):
+            testCoords.append([x, y, zTest])
+          direction *= -1
apockill commented 7 years ago

You're definitely right. If there were some way to "Draw" the boundaries by dragging the robot arm around an area, then having the points be generated from those boundaries, i think that would be ideal.

That would also help the eventual future where multiple robot arm models will work with UCS