# 11254Y Robot Code This repository contains the software for team 11254Y's competition robot. The project is written in C++ using **PROS** and is built on the **uncompiled/source version of EZ-Template**. The goal of this project is to provide a modular structure for controlling the robot's drivetrain and mechanisms while keeping individual mechanisms easy to reuse and modify. ## Technologies * **C++** * **PROS** * **EZ-Template** — source/uncompiled version * **VEX V5** ## Project Structure The project is organized similarly to the structure used by EZ-Template. Mechanism systems are separated into their own header and source files so they can be developed and reused independently. ### EZ-Template EZ-Template provides the foundation for the robot code, including systems such as: * Drivetrain control * Autonomous routines * Autonomous selector * PID control * General robot utilities The source version of EZ-Template is included directly in the project rather than using it only as a precompiled library. This allows the template's code to be modified and extended as needed. Using the uncompiled version of EZ-Template also allows us the learn how the template was made and that lets us use the template more effectivly. ## Custom Systems I have added several custom mechanism-control systems following the same general structure and organization used by EZ-Template. The costum control systems I've added are: *Adjustable Color sensor class *Adaptive Pneumatics controller *Rotation sensor classes ### Color Sorter As of now the color sorter dosen't do anything on the robot but is in place if we ever need it. It is designed to handle the logic required to detect and sort objects based on their color while integrating with the rest of the robot's control system. ### Pneumatic Control The pneumatic control system provides an organized way to control the robot's pneumatic mechanisms. Instead of handling individual pneumatic outputs throughout the main robot code, pneumatic mechanisms can be controlled through their own class and functions. ### Rotation Mechanisms The rotation-control system is designed for mechanisms that use a VEX V5 Rotation Sensor to determine their position. Mechanisms can define multiple preset positions and cycle between those positions. The system also provides control functions for moving and maintaining the mechanism at its desired position. For example, a mechanism can have states such as: ```text State 0 → 0° State 1 → 26.5° State 2 → 45° ``` The mechanism can then cycle between these states without requiring the state-management code to be rewritten for every mechanism. ## Design Philosophy One of the main goals of this project is **modularity**. Rather than putting all robot functionality into `main.cpp`, individual systems are implemented as classes with their own `.hpp` and `.cpp` files. The header files contain the class declarations, while the `.cpp` files contain the implementation. This allows mechanisms to be instantiated and controlled from the main robot program without putting their implementation directly into `main.cpp`. This method is much cleaner and easier to understand. ## Using a Mechanism A mechanism can be created as an object and then controlled through its member functions. For example: ```cpp ArmMech arm_control; ``` Once the object exists, its functions can be called from the robot code: ```cpp arm_control.cycle_states(); arm_control.reset_state(); arm_control.arm_control(); ``` This keeps the main robot code focused on **what the robot should do** instead of how each individual mechanism works internally. ## Development This project is actively developed for VEX Robotics competition use. The code may change as the robot's mechanical design, autonomous routines, and control systems are improved. Because the project uses the source version of EZ-Template, changes can be made directly to the template and custom systems can be integrated alongside it. ## Credits ### PROS This project uses PROS as the development environment and operating system for the VEX V5 brain. ### EZ-Template EZ-Template is used as the foundation for the drivetrain and competition-code structure. Custom systems in this project are implemented using a similar organization and design approach. ## License This project is intended for personal and educational use. If you reuse portions of this code, please give appropriate credit to the original authors of EZ-Template and PROS where applicable. ⚡️ **coding made ez** ⚡️ 💅 **docs and tutorials** 💅 💥 **pid, odometry, pure pursuit, boomerang** 💥 📚 **focus on consistency** 📚 🧐 **out of the box documentation** 🧐 🔌 **plug and play example project** 🔌 [See a complete playlist of EZ-Template autons here!](https://www.youtube.com/playlist?list=PLyZbi14KopZK70GTSD5NpygoAcM2_ls7T) ## [Discord Server](https://discord.gg/EHjXBcK2Gy) Need extra assistance using EZ-Template? Feel free to join our [Discord Server](https://discord.gg/EHjXBcK2Gy)! ## Features EZ-Template is built with high attention to the user experience. * Built with 💜 and [PROS](https://pros.cs.purdue.edu/) * Powerful open source Development platform for VEX V5 * Customize and extend with other community PROS libraries * 🔌 Example project is plug-and-play * Simple to setup * Get up and running in minutes * 👀 Simple to use API * PID for driving, turning, swing turns, and arcs * Odometry with Pure Pursuit and Boomerang * Asynchronous PID with blocking functions * "Tug of war" detection * Overheat detection and exiting * Live PID tuning * Tracking wheel support * 📺 Autonomous selector * Easy to add autons * SD card saving * 🎮 Joystick control * Tank drive, single stick arcade, and dual stick arcade * Joystick input curves * Adjust joystick curves live through the controller * PID for your own subsystems * Slew for your own subsystems ## Design Principles * **Quick to get going.** EZ-Template should make it easy to learn and use. Anything is achievable by users, even if it takes them more code and more time to write. * **Intuitive.** Users will not feel overwhelmed when looking at an EZ-Template project or adding new features. It should look intuitive and easy to build on top of. * **Sensible Defaults.** Common and popular performance optimizations and configurations will be done for users, but only with the option to override them. We believe that, as developers, knowing how a library works helps us become better at using it. We're dedicating effort to creating tutorials and documentation with the hope that reading it will gain the user a deeper understanding of the tool, and become even more proficient in using it. ## [Support me on Patreon!](https://www.patreon.com/roboticsisez) Supporting me on Patreon will help guarantee that EZ-Template continues to get maintained and allow me to develop products for teams to use. [Click here](https://www.patreon.com/roboticsisez) to see my Patreon! ## [Download and Installation](https://ez-robotics.github.io/EZ-Template/tutorials/installation) Learn how to install and setup EZ-Template [here](https://ez-robotics.github.io/EZ-Template/tutorials/installation)! ## [License](https://opensource.org/licenses/MPL-2.0) This project is licensed under the Mozilla Public License, version 2.0 - see the [LICENSE](https://opensource.org/licenses/MPL-2.0) file for the full license.