Browse Source

add: datamatrix.py fixed

Your Name 3 months ago
parent
commit
b733aa4d57

+ 2 - 0
playgrounds/camera_playground.py

@@ -14,6 +14,8 @@ def main():
         cmd = input("Command [s/q]: ").strip().lower()
         if cmd == 's':
             frame = picam2.capture_array()
+            frame = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
+            frame = cv2.equalizeHist(frame)
             # Draw a green rectangle on the image
             cv2.rectangle(frame, (x, y), (x + w, y + h), (0, 255, 0), 2)
             cv2.imwrite("still_image.jpg", frame)

+ 9 - 9
playgrounds/integration_test.py

@@ -107,15 +107,15 @@ class LoaderSystem:
     async def _loader_loop(self):
         while True:
 
-            # await wait_for_enter()
-            # # Feeding with MagDistributor
-            # ###########################
-            # self.logger.info("Homing the Magazin Distributor Axis...")
-            # await self.mag_distributor.home()
-            # self.logger.info("Picking up a cell from magazine and placing it into feeder using MagDistributor...")
-            # self.mag_distributor.mag_to_feeder()
-            # await self.feeder_queue.put(1)
-            # self.logger.info("Done.")
+            await wait_for_enter()
+            # Feeding with MagDistributor
+            ###########################
+            self.logger.info("Homing the Magazin Distributor Axis...")
+            await self.mag_distributor.home()
+            self.logger.info("Picking up a cell from magazine and placing it into feeder using MagDistributor...")
+            self.mag_distributor.mag_to_feeder()
+            await self.feeder_queue.put(1)
+            self.logger.info("Done.")
 
             await wait_for_enter()
             # Prepare Feeder Cell

+ 1 - 1
robot_control/src/api/gpio.py

@@ -33,7 +33,7 @@ class GPIOInterface(ABC):
         """
         pass
 
-    def do_step(self, dir_pin: int, step_pin: int, steps: int = 100, step_delay_us: int = 200, direction: bool = True):
+    def do_step(self, en_pn:int, dir_pin: int, step_pin: int, steps: int = 100, step_delay_us: int = 200, direction: bool = True):
         """
         Perform a step operation on a stepper motor.
         """

+ 1 - 1
robot_control/src/vision/datamatrix.py

@@ -90,7 +90,7 @@ class DataMatrixReader:
             #           cv2.THRESH_BINARY, 21, 2)
             # kernel = cv2.getStructuringElement(cv2.MORPH_RECT, (3,3))
             # frame = cv2.morphologyEx(frame, cv2.MORPH_CLOSE, kernel)
-            decoded = decode(frame, timeout=5000, gap_size=20, shape="square", max_count=1)
+            decoded = decode(frame, timeout=5000, gap_size=20, max_count=1)
         if not decoded:
             logger.info("No datamatrix found")
             return None

BIN
still_image.jpg