Page 173 - Toucpad robotics C11
P. 173

3.  DETECT logic:
                           In sim: check tile color/object API.
                        °
                           With OpenCV: color threshold or QR decode; if found   mark GPS (grid coords) and alert.
                        °
                 D.  Step-by-Step Build (Simulator first)
                    1.  Place obstacles/targets in sim map.
                    2.  Write TAKEOFF routine (altitude set or default).
                    3.  Code SEARCH loop:
                           Move 1 cell (or fixed distance), sense tile/object; log coordinates.
                        °
                           Turn at row ends; continue until full coverage or target found.
                        °
                    4.  Obstacle handling:
                           When obstacle flag = true   skip to next navigable cell; or implement “detour” subroutine (right-hand wall
                        °
                           follow for 3 steps   resume sweep).
                    5.  DETECTION:
                           If target found   hover, log, beep/print alert; optionally “drop aid” (sim API).
                        °
                    6.  RETURN_HOME:
                           Navigate back to start via shortest path (simple reverse trace or Manhattan path).
                        °
                    7.  LAND and export mission log (time, visited cells, detections).
                 E.  Optional Python Vision Add-On (PC or Raspberry Pi)
                    1.  Print/display markers (QR or colored cards) on the floor/table.
                    2.  Capture frames (webcam/PiCam) while moving a toy drone/robot or by simulating frames.
                    3.  OpenCV flow:
                           For color marker: convert to HSV   threshold   contour   compute centroid.
                        °
                           For QR: pyzbar.decode(frame)   get data   log.
                        °
                    4.  Decision: If marker detected   emulate “hover/aid drop” and log coordinates/time.
                 F.  Testing Protocol
                    1.  Dry run on a 5×5 grid; verify full coverage (no cells skipped).
                    2.  Inject obstacles in 3 random positions; confirm detour routine works.
                    3.  Hide targets (1–3 positions); measure time-to-detection; verify alert/log.
                    4.  Edge cases: target at border; obstacle near start; no target (mission completes cleanly).
                 G.  Documentation & Deliverables
                    1.  Algorithm & flowchart (state machine + search + detection).
                    2.  Block code/Python script screenshots.
                    3.  Mission log (CSV/table: step, cell, detection flag, note).
                    4.  2�3 minute video screen-capture of mission run.
                    5.  Reflection sheet: What improved detection? What failed? Next iteration?
                 H.  Extension (for achievers)
                        Multi-target search with priority zones.
                        l
                        Add battery constraint (simulate: must return when steps > threshold).
                        l
                        Introduce no-fly zones and altitude changes.
                        l
                        Fuse two sensors (e.g., simulated Lidar + camera) and compare accuracy.
                        l
                 I.  Assessment Checklist (teacher quick rubric)
                        Robust  coverage  path  ( ) | Correct  obstacle  behaviour  ( ) | Reliable  detection  & alert  () | Clean  landing  &
                        l
                        log ( ) | Documentation clarity ( )



                                                                                                                       171
                                                                                                               Assignments
   168   169   170   171   172   173   174   175   176   177   178