{"id":26817768,"url":"https://github.com/tomash1234/auto-targeting-turret","last_synced_at":"2025-07-21T22:32:25.380Z","repository":{"id":203195435,"uuid":"331413753","full_name":"tomash1234/auto-targeting-turret","owner":"tomash1234","description":"Code used for this video: https://www.youtube.com/watch?v=S3CwzkT6cK4","archived":false,"fork":false,"pushed_at":"2021-02-02T09:21:00.000Z","size":8,"stargazers_count":14,"open_issues_count":0,"forks_count":8,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-23T22:45:53.316Z","etag":null,"topics":["arduino","nerf-gun","opencv","wemos-d1","youtube"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tomash1234.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-01-20T19:45:10.000Z","updated_at":"2024-09-01T08:23:02.000Z","dependencies_parsed_at":null,"dependency_job_id":"24e24331-a1fd-47e1-949d-fb1a5a554136","html_url":"https://github.com/tomash1234/auto-targeting-turret","commit_stats":null,"previous_names":["tomash1234/auto-targeting-turret"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/tomash1234/auto-targeting-turret","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomash1234%2Fauto-targeting-turret","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomash1234%2Fauto-targeting-turret/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomash1234%2Fauto-targeting-turret/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomash1234%2Fauto-targeting-turret/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tomash1234","download_url":"https://codeload.github.com/tomash1234/auto-targeting-turret/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomash1234%2Fauto-targeting-turret/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266392526,"owners_count":23922186,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-21T11:47:31.412Z","response_time":64,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["arduino","nerf-gun","opencv","wemos-d1","youtube"],"created_at":"2025-03-30T04:17:48.145Z","updated_at":"2025-07-21T22:32:25.367Z","avatar_url":"https://github.com/tomash1234.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Auto-Targeting Nerf Turret\n\nHere is the code used to create this project\n https://www.youtube.com/watch?v=S3CwzkT6cK4\n\n[![Youtube video](https://img.youtube.com/vi/S3CwzkT6cK4/0.jpg)](https://www.youtube.com/watch?v=S3CwzkT6cK4)\n\nNote: This code is not perfect. I did not want to publish it, but I got many requests to share this code.\n\n## Hardware\nSee video\n * Wemos D1 Wifi\n * 3x Mini servo\n * Laser diod\n * Cheap webcam \n * Nerf pistol\n\n## Code\n * AutomaticGun/AutomaticGun.ino  - Arudino code\n * PythonScripts/control.py - Communication between computer and turret\n * PythonScripts/camera.py (main) - Detecting target and laser dot, moving turret towards the target - Run this code\n * PythonScripts/manual_control.py - For debugging purpose, Moving turret using WSAD and enter to shoot\n\n## Detection \u0026 Targeting\n * The target must be a well visible fairly big circle\n * A circle is detected in the image, if center of circle is stable for few frames, turrets starts moving towards it\n * Laser dot should be small red dot\n * The script tries to get the laser dot into the circle\n * If the dot is inside the circle and close to the center for few frames, the trigger is pulled\n\n## Communication\n * Communication between computer and Wemos d1 is implemented using UDP packets, computer and Wemos must be connect to the same network\n * Every packet contains 3 bytes - [**KEY=44**, **Action code**, **Value**]\n * Rotate (yaw) - [44, 120, [angle in degrees 0-180]]\n * Pitch - [44, 88, [angle in degrees 0-180]]\n * Reset the trigger - [44, 44, 0]\n * Pull the trigger - [44, 44, 64]\n\n\n## Notes\n * key Q - quit\n * **class Recorder** in camera.py can be used for recording videos\n * Packages - Numpy and Opencv is required for this project\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomash1234%2Fauto-targeting-turret","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftomash1234%2Fauto-targeting-turret","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomash1234%2Fauto-targeting-turret/lists"}