Browse Source

fixed angular correction for hippoSIT

dianamaro 2 years ago
parent
commit
e5d9a3bf70
4 changed files with 160 additions and 96 deletions
  1. 101 28
      aSIT.ipynb
  2. 1 0
      controllers/camera.ipynb
  3. 4 0
      controllers/position.ipynb
  4. 54 68
      hippoSIT.ipynb

File diff suppressed because it is too large
+ 101 - 28
aSIT.ipynb


+ 1 - 0
controllers/camera.ipynb

@@ -50,6 +50,7 @@
     "        \n",
     "        # preparing a MPEG video stream\n",
     "        self.stream = cv2.VideoCapture(cfg['source'], cfg['api']) if cfg['api'] else cv2.VideoCapture(cfg['source'])\n",
+    "        self.stream.set(cv2.CAP_PROP_FPS, cfg['fps'])\n",
     "        self.stream.set(cv2.CAP_PROP_FOURCC, cv2.VideoWriter_fourcc('M', 'J', 'P', 'G'))\n",
     "        self.stream.set(cv2.CAP_PROP_FRAME_WIDTH, cfg['frame_width'])\n",
     "        self.stream.set(cv2.CAP_PROP_FRAME_HEIGHT, cfg['frame_height'])\n",

+ 4 - 0
controllers/position.ipynb

@@ -36,6 +36,7 @@
     "        \"max_fps\": 50,\n",
     "        \"file_path\": \"positions.csv\",\n",
     "        \"floor_r_in_meters\": 0.46,\n",
+    "        \"angle_compensation\": -90,\n",
     "        \"flip_x\": True,\n",
     "        \"flip_y\": False\n",
     "    }\n",
@@ -71,6 +72,9 @@
     "        x_m = self.cfg['arena_x'] - (x / self.pixel_size) * (-1 if self.cfg['flip_x'] else 1)\n",
     "        y_m = self.cfg['arena_y'] - (y / self.pixel_size) * (-1 if self.cfg['flip_y'] else 1)\n",
     "        return int(x_m), int(y_m)\n",
+    "\n",
+    "    def correct_angle(self, phi):\n",
+    "        return (2*np.pi - phi) + np.deg2rad(self.cfg['angle_compensation'])\n",
     "    \n",
     "    def start(self):\n",
     "        self._th = threading.Thread(target=self.update, args=())\n",

File diff suppressed because it is too large
+ 54 - 68
hippoSIT.ipynb