{"id":20046960,"url":"https://github.com/flatypus/trash","last_synced_at":"2025-09-06T04:35:43.294Z","repository":{"id":177010504,"uuid":"657890372","full_name":"flatypus/trash","owner":"flatypus","description":null,"archived":false,"fork":false,"pushed_at":"2023-06-28T17:46:46.000Z","size":147227,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-22T19:13:21.099Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/flatypus.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2023-06-24T05:59:48.000Z","updated_at":"2025-08-10T10:36:50.000Z","dependencies_parsed_at":"2023-07-11T21:46:35.634Z","dependency_job_id":null,"html_url":"https://github.com/flatypus/trash","commit_stats":null,"previous_names":["flatypus/trash"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/flatypus/trash","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flatypus%2Ftrash","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flatypus%2Ftrash/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flatypus%2Ftrash/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flatypus%2Ftrash/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/flatypus","download_url":"https://codeload.github.com/flatypus/trash/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flatypus%2Ftrash/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273858815,"owners_count":25180766,"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-09-06T02:00:13.247Z","response_time":2576,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","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":[],"created_at":"2024-11-13T11:32:03.384Z","updated_at":"2025-09-06T04:35:43.286Z","avatar_url":"https://github.com/flatypus.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Trash\n\nThis project is Trash. \n\n## Okay, so why did you make it?\nThink about that time you were sitting in your bed, watching YouTube, eating snacks. You finish your bag of chips, or that candy bar, and you're left with some garbage. In the spirit of being clean and tidy, you want to throw that trash in the trash can. \n\nBut wait! It's across the room! Now, what do you do? Your eyes squint, you turn around, and chuck that piece of trash towards the trash can...and yet despite your efforts, the trash bounces off the wall and on the floor.\n\nYou sigh. You get up from your bed, walk over, and place the trash in the trash can. You get back in bed, and keep watching YouTube. All this time, you think back to that moment that you missed.\n\nThere had to be a better way.\n\n## The better way.\nWe were you at some point in time. We realized the five seconds it took for you to get up, put the trash in the can, and get back in bed is time you will never get back. So, to all of you who have shared this emotional experience, we have built Trash.\n![image](https://github.com/flatypus/trash/assets/68029599/ba4c2bce-e5ff-4235-a1ec-37697dbbad4d)\n\nIt consists of a setup of two cameras positioned towards the center of your room, where your trash can is. These cameras send the data stream over to the garbage tracking algorithm, which detects the garbage in each camera using a custom trained YOLOV8 model with over 14,000 hand-labeled images. Our algorithm then takes the combined positions of the trash in both camera streams, does some trigonometry, and calculates the expected position of the trash in real life. It then can determine the final position of the trash when it hits the floor, and sends the position to our Trash robot via Serial. We also wrote a plotting script to visualize the data in real time.\n\nModel: https://universe.roboflow.com/flatypus/trash-7kbr4\n![image](https://github.com/flatypus/trash/assets/68029599/2a8c83b2-8a8b-4aac-82f0-d0a88cc5092a)\n\nOur trash robot consists of a PETG 3D printed frame and four mecanum wheels powered by Nema 17 stepper motors. We selected mecanum wheels for their ability to move omnidirectionally which enables the robot to move in the most efficient, straight line path to the trash regardless of its location. The steppers are driven by TB6560 drivers which can handle 3A of current at 35V. The robot is powered by a 3S, 2200mAh LiPo battery which can output 77A of current. The robot is controlled by a Teensy 4.0 microcontroller which was chosen over Arduino boards for its high clock speed (600 mHz vs. 16 mHz). This allows the steppers to run at the extremely high speeds required for the robot to move fast enough to catch the trash. \n\nWe used the AccelStepper Arduino library to control the stepper motors. Our code takes the desired location coordinates, subtracts the current location coordinates, and does some vector math to determine the precise number of steps required for each wheel to spin to reach the desired location. As the robot continuously receives new, more accurate coordinates from the tracking system through serial communication, it uses the current number of steps each motor has taken to determine the current coordinates of the robot. These are saved as the current coordinates and the above process repeats, recalculating the number of steps for each motor to reach the new desired location. \n\n## Notes about the repo\n - `target_0` and `target_1` are continuously updated files containing the locations of trash in the two cameras. The cameras are positioned 245 cm from each other, facing 45 degrees towards the center of the room. We used files vs socket communication or an api for its simplicity.\n - `track_ball.py` contains the code to start a camera stream, detect the trash, and save the coordinates to the target files. Two instances of this script are run, one for each camera.\n - Simultaneously, `continue_plot.py` is run to plot the data in real time. This is done using matplotlib and the target files. It also handles the calculation of the expected position of the trash in real life. After it predicts the location, it saves the coordinates in another file, prediction.\n - `yolov8_model` is the currently used model; 47 epochs on 14256 images.\n - `yolov8_model_v2` is the same dataset trained for 300 epochs, however the 47 epoch model seems to work better.\n\n# Running the code\n- Install the requirements in `requirements.txt`\n- Run `pnpm install` to install concurrently, a package that allows you to run multiple scripts at once.\n- Install `nodemon` globally with `pnpm i -g nodemon`, to watch scripts for changes and restart them automatically.\n- You need two cameras to run this. We used the webcam of the laptop, and a second webcam. Once you have both connected, you can run pnpm dev to start nodemon instances for two cameras and the plotter.\n- If you just want to run the system, you can run pnpm start.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflatypus%2Ftrash","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fflatypus%2Ftrash","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflatypus%2Ftrash/lists"}