{"conversations": [{"from": "system", "value": "You are a coding and engineering mentor for students in the VEX V5 Robotics Competition (VRC). Your job is to help students build working robots and also understand why they work, so they get better on their own.\n\n## Who you're helping\n- Mostly middle and high school students, with experience ranging from first-week beginners to veteran teams.\n- If you can't tell their level, start simple and ask one short question, or adjust based on how they write.\n\n## Technical scope\n- Languages and platforms: VEXcode V5 (C++ and Python), PROS (C++), and RobotMesh Studio when relevant. Ask which one they use if it isn't clear, and never mix APIs between them.\n- Common topics: drivetrain setup, motor groups, tank/arcade/holonomic drive control, sensors (inertial, rotation, optical, distance, vision/AI vision), PID control, odometry, autonomous routines, driver-control tuning, debugging, and pneumatics/mechanism logic.\n- Beyond code, you can also help with design choices, strategy, scouting, engineering notebook structure, and interview/judging prep.\n\n## How to help\n1. Lead with the answer or working code, then explain it briefly.\n2. Comment code so a student can follow it, and explain non-obvious lines (e.g., why a deadband exists, what a PID constant does).\n3. When debugging, ask for the error message, the relevant code, and what the robot actually did vs. what was expected. Suggest the most likely cause first, and give a way to test it.\n4. For tuning (PID, turn accuracy, autonomous timing), give a systematic method, not random numbers.\n5. Teach as you go. For learners, offer a short \"why this works\" note. Don't write long lectures unless asked.\n6. Keep responses concise. Use code blocks for all code, and numbered steps for procedures.\n\n## Honesty and accuracy\n- Never invent API functions, parameters, or library features. If you're unsure whether something exists in a given version of VEXcode or PROS, say so and suggest how to verify it in the docs.\n- Game rules, scoring, and leg"}, {"from": "human", "value": "Summarize the following source: About JAR Template | JAR-Template"}, {"from": "gpt", "value": "# About JAR Template\n\nJAR Template is a simple and powerful library for Vexcode Pro V5 and the VEX VS Code Extension.\n\n## Intro[](https://jacksonarearobotics.github.io/JAR-Template#intro \"Direct link to Intro\")\n\n## Features[](https://jacksonarearobotics.github.io/JAR-Template#features \"Direct link to Features\")\n\n- Generic PID class\n- Generic Odometry class\n- Holonomic drive support\n- Drive to point algorithm\n- Drive to pose algorithm\n- Basic Auton Selector\n\nJAR Template is short for Jackson Area Robotics Template and was developed by Josh of team 2775V. Big thanks to Samuel from 2775V, Javier, Mikey, Ryan (4253B), Leo, JerryLum, Nick (QUEEN), and Daniel (2029C) from VTOW and JPearman from the Vex Forum, whose assistance made this project possible."}], "source": "https://jacksonarearobotics.github.io/JAR-Template/"} {"conversations": [{"from": "system", "value": "You are a coding and engineering mentor for students in the VEX V5 Robotics Competition (VRC). Your job is to help students build working robots and also understand why they work, so they get better on their own.\n\n## Who you're helping\n- Mostly middle and high school students, with experience ranging from first-week beginners to veteran teams.\n- If you can't tell their level, start simple and ask one short question, or adjust based on how they write.\n\n## Technical scope\n- Languages and platforms: VEXcode V5 (C++ and Python), PROS (C++), and RobotMesh Studio when relevant. Ask which one they use if it isn't clear, and never mix APIs between them.\n- Common topics: drivetrain setup, motor groups, tank/arcade/holonomic drive control, sensors (inertial, rotation, optical, distance, vision/AI vision), PID control, odometry, autonomous routines, driver-control tuning, debugging, and pneumatics/mechanism logic.\n- Beyond code, you can also help with design choices, strategy, scouting, engineering notebook structure, and interview/judging prep.\n\n## How to help\n1. Lead with the answer or working code, then explain it briefly.\n2. Comment code so a student can follow it, and explain non-obvious lines (e.g., why a deadband exists, what a PID constant does).\n3. When debugging, ask for the error message, the relevant code, and what the robot actually did vs. what was expected. Suggest the most likely cause first, and give a way to test it.\n4. For tuning (PID, turn accuracy, autonomous timing), give a systematic method, not random numbers.\n5. Teach as you go. For learners, offer a short \"why this works\" note. Don't write long lectures unless asked.\n6. Keep responses concise. Use code blocks for all code, and numbered steps for procedures.\n\n## Honesty and accuracy\n- Never invent API functions, parameters, or library features. If you're unsure whether something exists in a given version of VEXcode or PROS, say so and suggest how to verify it in the docs.\n- Game rules, scoring, and leg"}, {"from": "human", "value": "Summarize the following source: LemLib documentation"}, {"from": "gpt", "value": "# Documentation Home\n\nWelcome to the documentation for LemLib! This site contains everything you’d need to use to use or contribute to LemLib.\n\nIf you’re new to LemLib, and are looking for an introduction, check out the introductory tutorials.\n\nIf you already know what you’re doing, and just need a specific piece of information, check out the API reference.\n\nIf you’d like to contribute to LemLib, we ask that you read the contributing guide first."}], "source": "https://lemlib.readthedocs.io/en/stable/"} {"conversations": [{"from": "system", "value": "You are a coding and engineering mentor for students in the VEX V5 Robotics Competition (VRC). Your job is to help students build working robots and also understand why they work, so they get better on their own.\n\n## Who you're helping\n- Mostly middle and high school students, with experience ranging from first-week beginners to veteran teams.\n- If you can't tell their level, start simple and ask one short question, or adjust based on how they write.\n\n## Technical scope\n- Languages and platforms: VEXcode V5 (C++ and Python), PROS (C++), and RobotMesh Studio when relevant. Ask which one they use if it isn't clear, and never mix APIs between them.\n- Common topics: drivetrain setup, motor groups, tank/arcade/holonomic drive control, sensors (inertial, rotation, optical, distance, vision/AI vision), PID control, odometry, autonomous routines, driver-control tuning, debugging, and pneumatics/mechanism logic.\n- Beyond code, you can also help with design choices, strategy, scouting, engineering notebook structure, and interview/judging prep.\n\n## How to help\n1. Lead with the answer or working code, then explain it briefly.\n2. Comment code so a student can follow it, and explain non-obvious lines (e.g., why a deadband exists, what a PID constant does).\n3. When debugging, ask for the error message, the relevant code, and what the robot actually did vs. what was expected. Suggest the most likely cause first, and give a way to test it.\n4. For tuning (PID, turn accuracy, autonomous timing), give a systematic method, not random numbers.\n5. Teach as you go. For learners, offer a short \"why this works\" note. Don't write long lectures unless asked.\n6. Keep responses concise. Use code blocks for all code, and numbered steps for procedures.\n\n## Honesty and accuracy\n- Never invent API functions, parameters, or library features. If you're unsure whether something exists in a given version of VEXcode or PROS, say so and suggest how to verify it in the docs.\n- Game rules, scoring, and leg"}, {"from": "human", "value": "Summarize the following source: Installation | EZ-Template"}, {"from": "gpt", "value": "All versions of EZ-Template require you to use an IMU. You can find mounting instructions here.\n\n## Download PROS[](https://ez-robotics.github.io/EZ-Template/tutorials/installation#download-pros \"Direct link to Download PROS\")\n\nPROS is an open-source project developed by students at Purdue that gives us functions to interact with our V5 brain and other devices that connect to it. If you don't have it installed, you can read their Getting Started page here.\n\n## Download EZ-Template[](https://ez-robotics.github.io/EZ-Template/tutorials/installation#download-ez-template \"Direct link to Download EZ-Template\")\n\nDownload the latest `EZ-Template-Example-Project.zip` by clicking here and extract the zip file. Click here if you're unsure how to extract a zip file.\n\n## Open EZ-Template-Example-Project[](https://ez-robotics.github.io/EZ-Template/tutorials/installation#open-ez-template-example-project \"Direct link to Open EZ-Template-Example-Project\")\n\nAdd the folder to your workspace. You can do this by going to the very top of your screen and selecting `File` -> `Add Folder to Workspace`. This will bring up a window and you'll have to navigate to where you extracted the example project. If you're unsure where you extracted it, it's most likely in your `Downloads` folder.\n\n## Open `main.cpp`[](https://ez-robotics.github.io/EZ-Template/tutorials/installation#open-maincpp \"Direct link to open-maincpp\")\n\nYou'll find `main.cpp` by selecting `EZ-Template-Example-Project` and opening `src`. `main.cpp` is your main file where you can modify your user control code, the root of your autonomous routines, etc.\n\n## Configure the Drive Constructor[](https://ez-robotics.github.io/EZ-Template/tutorials/installation#configure-the-drive-constructor \"Direct link to Configure the Drive Constructor\")\n\nNear the top of `main.cpp` you'll see some code that looks like this. This is your drive constructor, and it gives EZ-Template your chassis motor ports, the IMU port, the size of your wheels, and the rpm your wheels go at. All of this information is needed so EZ-Template can make sure your robot is going the correct distances. Configure these numbers to your robot.\n\nTo figure out which motors are reversed and not reversed, open the devices menu on your brain. This is on your home screen. Select any motor and hold down the right button. Keep note if that motor is going forward or backwards, and if it's the left or right side. Repeat this for all of your drivetrain motors.\n\nInput all of your left motors into the constructor first. If you have more/less motors, you can add/remove numbers from the curly braces. If any of the motors put the robot backwards, make that port negative. Repeat for the right side.\n\n```\n// Chassis constructor\n\nez::Drive chassis(\n\n// These are your drive motors, the first motor is used for sensing!\n\n{1, 2, 3}, // Left Chassis Ports (negative port will reverse it!)\n\n{-4, -5, -6}, // Right Chassis Ports (negative port will reverse it!)\n\n7, // IMU Port\n\n4.125, // Wheel Diameter (Remember, 4\" wheels without screw holes are actually 4.125!)\n\n343.0); // Wheel RPM = cartridge * (motor gear / wheel gear)\n```\n\n## Configure Tracking Wheels[](https://ez-robotics.github.io/EZ-Template/tutorials/installation#configure-tracking-wheels \"Direct link to Configure Tracking Wheels\")\n\nAre you using tracking wheels? You can configure them here!\n\nTracking wheels are not required for EZ-Template! Read below for more information.\n\nThe examples below show you how to create tracking wheels using ADI Encoders, ADI Encoders plugged into 3-wire Expanders, and Rotation Sensors.\n\nIf you have:\n\n- all omni base\n- it is recommended to use at minimum a horizontal tracking wheel\n- a parallel tracking wheel will help read any wheel slip that happens\n- traction wheels\n- you can just use a parallel tracking wheel and get good results\n\nBut, **EZ-Template works without tracking wheels!** If you use no tracking wheels, you'll need to be aware of wheel slip and try to avoid it. Odometry and tracking are not magic and you'll need to do as much as possible to help the robot be consistent. If you're able to, just fit a parallel and perpendicular tracking wheel :D you'll be thankful in the long run.\n\nEZ-Template supports any combination of tracking wheels.\n\n`2.75` is the wheel diameter, and `4.0` is the distance to the center of the robot. You can use a tape measure to find this value, or you can follow this tutorial. Your parallel tracking wheels will be the left/right trackers, and your perpendicular trackers will be the front/back trackers.\n\nLeft/right trackers are tracking wheels that are parallel to your drive wheels, and front/back trackers are tracking wheels that are perpendicular to your drive wheels.\n\n- Rotation Sensor\n- ADI Encoder\n- ADI Encoder in Expander\n\n```\nez::tracking_wheel horiz_tracker(8, 2.75, 4.0); // This tracking wheel is perpendicular to the drive wheels\n\nez::tracking_wheel vert_tracker(-9, 2.75, 4.0); // This tracking wheel is parallel to the drive wheels\n```\n\nYou'll now need to tell EZ-Template what tracking wheels to use.\n\n```\nvoid initialize() {\n\n// Print our branding over your terminal :D\n\nez::ez_template_print();\n\npros::delay(500); // Stop the user from doing anything while legacy ports configure\n\n// Look at your horizontal tracking wheel and decide if it's in front of the midline of your robot or behind it\n\n// - change `back` to `front` if the tracking wheel is in front of the midline\n\n// - ignore this if you aren't using a horizontal tracker\n\nchassis.odom_tracker_back_set(&horiz_tracker);\n\n// Look at your vertical tracking wheel and decide if it's to the left or right of the center of the robot\n\n// - change `left` to `right` if the tracking wheel is to the right of the centerline\n\n// - ignore this if you aren't using a vertical tracker\n\nchassis.odom_tracker_left_set(&vert_tracker);\n\n// . . .\n\n}\n```\n\nIf you don't have tracking wheels, you don't need to set any drive offsets! You'll be able to use odometry without any offsets.\n\n## Build and Upload[](https://ez-robotics.github.io/EZ-Template/tutorials/installation#build-and-upload \"Direct link to Build and Upload\")\n\nIf you see a white dot at the top of your file name, this means your code is not saved! Please save your code with `ctrl + s` on Windows or `command + s` on Mac. Only your most recent saved code will build!\n\nGo to `File` -> `Auto Save` to enable automatic saving!\n\nFirst, take a micro-USB cable and connect it between your computer and the robot. You may also connect it to the controller, but only if your controller is already linked to the robot. If you're unsure if your controller is paired or not, read this article.\n\nAt the left of your screen, select this icon.\n\nSelect `Build and Upload`. Building your code makes sure you have no errors and sets everything up to upload your code to the robot. Once this is complete, it will upload code to your robot.\n\n## Making Sure the IMU is Detected[](https://ez-robotics.github.io/EZ-Template/tutorials/installation#making-sure-the-imu-is-detected \"Direct link to Making Sure the IMU is Detected\")\n\nRun the program on the brain. You should see a loading bar come up on the brain. If this bar goes completely red, you have a problem with your IMU. You've either used the wrong port in your drive constructor, you have a bad cable, or you have a bad IMU. You'll have to debug this to find out which one is bad.\n\n## Making Sure Drive Ports are Correct[](https://ez-robotics.github.io/EZ-Template/tutorials/installation#making-sure-drive-ports-are-correct \"Direct link to Making Sure Drive Ports are Correct\")\n\nThe default drive mode for EZ-Template is tank drive, where the left stick controls the left side of the drive and the right stick controls the right side of the drive. If all of the ports are set up correctly, the robot will drive!\n\nIf the motors sound like they're running but they get locked up, you have a motor going in the wrong direction. I suggest unplugging motors until you find the 1 going the wrong way, find out which port is going the wrong way, and update your drive constructor accordingly.\n\n## Making Sure Tracking Wheels are Reversed Correctly[](https://ez-robotics.github.io/EZ-Template/tutorials/installation#making-sure-tracking-wheels-are-reversed-correctly \"Direct link to Making Sure Tracking Wheels are Reversed Correctly\")\n\nOnce you start up your code, go left on the autonomous selector once. This will bring you to a blank page that ships with the example project.\n\nEnsure that your left/right tracking wheels increase positively when pushing the robot forward, and your front/back tracking wheels increase positively when pushing the robot to the right.\n\nIf any sensor is reading the wrong way, make the port negative in the constructor.\n\n## You're Setup\n\n🥳🥳You're all set up! The next page will show you how to run the built-in example autonomous routines."}], "source": "https://ez-robotics.github.io/EZ-Template/tutorials/installation"} {"conversations": [{"from": "system", "value": "You are a coding and engineering mentor for students in the VEX V5 Robotics Competition (VRC). Your job is to help students build working robots and also understand why they work, so they get better on their own.\n\n## Who you're helping\n- Mostly middle and high school students, with experience ranging from first-week beginners to veteran teams.\n- If you can't tell their level, start simple and ask one short question, or adjust based on how they write.\n\n## Technical scope\n- Languages and platforms: VEXcode V5 (C++ and Python), PROS (C++), and RobotMesh Studio when relevant. Ask which one they use if it isn't clear, and never mix APIs between them.\n- Common topics: drivetrain setup, motor groups, tank/arcade/holonomic drive control, sensors (inertial, rotation, optical, distance, vision/AI vision), PID control, odometry, autonomous routines, driver-control tuning, debugging, and pneumatics/mechanism logic.\n- Beyond code, you can also help with design choices, strategy, scouting, engineering notebook structure, and interview/judging prep.\n\n## How to help\n1. Lead with the answer or working code, then explain it briefly.\n2. Comment code so a student can follow it, and explain non-obvious lines (e.g., why a deadband exists, what a PID constant does).\n3. When debugging, ask for the error message, the relevant code, and what the robot actually did vs. what was expected. Suggest the most likely cause first, and give a way to test it.\n4. For tuning (PID, turn accuracy, autonomous timing), give a systematic method, not random numbers.\n5. Teach as you go. For learners, offer a short \"why this works\" note. Don't write long lectures unless asked.\n6. Keep responses concise. Use code blocks for all code, and numbered steps for procedures.\n\n## Honesty and accuracy\n- Never invent API functions, parameters, or library features. If you're unsure whether something exists in a given version of VEXcode or PROS, say so and suggest how to verify it in the docs.\n- Game rules, scoring, and leg"}, {"from": "human", "value": "Summarize the following source: VEX Library"}, {"from": "gpt", "value": "1. VEX Library\n2. V5\n\nThis category is not viewable in your language. Please check back at a future date.\n\nTable of Contents\n\n- Start Here\n- Next Steps\n- Get Started with Your V5 System Bundle\n\n- **Start Here**\n\n- Get Started with VEX V5\n- V5 Educators Start Here\n\n- **Next Steps**\n\n- Building with VEX V5\n- Coding with VEXcode V5\n- Getting Started with VEX V5\n- Getting Started with Your V5 Kit\n- Selecting a V5 Robot Kit\n\n- **Get Started with Your V5 System Bundle**\n\n- Get Started with Your VEX V5 System Bundle\n- Understanding the V5 Controller\n- Understanding the V5 Robot Battery\n- Understanding the V5 Robot Brain\n- Understanding the V5 Robot Radio\n- **See all articles under the Get Started with Your V5 System Bundle section.**\n\nTable of Contents\n\n- In the Classroom\n- Competition 101 STEM Labs\n- More Ways to Teach\n- Educator Resources\n\n- **In the Classroom**\n\n- Teaching EXP STEM Lab Units with VEX V5 Kits\n- Teaching with VEX V5\n- Using the VEX V5 Leaderboard\n- V5 Editable SPARK STEM Lab Previews\n- V5 SPARK STEM Lab Teacher Notes Guide\n- **See all articles under the In the Classroom section.**\n\n- **Competition 101 STEM Labs**\n\n- Implementing a Competition 101 STEM Lab\n- Cultivating a Positive Team Culture\n- Making Competition 101 STEM Labs Work for All Students\n\n- **More Ways to Teach**\n\n- Using VEX V5 Activities in the Classroom\n- Implementing V5 Learn Practice Compete STEM Lab Units\n- Teacher Support Materials in V5 Learn Practice Compete STEM Labs\n- Co-creating Learning Targets with Your Students\n- Having Effective Debrief Conversations with Your Students\n- **See all articles under the More Ways to Teach section.**\n\n- **Educator Resources**\n\n- Printable and Offline Resources for V5 STEM Labs\n\nTable of Contents\n\n- Robot Brain\n- Robot Battery\n- Controller\n- Robot Radio\n- Motor\n- V5 Sensors\n- V5 3-Wire Devices\n- Using Sensors\n- Vision Sensor\n- Cables\n- Troubleshooting\n\n- **Robot Brain**\n\n- Changing the Backlight Percentage on the V5 Brain\n- Changing the Color Theme on the V5 Brain\n- Changing the Rotation Orientation on the V5 Brain\n- Mounting and Wiring the V5 Brain\n- Resetting the V5 Brain to Default Values\n- **See all articles under the Robot Brain section.**\n\n- **Robot Battery**\n\n- Charging the V5 Battery\n- Connecting the V5 Battery\n- Mounting and Wiring the V5 Battery\n- Planning V5 Battery Charging\n- V5 Battery Overview\n\n- **Controller**\n\n- Calibrating the V5 Controller\n- Charging the VEX V5 Controller\n- Making Selections from the V5 Controller Main Screen\n- Pairing the V5 Controller with the V5 Brain for a Wireless Connection\n- Resetting the V5 Controller\n- **See all articles under the Controller section.**\n\n- **Robot Radio**\n\n- Mounting and Wiring the V5 Radio\n- Understanding the V5 Radio LED Lights\n- V5 Radio Overview\n\n- **Motor**\n\n- Troubleshooting VEX V5 Smart Motors\n- Understanding V5 Smart Motor (11W) Performance\n- Understanding V5 Smart Motor (5.5W) Performance\n- Connecting and Configuring the Motor Controller 55\n\n- **V5 Sensors**\n\n- Overview of the VEX V5 Sensors\n- Using the 3-Wire Expander with VEX V5\n- Using the Distance Sensor with VEX V5\n- Using the GPS Sensor with VEX V5\n- Using the Inertial Sensor with VEX V5\n- **See all articles under the V5 Sensors section.**\n\n- **V5 3-Wire Devices**\n\n- Using 3-Wire Digital In/Digital Out Devices\n- Using the V5 3-Wire Bumper Switch v2 & Limit Switch\n- Using the V5 3-Wire LED Indicator\n- Using the V5 3-Wire Light Sensor\n- Using the V5 3-Wire Line Tracker\n- **See all articles under the V5 3-Wire Devices section.**\n\n- **Using Sensors**\n\n- Best Practices with the GPS Sensor\n- Coding the V5 Distance Sensor using Math Inequalities\n- Connecting a 3-Wire Device to the V5 Brain\n- Mounting and Wiring the V5 3-Wire Bumper Switch v2\n- Troubleshooting VEX V5 Sensors\n- **See all articles under the Using Sensors section.**\n\n- **Vision Sensor**\n\n- Connecting the V5 Vision Sensor to a Wireless Device\n- Mounting and Wiring the V5 Vision Sensor\n- Using the Vision Utility with the Vision Sensor\n- Viewing Vision Sensor Data on the V5 Brain\n\n- **Cables**\n\n- Connecting and Managing V5 Cables\n\n- **Troubleshooting**\n\n- Troubleshooting the V5 Brain White Screen Error\n- Understanding the VEX V5 Firmware Utility\n- Updating the V5 Brain Firmware\n- Updating the V5 Controller Firmware\n- Interpreting V5 Battery Lights and Errors\n- **See all articles under the Troubleshooting section.**\n\nTable of Contents\n\n- Assembly Tips\n- Motor\n- Mechanisms\n- Structure\n- Competition Robots\n- Pneumatics\n- Legacy Pneumatics\n- Safety\n\n- **Assembly Tips**\n\n- Building V5 Robot Lift Systems\n- Designing a V5 Chassis\n- Creating a V5 Drivetrain\n- Using Gear Ratios with the V5 Motor\n- Stiffening a V5 Chassis\n- **See all articles under the Assembly Tips section.**\n\n- **Motor**\n\n- Mounting and Wiring the V5 Motor\n- Switching the V5 Motor Gear Cartridge\n- Using Spur Gears with the V5 Motor\n- V5 Motor Overview\n- Viewing the V5 Motor Dashboard\n\n- **Mechanisms**\n\n- Building V5 Passive Manipulators\n- Building V5 Robot Arms\n- Building V5 Robot Claws\n- Building with VEX V5 Motor Groups\n- Repairing and Reassembling a V5 Clawbot Claw (V5 Claw Kit v2)\n- **See all articles under the Mechanisms section.**\n\n- **Structure**\n\n- Overview of V5 Chains and Sprockets\n- Overview of VEX Screws\n- Removing V5 Stripped Screws\n- Understanding and Using V5 Tools\n- Understanding Standoff vs. Hex Nut Retainers\n- **See all articles under the Structure section.**\n\n- **Competition Robots**\n\n- Getting Started with Robot Design: V5RC Push Back\n- An Introduction to Dex: The V5RC Push Back Hero Bot\n- An Introduction to Axel: The V5RC High Stakes Hero Bot\n- An Introduction to Disco: the V5RC Spin Up Hero Bot\n- An Introduction to Moby: the V5RC Tipping Point Hero Bot\n- **See all articles under the Competition Robots section.**\n\n- **Pneumatics**\n\n- Understanding the V5 Pneumatics Kit Components\n- Example V5 Pneumatics Kit Configurations\n- Coding the V5 Pneumatics Kit\n- Controlling Pneumatics Using Buttons on Your Controller\n\n- **Legacy Pneumatics**\n\n- Legacy - Selecting a Pneumatics Kit for the V5 System\n- Legacy - Getting Started with Pneumatics with the V5 System\n- Legacy - Preventing Air Leakage in a VEX Pneumatic System\n\n- **Safety**\n\n- Precautions and Safety Guidelines When Working with VEX V5 Robots\n\nTable of Contents\n\n- Get Started\n- Install\n- Open and Save Blocks Projects\n- Open and Save Python Projects\n- Open and Save C++ Projects\n- Connect to the Brain\n- Robot Config\n- Blocks Tutorials\n- Python Tutorials\n- C++ Tutorials\n- Troubleshooting\n- Project Help\n- Examples\n- IT Installation\n\n- **Get Started**\n\n- New Features in VEXcode 4.60\n- Creating a New Project in VEXcode V5\n- Get Started with VEXcode V5 Firmware\n- New Features in VEXcode V5 4.0\n- VEXos V5 Firmware Changelog\n- **See all articles under the Get Started section.**\n\n- **Install**\n\n- Installing the VEX Drivers Installer for VEX V5\n- Installing VEXcode V5 on Chromebook\n- Installing VEXcode V5 on iPad\n- Installing VEXcode V5 on macOS\n- Installing VEXcode V5 on Windows\n- **See all articles under the Install section.**\n\n- **Open and Save Blocks Projects**\n\n- Opening a VEXcode V5 Blocks Project on a Chromebook\n- Opening a VEXcode V5 Blocks Project on an Android\n- Opening a VEXcode V5 Blocks Project on an iPad\n- Opening a VEXcode V5 Blocks Project on macOS\n- Opening a VEXcode V5 Blocks Project on Windows\n- **See all articles under the Open and Save Blocks Projects section.**\n\n- **Open and Save Python Projects**\n\n- Opening a V5 Python Project on Chromebook\n- Opening a V5 Python Project on Windows\n- Opening a VEXcode V5 Python Project on macOS\n- Saving a V5 Python Project on Chromebook\n- Saving a V5 Python Project on macOS\n- **See all articles under the Open and Save Python Projects section.**\n\n- **Open and Save C++ Projects**"}], "source": "https://kb.vex.com/hc/en-us/categories/360002333191-V5"} {"conversations": [{"from": "system", "value": "You are a coding and engineering mentor for students in the VEX V5 Robotics Competition (VRC). Your job is to help students build working robots and also understand why they work, so they get better on their own.\n\n## Who you're helping\n- Mostly middle and high school students, with experience ranging from first-week beginners to veteran teams.\n- If you can't tell their level, start simple and ask one short question, or adjust based on how they write.\n\n## Technical scope\n- Languages and platforms: VEXcode V5 (C++ and Python), PROS (C++), and RobotMesh Studio when relevant. Ask which one they use if it isn't clear, and never mix APIs between them.\n- Common topics: drivetrain setup, motor groups, tank/arcade/holonomic drive control, sensors (inertial, rotation, optical, distance, vision/AI vision), PID control, odometry, autonomous routines, driver-control tuning, debugging, and pneumatics/mechanism logic.\n- Beyond code, you can also help with design choices, strategy, scouting, engineering notebook structure, and interview/judging prep.\n\n## How to help\n1. Lead with the answer or working code, then explain it briefly.\n2. Comment code so a student can follow it, and explain non-obvious lines (e.g., why a deadband exists, what a PID constant does).\n3. When debugging, ask for the error message, the relevant code, and what the robot actually did vs. what was expected. Suggest the most likely cause first, and give a way to test it.\n4. For tuning (PID, turn accuracy, autonomous timing), give a systematic method, not random numbers.\n5. Teach as you go. For learners, offer a short \"why this works\" note. Don't write long lectures unless asked.\n6. Keep responses concise. Use code blocks for all code, and numbered steps for procedures.\n\n## Honesty and accuracy\n- Never invent API functions, parameters, or library features. If you're unsure whether something exists in a given version of VEXcode or PROS, say so and suggest how to verify it in the docs.\n- Game rules, scoring, and leg"}, {"from": "human", "value": "Summarize the following source: VEX Library"}, {"from": "gpt", "value": "Save Blocks Projects** - Opening a VEXcode V5 Blocks Project on a Chromebook - Opening a VEXcode V5 Blocks Project on an Android - Opening a VEXcode V5 Blocks Project on an iPad - Opening a VEXcode V5 Blocks Project on macOS - Opening a VEXcode V5 Blocks Project on Windows - **See all articles under the Open and Save Blocks Projects section.** - **Open and Save Python Projects** - Opening a V5 Python Project on Chromebook - Opening a V5 Python Project on Windows - Opening a VEXcode V5 Python Project on macOS - Saving a V5 Python Project on Chromebook - Saving a V5 Python Project on macOS - **See all articles under the Open and Save Python Projects section.** - **Open and Save C++ Projects**\n\n- Opening a V5 C++ Project on Chromebook\n- Opening a V5 C++ Project on Windows\n- Opening a VEXcode V5 C++ Project on macOS\n- Saving a V5 C++ Project on Chromebook\n- Saving a V5 C++ Project on macOS\n- **See all articles under the Open and Save C++ Projects section.**\n\n- **Connect to the Brain**\n\n- Configuring the V5 Brain for Coding over Bluetooth\n- Connecting the V5 Brain to a Computer via USB\n- Connecting to the Console Serial Port in Web-Based VEXcode V5\n- Connecting with App-Based VEXcode V5 - Chromebook\n- Connecting with App-based VEXcode V5 - macOS\n- **See all articles under the Connect to the Brain section.**\n\n- **Robot Config**\n\n- Adding the V5 Vision Sensor as a Device in VEXcode V5\n- Adjusting the V5 Vision Sensor in VEXcode V5\n- Configuring 3-Wire Devices in VEXcode V5\n- Configuring 3-Wire Digital In and Digital Out Devices in VEXcode V5\n- Configuring a 2-Motor Drivetrain (No Gyro) in VEXcode V5\n- **See all articles under the Robot Config section.**\n\n- **Blocks Tutorials**\n\n- Blocks Keyboard Navigation Shortcuts in VEXcode V5 (Experimental)\n- Changing Block Size in VEXcode V5\n- Configuring Sensors in VEXcode V5\n- Converting a Blocks Project to Text in VEXcode V5\n- Custom Controller Code in VEXcode V5\n- **See all articles under the Blocks Tutorials section.**\n\n- **Python Tutorials**\n\n- Accessing Help in a VEXcode V5 Python Project\n- Data Logging with a VEX Brain and Sensors Using Python\n- Starting, Downloading, and Running a Python Project in VEXcode V5\n- Understanding the Colorization of Code in VEXcode V5 Python\n- Using Comments in VEXcode V5 Python\n- **See all articles under the Python Tutorials section.**\n\n- **C++ Tutorials**\n\n- Accessing Help in a VEXcode V5 C++ Project\n- Starting, Downloading, and Running a VEXcode V5 C++ Project\n- Using C++ Example Projects and Templates in VEXcode V5\n- Using the C++ Autocomplete Feature in VEXcode V5\n- Using the Code Viewer for C++ in VEXcode V5\n\n- **Troubleshooting**\n\n- Troubleshooting VEXcode V5 Opening Slowly on Windows Computers\n- Resolving \"Invalid Asset Table\" Errors on a VEX V5 Brain\n- Troubleshooting Connecting to Web-based VEXcode V5\n- Pre-Downloading a Project Checklist for VEXcode V5\n- Understanding Download Errors in VEXcode V5\n- **See all articles under the Troubleshooting section.**\n\n- **Project Help**\n\n- Playing Custom Imported Sounds in a VEXcode V5 Project\n- Viewing Tutorial Videos in VEXcode V5\n\n- **Examples**\n\n- Driving Disco, the 2022-23 VRC Hero Bot\n\n- **IT Installation**\n\n- Installing VEXcode V5 3.x with MSI Installers\n- Installing VEXcode V5 4.x with MSI Installers\n\nTable of Contents\n\n- Competition Templates\n- Robot Skills\n- Competition Field Logistics\n- Virtual Coding Skills\n- Virtual Driving Skills\n\n- **Competition Templates**\n\n- Running a VEXcode V5 Competition Template Project on a VEX V5 Controller\n- Using the Python Competition Template in VEXcode V5\n- Using the Blocks Competition Template in VEXcode V5\n\n- **Robot Skills**\n\n- Running a Robot Skills Match on a VEX V5 Controller\n- Using a VEX V5 Robot Brain for Robot Skills Challenge Field Control\n\n- **Competition Field Logistics**\n\n- Connecting to the VEX V5 Competition Field\n- Minimizing Electrostatic Discharge at VEX V5 Robotics Competition Events\n- Mounting the Field Control System to the VEX V5 Portable Competition Field\n- Securing the Straps on the VEX V5 Portable Competition Field\n- VEX V5 Portable Competition Field Packing Instructions\n\n- **Virtual Coding Skills**\n\n- Accessing VEX V5 Virtual Skills with a Virtual Skills Key\n- Entering the VEXcode VR Autonomous Skills Global STEM Challenge\n- Get Started with the VEX V5 Override Playground in VEXcode VR\n- Submitting a Virtual Skills Score in VEXcode VR\n- Using the VEX V5 26-27 Override Playground Window\n\n- **Virtual Driving Skills**\n\n- Practicing Using V5 Virtual Driving Skills\n- Connecting a VEX V5 Controller to Virtual Driving Skills\n\nTable of Contents\n\n- Installation\n- Using the VS Code Extension\n- V5 Brain in VS Code Extension\n- UI and Settings in VS Code Extension\n- VS Code Extension for V5\n\n- **Installation**\n\n- Troubleshooting VEX VS Code Extension with macOS\n- VS Code Installation Guide for V5 on a Windows Device\n- VS Code Installation Guide for V5 on a macOS Device\n- Installing the VEX Extension, C/C++ Extension, and Python Extension in VS Code\n- VS Code Installation Guide for V5\n\n- **Using the VS Code Extension**\n\n- Updating V5 Brain Firmware through a Controller in VS Code\n- Downloading and Running a VEX Project in VS Code\n- Accessing Help in a VEX VS Code Project\n- Using the VEX Feedback in VS Code\n- Understanding the VEX DEVICE INFO in VS Code\n- **See all articles under the Using the VS Code Extension section.**\n\n- **V5 Brain in VS Code Extension**\n\n- Updating VEXos in VS Code\n- Naming the VEX Brain in VS Code\n- Setting the Team Number for the VEX Brain in VS Code\n- Taking Screenshots of the VEX Brain in VS Code\n- Erasing Programs From VEX Brain in VS Code\n- **See all articles under the V5 Brain in VS Code Extension section.**\n\n- **UI and Settings in VS Code Extension**\n\n- VEX VS Code Extension UI Overview\n- Understanding the User Settings for VEX VS Code Extension\n\n- **VS Code Extension for V5**\n\n- Creating VS Code Projects for V5\n- VS Code New Project for V5\n- VS Code UI Overview for V5\n- Using the VEX Visual Studio Code Extension\n\nTable of Contents\n\n- Getting Started\n- Coding with the AI Vision Sensor\n- Troubleshooting\n- Additional Resources\n\n- **Getting Started**\n\n- Getting Started with the AI Vision Sensor with VEX V5\n- Setting up Your Classroom Environment for Using the AI Vision Sensor\n- Mounting and Wiring the AI Vision Sensor on the V5 Clawbot\n- Mounting and Wiring the AI Vision Sensor on the V5 Advanced Trainingbot\n- Updating the AI Vision Sensor's Firmware in VEXcode V5\n- **See all articles under the Getting Started section.**\n\n- **Coding with the AI Vision Sensor**\n\n- Coding with the AI Vision Sensor in VEXcode V5 Blocks\n- Coding with the AI Vision Sensor in VEXcode V5 Python\n- Coding with the AI Vision Sensor in VEXcode V5 C++\n- Configuring Color Signatures with the AI Vision Sensor in VEXcode V5\n- Configuring Color Codes with the AI Vision Sensor in VEXcode V5\n- **See all articles under the Coding with the AI Vision Sensor section.**\n\n- **Troubleshooting**\n\n- Troubleshooting the AI Vision Sensor with VEX V5\n- Allow Camera Permissions for AI Vision Sensor on Chrome Browser VEXcode V5\n- Allow Camera Permissions for AI Vision Sensor on Windows in App-based VEXcode V5\n- Allow Camera Permissions for AI Vision Sensor on macOS in App-based VEXcode V5\n- Block AI Vision Sensor Camera Permissions in Microsoft Edge VEXcode V5\n\n- **Additional Resources**\n\n- Comparing the AI Vision Sensor to the V5 Vision Sensor\n\nTable of Contents\n\n- Get Started\n- Setting Up VEX AI\n- Using VEX AI\n\n- **Get Started**\n\n- Getting Started With the VEX AI System\n\n- **Setting Up VEX AI**\n\n- 3D Printing Housings for the VEX AI System\n- Connecting and Powering the Jetson for VEX AI\n- Installing the Intel Dual Band Wi-Fi and Antennas for VEX AI\n- Understanding the Parts of the AI System\n\n- **Using VEX AI**\n\n- Accessing the Dashboard of the VEX AI Intel Camera\n- Coding the VEX AI Robot\n\nTable of Contents\n\n- Get Started\n- Install\n- Robot Config\n- Tutorials\n- Programming\n- Troubleshooting\n\n- **Get Started**\n\n- Creating a New Project in VEXcode Pro V5\n- Introduction to VEXcode Pro V5\n\n- **Install**\n\n- Installing VEXcode Pro V5 on macOS\n- Installing VEXcode Pro V5 on Windows\n- Installing VEXcode Pro V5 with MSI Installers"}], "source": "https://kb.vex.com/hc/en-us/categories/360002333191-V5"} {"conversations": [{"from": "system", "value": "You are a coding and engineering mentor for students in the VEX V5 Robotics Competition (VRC). Your job is to help students build working robots and also understand why they work, so they get better on their own.\n\n## Who you're helping\n- Mostly middle and high school students, with experience ranging from first-week beginners to veteran teams.\n- If you can't tell their level, start simple and ask one short question, or adjust based on how they write.\n\n## Technical scope\n- Languages and platforms: VEXcode V5 (C++ and Python), PROS (C++), and RobotMesh Studio when relevant. Ask which one they use if it isn't clear, and never mix APIs between them.\n- Common topics: drivetrain setup, motor groups, tank/arcade/holonomic drive control, sensors (inertial, rotation, optical, distance, vision/AI vision), PID control, odometry, autonomous routines, driver-control tuning, debugging, and pneumatics/mechanism logic.\n- Beyond code, you can also help with design choices, strategy, scouting, engineering notebook structure, and interview/judging prep.\n\n## How to help\n1. Lead with the answer or working code, then explain it briefly.\n2. Comment code so a student can follow it, and explain non-obvious lines (e.g., why a deadband exists, what a PID constant does).\n3. When debugging, ask for the error message, the relevant code, and what the robot actually did vs. what was expected. Suggest the most likely cause first, and give a way to test it.\n4. For tuning (PID, turn accuracy, autonomous timing), give a systematic method, not random numbers.\n5. Teach as you go. For learners, offer a short \"why this works\" note. Don't write long lectures unless asked.\n6. Keep responses concise. Use code blocks for all code, and numbered steps for procedures.\n\n## Honesty and accuracy\n- Never invent API functions, parameters, or library features. If you're unsure whether something exists in a given version of VEXcode or PROS, say so and suggest how to verify it in the docs.\n- Game rules, scoring, and leg"}, {"from": "human", "value": "Summarize the following source: VEX Library"}, {"from": "gpt", "value": "Started With the VEX AI System - **Setting Up VEX AI** - 3D Printing Housings for the VEX AI System - Connecting and Powering the Jetson for VEX AI - Installing the Intel Dual Band Wi-Fi and Antennas for VEX AI - Understanding the Parts of the AI System - **Using VEX AI** - Accessing the Dashboard of the VEX AI Intel Camera - Coding the VEX AI Robot Table of Contents - Get Started - Install - Robot Config - Tutorials - Programming - Troubleshooting - **Get Started** - Creating a New Project in VEXcode Pro V5 - Introduction to VEXcode Pro V5 - **Install** - Installing VEXcode Pro V5 on macOS - Installing VEXcode Pro V5 on Windows - Installing VEXcode Pro V5 with MSI Installers\n\n- **Robot Config**\n\n- Configuring a 4-Motor Drivetrain (No Gyro) in VEXcode Pro V5\n- Configuring a 4-Motor Drivetrain in VEXcode Pro V5\n- Adjusting the Vision Sensor in VEXcode Pro V5\n- Configuring 3-Wire Devices in VEXcode Pro V5\n- Configuring a 2-Motor Drivetrain (No Gyro) in VEXcode Pro V5\n- **See all articles under the Robot Config section.**\n\n- **Tutorials**\n\n- Adding New Files to Projects in VEXcode Pro V5\n- Creating a Project to Drive Forward and Backward in VEXcode Pro V5\n- Creating a Project to Turn Left and Right in VEXcode Pro V5\n- Downloading and Running a Project in VEXcode Pro V5\n- Importing .vex Files and VEXcode Projects in VEXcode Pro V5\n- **See all articles under the Tutorials section.**\n\n- **Programming**\n\n- Basic Project Structure for Your First Project in VEXcode Pro V5\n- Changing Variables in VEXcode Pro V5\n- Creating Float and Double Variables in VEXcode Pro V5\n- Creating Variables for Integers in VEXcode Pro V5\n- Creating Variables in VEXcode Pro V5\n- **See all articles under the Programming section.**\n\n- **Troubleshooting**\n\n- Troubleshooting Exit Code 2 on VEXcode Pro V5\n- Using Help in VEXcode Pro V5"}], "source": "https://kb.vex.com/hc/en-us/categories/360002333191-V5"} {"conversations": [{"from": "system", "value": "You are a coding and engineering mentor for students in the VEX V5 Robotics Competition (VRC). Your job is to help students build working robots and also understand why they work, so they get better on their own.\n\n## Who you're helping\n- Mostly middle and high school students, with experience ranging from first-week beginners to veteran teams.\n- If you can't tell their level, start simple and ask one short question, or adjust based on how they write.\n\n## Technical scope\n- Languages and platforms: VEXcode V5 (C++ and Python), PROS (C++), and RobotMesh Studio when relevant. Ask which one they use if it isn't clear, and never mix APIs between them.\n- Common topics: drivetrain setup, motor groups, tank/arcade/holonomic drive control, sensors (inertial, rotation, optical, distance, vision/AI vision), PID control, odometry, autonomous routines, driver-control tuning, debugging, and pneumatics/mechanism logic.\n- Beyond code, you can also help with design choices, strategy, scouting, engineering notebook structure, and interview/judging prep.\n\n## How to help\n1. Lead with the answer or working code, then explain it briefly.\n2. Comment code so a student can follow it, and explain non-obvious lines (e.g., why a deadband exists, what a PID constant does).\n3. When debugging, ask for the error message, the relevant code, and what the robot actually did vs. what was expected. Suggest the most likely cause first, and give a way to test it.\n4. For tuning (PID, turn accuracy, autonomous timing), give a systematic method, not random numbers.\n5. Teach as you go. For learners, offer a short \"why this works\" note. Don't write long lectures unless asked.\n6. Keep responses concise. Use code blocks for all code, and numbered steps for procedures.\n\n## Honesty and accuracy\n- Never invent API functions, parameters, or library features. If you're unsure whether something exists in a given version of VEXcode or PROS, say so and suggest how to verify it in the docs.\n- Game rules, scoring, and leg"}, {"from": "human", "value": "Summarize the following source: LVGL Documentation | LVGL Open"}, {"from": "gpt", "value": "Get familiar with LVGL, its key features, and understand how the library is structured.\n\nSet up your development environment and learn the basics of building UIs with LVGL.\n\nAdd LVGL to your project for any platform, framework, RTOS, and display type.\n\nExplore LVGL's extensive widget library with interactive examples and usage guides.\n\nLearn about displays, input devices, fonts, drawing, and other core modules that power LVGL.\n\nUnderstand layouts, styles, events, scrolling, and other features shared across all widgets.\n\nDiscover additional modules for file systems, timers, image decoders, and more.\n\nUse third-party libraries integrated with LVGL for extended functionality.\n\nStep-by-step tutorials covering layouts, styles, animations, and advanced topics.\n\nTools and techniques for diagnosing and fixing issues in your LVGL application.\n\nComplete API documentation for every LVGL module, widget, and function."}], "source": "https://lvgl.io/docs/open"} {"conversations": [{"from": "system", "value": "You are a coding and engineering mentor for students in the VEX V5 Robotics Competition (VRC). Your job is to help students build working robots and also understand why they work, so they get better on their own.\n\n## Who you're helping\n- Mostly middle and high school students, with experience ranging from first-week beginners to veteran teams.\n- If you can't tell their level, start simple and ask one short question, or adjust based on how they write.\n\n## Technical scope\n- Languages and platforms: VEXcode V5 (C++ and Python), PROS (C++), and RobotMesh Studio when relevant. Ask which one they use if it isn't clear, and never mix APIs between them.\n- Common topics: drivetrain setup, motor groups, tank/arcade/holonomic drive control, sensors (inertial, rotation, optical, distance, vision/AI vision), PID control, odometry, autonomous routines, driver-control tuning, debugging, and pneumatics/mechanism logic.\n- Beyond code, you can also help with design choices, strategy, scouting, engineering notebook structure, and interview/judging prep.\n\n## How to help\n1. Lead with the answer or working code, then explain it briefly.\n2. Comment code so a student can follow it, and explain non-obvious lines (e.g., why a deadband exists, what a PID constant does).\n3. When debugging, ask for the error message, the relevant code, and what the robot actually did vs. what was expected. Suggest the most likely cause first, and give a way to test it.\n4. For tuning (PID, turn accuracy, autonomous timing), give a systematic method, not random numbers.\n5. Teach as you go. For learners, offer a short \"why this works\" note. Don't write long lectures unless asked.\n6. Keep responses concise. Use code blocks for all code, and numbered steps for procedures.\n\n## Honesty and accuracy\n- Never invent API functions, parameters, or library features. If you're unsure whether something exists in a given version of VEXcode or PROS, say so and suggest how to verify it in the docs.\n- Game rules, scoring, and leg"}, {"from": "human", "value": "Summarize the following source: API Home — PROS for V5 3.8.0 documentation"}, {"from": "gpt", "value": "# API Home¶\n\nThis document covers the main PROS API, which is completely sufficient for most users’ needs.\n\nC API Headers\n\n- ADI (TriPort) C API\n- ADI Expander C API\n- VEX Distance Sensor C API\n- VEX GPS Sensor C API\n- VEX Inertial Sensor C API\n- LLEMU (Legacy LCD Emulator) C API\n- Miscellaneous C API\n- Motors C API\n- VEX Optical Sensor C API\n- VEX Rotation Sensor C API\n- RTOS Facilities C API\n- Vision Sensor C API\n- VEX Link C API\n\nC++ API Headers\n\n- ADI (TriPort) C++ API\n- VEX Distance Sensor C++ API\n- VEX GPS Sensor C++ API\n- VEX Inertial Sensor C++ API\n- LLEMU (Legacy LCD Emulator) C++ API\n- Miscellaneous C++ API\n- Motors C++ API\n- Motor Groups C++ API\n- VEX Optical Sensor C++ API\n- VEX Rotation Sensor C++ API\n- RTOS Facilities C++ API\n- Vision Sensor C++ API\n- VEX Link C++ API\n\nTo aid in transitioning from PROS 2 syntax to PROS 3, a Legacy API Header\nis provided. This header provides PROS 2 functionality in its original syntax.\n\n- Legacy API\n\nFor additional RTOS-related features, check out the Extended API. Be warned, these features\nare intended for advanced users only and may be very complex to use.\n\n- Extended API"}], "source": "https://pros.cs.purdue.edu/v5/api/index.html"} {"conversations": [{"from": "system", "value": "You are a coding and engineering mentor for students in the VEX V5 Robotics Competition (VRC). Your job is to help students build working robots and also understand why they work, so they get better on their own.\n\n## Who you're helping\n- Mostly middle and high school students, with experience ranging from first-week beginners to veteran teams.\n- If you can't tell their level, start simple and ask one short question, or adjust based on how they write.\n\n## Technical scope\n- Languages and platforms: VEXcode V5 (C++ and Python), PROS (C++), and RobotMesh Studio when relevant. Ask which one they use if it isn't clear, and never mix APIs between them.\n- Common topics: drivetrain setup, motor groups, tank/arcade/holonomic drive control, sensors (inertial, rotation, optical, distance, vision/AI vision), PID control, odometry, autonomous routines, driver-control tuning, debugging, and pneumatics/mechanism logic.\n- Beyond code, you can also help with design choices, strategy, scouting, engineering notebook structure, and interview/judging prep.\n\n## How to help\n1. Lead with the answer or working code, then explain it briefly.\n2. Comment code so a student can follow it, and explain non-obvious lines (e.g., why a deadband exists, what a PID constant does).\n3. When debugging, ask for the error message, the relevant code, and what the robot actually did vs. what was expected. Suggest the most likely cause first, and give a way to test it.\n4. For tuning (PID, turn accuracy, autonomous timing), give a systematic method, not random numbers.\n5. Teach as you go. For learners, offer a short \"why this works\" note. Don't write long lectures unless asked.\n6. Keep responses concise. Use code blocks for all code, and numbered steps for procedures.\n\n## Honesty and accuracy\n- Never invent API functions, parameters, or library features. If you're unsure whether something exists in a given version of VEXcode or PROS, say so and suggest how to verify it in the docs.\n- Game rules, scoring, and leg"}, {"from": "human", "value": "Summarize the following source: OkapiLib Index Page | OkapiLib A PROS library for programming VEX robots"}, {"from": "gpt", "value": "modules. You can omit any prefix from the symbol or file path; adding a\n`:` or `/` suffix lists all members of given symbol or\ndirectory.\n\nUse ↓\n/ ↑ to navigate through the list,\nEnter to go.\nTab autocompletes common prefix, you can\ncopy a link to the result using ⌘\nL while ⌘\nM produces a Markdown link.\n\nSorry, nothing was found."}], "source": "https://okapilib.github.io/OkapiLib/index.html"} {"conversations": [{"from": "system", "value": "You are a coding and engineering mentor for students in the VEX V5 Robotics Competition (VRC). Your job is to help students build working robots and also understand why they work, so they get better on their own.\n\n## Who you're helping\n- Mostly middle and high school students, with experience ranging from first-week beginners to veteran teams.\n- If you can't tell their level, start simple and ask one short question, or adjust based on how they write.\n\n## Technical scope\n- Languages and platforms: VEXcode V5 (C++ and Python), PROS (C++), and RobotMesh Studio when relevant. Ask which one they use if it isn't clear, and never mix APIs between them.\n- Common topics: drivetrain setup, motor groups, tank/arcade/holonomic drive control, sensors (inertial, rotation, optical, distance, vision/AI vision), PID control, odometry, autonomous routines, driver-control tuning, debugging, and pneumatics/mechanism logic.\n- Beyond code, you can also help with design choices, strategy, scouting, engineering notebook structure, and interview/judging prep.\n\n## How to help\n1. Lead with the answer or working code, then explain it briefly.\n2. Comment code so a student can follow it, and explain non-obvious lines (e.g., why a deadband exists, what a PID constant does).\n3. When debugging, ask for the error message, the relevant code, and what the robot actually did vs. what was expected. Suggest the most likely cause first, and give a way to test it.\n4. For tuning (PID, turn accuracy, autonomous timing), give a systematic method, not random numbers.\n5. Teach as you go. For learners, offer a short \"why this works\" note. Don't write long lectures unless asked.\n6. Keep responses concise. Use code blocks for all code, and numbered steps for procedures.\n\n## Honesty and accuracy\n- Never invent API functions, parameters, or library features. If you're unsure whether something exists in a given version of VEXcode or PROS, say so and suggest how to verify it in the docs.\n- Game rules, scoring, and leg"}, {"from": "human", "value": "Summarize the following source: Monte Carlo Localization for VEX teams"}, {"from": "gpt", "value": "Final implementation\n\nin this post, I describe an implementation of Monte Carlo Localization (MCL) for VEX V5 Robotics Competition teams. I’ll explain when a team will need MCL, how it works, and how it looks as code. before we continue, I need to make a very important disclaimer.\n\n**DO NOT USE MY CODE!**\nthis isn’t just because it is illegal to copy someone’s code, but also because my code is not suitable for competition use. I explain a lot of my code’s footguns in the explanation below.\n\nthis is not the implementation we use in the VEX AI team 3151A, which is GPU-accelerated and has other optimizations, but this captures the majority of the important logic.\n\n## general terminology#\n\n**Localization** is just figuring out where your robot is on the field. this generally involves determining or estimating your **pose** (position and orientation), generally expressed as $(x, y, \\theta)$.\n\n**Displacement** or **delta** is the change in pose, generally expressed as $(\\Delta x, \\Delta y, \\Delta \\theta)$.\n\n## why you might need MCL#\n\nmost VEX teams use odometry (with tracking wheels and/or an inertial movement unit) sensors to localize their robot.\n\nhowever, odometry has a big issue. it is “dead-reckoning” — in other words, it is calculating displacement over a short time interval and adding it up (numerically integrating). this is great for 15-second auton runs, but for 1-minute skills, it quickly becomes inaccurate. inherent error in sensors and displacement calculations compound over time.\n\nthe solution is to add two things to your localization system:\n\n1. an **absolute** sensor, which you can compare against your pose. the key feature of this sensor is that its value is not dependent on previous states/poses. in VEX this is typically a distance sensor, which returns the distance to the nearest field wall (or an obstacle).\n\nhowever, using an absolute sensor by itself is not enough. if your distance sensor is obstructed, voila! — your robot now thinks it has teleported backwards. this is where another algorithm comes in.\n\n2. a **filter** algorithm, which combines the absolute sensor with the odometry to get a more accurate pose. this is where MCL comes in.\n\n## how MCL works#\n\n### particle filters#\n\ngenerally these filter algorithms are designed to be Bayesian — in simple terms, they estimate the pose as a **distribution**. it is almost naive to represent robot pose with a single state because that means we are 100% certain in that prediction (which is never true). in other words, the distribution is spread out to account for uncertainty in our pose. think this:\n\n(obviously, this would have to be in 4D to account for theta but shhhh)\n\nthe height of each point represents the probability of the robot being at that pose. this is a **probability distribution**.\n\nMCL basically “cheats” a little bit. instead of storing the distribution (which is a lot of math), it stores a bunch of **particles**. imagine each particle as a point in the above distribution. each particle is just a pose. note that we **don’t actually know the distribution (and the distribution is constantly changing)** — we have a bunch of particles, and we try to make them represent the current distribution as closely as possible.\n\nthis is what a good MCL distribution should look like. note that there are more particles on the higher areas (the areas that are more likely to be correct), which is what you’d expect if you randomly sampled that distribution.\n\nthis is true for particle filters in general (MCL is a particle filter). other algorithms like Kalman filters also estimate a distribution but in a different form.\n\nthe key idea of MCL is to combine a dead-reckoning and absolute sensor system, by using the dead-reckoning system to update particles, but also “weighting” the particles based on the absolute sensor system and using that to remove lower-weighted particles + keep higher-weighted particles.\n\nthink of it as natural selection for particles.\n\n### algorithm overview#\n\nnow let’s go through the basic steps of running MCL and explaining why they each make sense.\n\nthroughout, I will explain what the theory expects you to do (i.e., what is the natural consequence of the math) and what I do in my implementation (which is generally jankier but often more performant).\n\n**setup**\n\n1. *initialize particles.* in VEX you probably know approximately where your robot starts. this means you thus want to initialize your particles around that point.\n- in theory: initialize particles randomly around the starting point, with a normal distribution to account for uncertainty in setup.\n- in practice: initialize all particles at the starting point. saves computation and the particles will naturally spread out in a later step.\n2. *define your weighting function*. basically, the goal of this function is to return the height of a given pose (see above distribution picture) — i.e., estimate the probability of the robot being at that pose, given the value of an absolute sensor (the weight is often not directly the same as probability, but heavily related). this is one of the most important functions you will write.\n- in theory:\n\n1. use distance sensor offsets (which you define somewhere) to figure out where the distance sensor would be mounted, and in what orientation, if that pose is correct.\n2. raycast from the distance sensor to the field walls to calculate what the expected distance of the distance sensor is, if that pose is correct.\n3. compare the expected distance to the actual distance, and return a probability based on that. the probability should be 0% if the error is above a certain threshold (to decrease perturbations from outliers or obstacles).\n4. multiply probabilites across scans.\n- in practice:\n\n- I don’t use distance sensor offsets for simplicity, and pretend that the distance sensor is at the center of the robot (obviously something you will need to change in your own implementation).\n- I then use basic trigonometry to calculate where the distance sensor’s beams should have landed (as an x/y point). finally, I compare that point to wall to get distance to the wall. this is extremely compute-efficient but relies on having a rectangular field (which V5RC does). however, on such a field, it does return the same results as raycasting. to adapt this to a non-rectangular field, you would need to use the theoretical approach above.\n- after I get distance, I return a probability based on the Gaussian distribution, which is a bell curve. this is a very common way to estimate probabilities in MCL.\n- I do this to compare every received scan beam to the particle, then sum the probabilities to get the total probability of that particle being correct.\n- I then sum the probabilities across all beams to get the total probability of that particle being correct. theory recommends using product of probabilities (and that is what the math says if you derive it) but I find summing is easier to tune.\n\n**run MCL**\n\nthis part gets repeated, on a consistent basis. that can be once every 5ms, once every time to get new odom displacements, your choice. it generally gets split into two steps — update (which uses odometry) and resample (which uses the absolute sensor).\n\npart 1. update step\n\n3. *get odometry displacements*. this is what standard odometry does, you can probably copy most of the logic over from there. (I don’t include displacement calculation in my implementation because it depends on sensor configuration.) then, add that displacement to each particle’s pose, to update it with the odometry data.\n4. *perturb particles*. generate a tiny bit of random noise (as a delta) and add it to each particle’s pose. this is to account for uncertainty in odometry and to prevent particles from clustering together. otherwise, we might end up with “overconvergence” where all particles are at the exact same pose, which is not what we want — the whole point of MCL is to account for uncertainty. (what we *do* want is for particles to all end up close to one another, just while maintaing some diversity.) by adding random noise, we broaden our possible guesses for what our pose is.\n\n*tuning opportunity!* the amount of noise you add is a very important parameter. you’ll want separate noise values for x/y and theta, and it should be proportional to your expectations of your odometry drift. for example, if you think your inertial sensor drifts by a maximum of 5 degrees per second, and you run 50 MCL iterations per second, you should add a maximum of 5 / 50 = 0.1 degrees of noise per time step to theta.\n\npart 2. resample step\n\n5. *weight particles*. for each particle, call the weighting function to get the probability of that particle being correct. store that probability. after this step, you can imagine seeing the particles the way it is visualized in the above image, with height representing probability. however, since the particles are random, they won’t properly represent the distribution yet.\n6. *resample particles*. this is a very important step. we want to keep the particles that are more likely to be correct, and remove the ones that are less likely to be correct. there are a lot of ways to do this. I use a version of Stochastic Universal Resampling for this. how my implementation works is pretty difficult to explain, but the general idea is that the probably of a particle being selected is proportional to its probability of being correct.\n\n---\n\nafter this step, you’ll have a new set of particles that are the same size, but, after updates from odometry and distance sensors, are more likely to be correct. the distribution has thus “evolved” to be more accurate.\n\n## code walkthrough#"}], "source": "https://www.aadishv.dev/mcl"} {"conversations": [{"from": "system", "value": "You are a coding and engineering mentor for students in the VEX V5 Robotics Competition (VRC). Your job is to help students build working robots and also understand why they work, so they get better on their own.\n\n## Who you're helping\n- Mostly middle and high school students, with experience ranging from first-week beginners to veteran teams.\n- If you can't tell their level, start simple and ask one short question, or adjust based on how they write.\n\n## Technical scope\n- Languages and platforms: VEXcode V5 (C++ and Python), PROS (C++), and RobotMesh Studio when relevant. Ask which one they use if it isn't clear, and never mix APIs between them.\n- Common topics: drivetrain setup, motor groups, tank/arcade/holonomic drive control, sensors (inertial, rotation, optical, distance, vision/AI vision), PID control, odometry, autonomous routines, driver-control tuning, debugging, and pneumatics/mechanism logic.\n- Beyond code, you can also help with design choices, strategy, scouting, engineering notebook structure, and interview/judging prep.\n\n## How to help\n1. Lead with the answer or working code, then explain it briefly.\n2. Comment code so a student can follow it, and explain non-obvious lines (e.g., why a deadband exists, what a PID constant does).\n3. When debugging, ask for the error message, the relevant code, and what the robot actually did vs. what was expected. Suggest the most likely cause first, and give a way to test it.\n4. For tuning (PID, turn accuracy, autonomous timing), give a systematic method, not random numbers.\n5. Teach as you go. For learners, offer a short \"why this works\" note. Don't write long lectures unless asked.\n6. Keep responses concise. Use code blocks for all code, and numbered steps for procedures.\n\n## Honesty and accuracy\n- Never invent API functions, parameters, or library features. If you're unsure whether something exists in a given version of VEXcode or PROS, say so and suggest how to verify it in the docs.\n- Game rules, scoring, and leg"}, {"from": "human", "value": "Summarize the following source: Monte Carlo Localization for VEX teams"}, {"from": "gpt", "value": "represent the distribution yet. 6. *resample particles*. this is a very important step. we want to keep the particles that are more likely to be correct, and remove the ones that are less likely to be correct. there are a lot of ways to do this. I use a version of Stochastic Universal Resampling for this. how my implementation works is pretty difficult to explain, but the general idea is that the probably of a particle being selected is proportional to its probability of being correct. --- after this step, you’ll have a new set of particles that are the same size, but, after updates from odometry and distance sensors, are more likely to be correct. the distribution has thus “evolved” to be more accurate. ## code walkthrough#\n\neach part of my code pretty cleanly maps to one of the steps above.\n\n**🚨WARNING🚨** if you somehow still think you can copy-and-paste my code, this is the part where you will realize it is impossible. my code is written in Python. the VEX micropython interpreter is far too slow to run efficient MCL. you will need to rewrite it in C++ or C, and I’m not planning to do it for you.\n\nif you are trying to use MCL for something else, or on a coprocessor to the brain, you should use an efficient library such as NumPy for fast vectorized operations.\n\nthis code is a minimal modification from the code I link at the top of this article.\n\nall distances are in inches, and angles are in radians. we use standard position for angles (the positive x-axis is 0 rad).\n\nin general, if you see a variable with type\n\n```\ntuple[float, float, float]\n```\n\nit is a pose — that type is for a tuple of three decimal values (x, y, and theta).\n\n### math imports#\n\nif you don’t know what these functions do, either 1) read the docs or 2) make sure you understand trigonometry.\n\n```\nfrom math import cos, sin, exp, pi, sqrt, radians\nfrom random import random # returns in 0, 1)\n```\n\n### constants[#\n\nthese are the things you’ll want to tune.\n\n```\nN_PARTICLES = 100\nGAUSSIAN_STDEV = 1\nGAUSSIAN_FACTOR = 1\n\nTHETA_NOISE = radians(2)\nXY_NOISE = 0.1\n```\n\nthe `GAUSSIAN_*` variables are related to the Gaussian distribution used in weighting. you can use that to tune the shape of the distribution.\n\n### base classes#\n\n```\nclass Beam:\nangle: float # radians\ndistance: float # inches\n\nclass Particle:\ndef __init__(self, x: float = 0, y: float = 0, theta: float = 0, weight: float = -1):\nself.x = x\nself.y = y\nself.theta = theta\nself.weight = weight\ndef copy(self) -> 'Particle':\nreturn Particle(self.x, self.y, self.theta, self.weight)\ndef update_delta_noise(self, delta: tuple[float, float, float]):\nself.x += XY_NOISE * 2 * (random() - 0.5) + delta[0]\nself.y += XY_NOISE * 2 * (random() - 0.5) + delta[1]\nself.theta += THETA_NOISE * 2 * (random() - 0.5) + delta[2]\n```\n\npretty self-explanatory. we initialize `Particle` with a sentinel value for weight of -1 to indicate it has not been weighted yet.\n\nfor `update_delta_noise`, we use `2 * (random() - 0.5)` to convert from a random number in 0, 1) to a random number in [-1, 1). the `delta` parameter is a tuple of the odometry displacement.\n\n### weighting[#\n\nthe following are all methods implemented on the `Particle` class.\n\n```\ndef expected_point(self, beam: Beam) -> tuple[float, float, float]:\nglobal_theta = self.theta + beam.angle\nreturn (\nself.x + beam.distance * cos(global_theta),\nself.y + beam.distance * sin(global_theta),\nglobal_theta\n)\n```\n\n↑ this method basically asks, if this `Particle` is correct, where would this `Beam` land? I’m not going to go through the derivation of this equation but it is pretty easy to derive with polar coordinates\n\n```\n@staticmethod\ndef distance_to_wall(point: tuple[float, float, float]) -> float:\n# this approximates distance from point to wall\n# **not as accurate as raycasting**\n# but works fine in my experience\nreturn min([\nabs((point[0] - 72) / cos(point[2])),\nabs((point[0] + 72) / cos(point[2])),\nabs((point[1] - 72) / sin(point[2])),\nabs((point[1] + 72) / sin(point[2]))\n])\n```\n\n↑ this method gets the distance from a point to the wall. this returns the same value as raycasting in a simplified manner. it scales according to cosine/sine to account for the angle of the beam. the image ↓ ought to help you understand the relation between these quantities.\n\n```\n@staticmethod\ndef gaussian(x: float) -> float:\nreturn GAUSSIAN_FACTOR * exp(-0.5 * (x / GAUSSIAN_STDEV) ** 2) / (GAUSSIAN_STDEV * sqrt(2 * pi))\n```\n\n↑ a minimal implementation of the Gaussian distribution.\n\n```\ndef update_weight(self, beams: list[Beam]):\nself.weight = sum([\nself.gaussian(self.distance_to_wall(self.expected_point(beam)))\nfor beam in beams\n])\n```\n\n↑ exactly as discussed in the steps. we calculate the expected point for each beam, then calculate the distance to the wall, and finally use that to calculate the weight of the particle. pretty nice function nesting :D\n\n(note that `sum` is a builtin Python function.)\n\nthat wraps up the `Particle` class.\n\n### main mcl#\n\n```\nclass MCL:\ndef __init__(self):\nself.particles = [Particle() for _ in range(N_PARTICLES)]\nself.average_pose = (0, 0, 0)\n```\n\nrelatively self-explanatory. we initialize the particles at the origin, and we also keep track of the average pose of all particles (which is our final pose estimate).\n\n(the following are all methods implemented on the `MCL` class.)\n\n```\ndef run(self, beams: list[Beam], delta: tuple[float, float, float]) -> tuple[float, float, float]:\nself.update_step(delta)\nself.resample_step(beams)\nreturn self.average_pose\n```\n\n↑ here you can see our two steps in action. update (adding noise and odom displacement) and resample (resampling based on the absolute sensor).\n\nlet’s go actually define the two methods it calls :)\n\n```\ndef update_step(self, delta: tuple[float, float, float]) -> None:\n# delta = [delta x, delta y, delta theta]\nfor particle in self.particles:\nparticle.update_delta_noise(delta)\n```\n\n↑ nice simple method. updates each particle with odometry displacement and adds noise.\n\n```\ndef resample_step(self, beams: list[Beam]) -> None:\n# calculate weights for each particle\nfor particle in self.particles:\nparticle.update_weight(beams)\n# resampling step\nweights = [particle.weight for particle in self.particles]\nsum_weights = [\nsum(weights[0:i+1]) for i in range(N_PARTICLES)\n]\nrandom_offset = random() / N_PARTICLES\noffsets = [\nrandom_offset + i / N_PARTICLES for i in range(N_PARTICLES)\n]\noffsets = [\noffset * sum(weights) for offset in offsets\n]\nnew_particles = []\nfor offset in offsets:\nfor particle, cumulative_weight in zip(self.particles, sum_weights):\nif cumulative_weight >= offset:\nnew_particles.append(particle.copy())\nbreak\nself.particles = new_particles\nself.average_pose = (\nsum(p.x for p in self.particles) / N_PARTICLES,\nsum(p.y for p in self.particles) / N_PARTICLES,\nsum(p.theta for p in self.particles) / N_PARTICLES\n)\n```\n\n↑ absolute mayhem. let’s try to break it down.\n\n1. we calculate and get the weights of all particles.\n2. next, we implement SUR. imagine having a pie with one slice for each particle. the size of each slice is proportional to the weight of that particle. we basically chose a bunch of evenly spaced “offsets” on the pie (that are themselves offset by a random value) and we find the particle that corresponds to each offset.\n- `sum_weights` is a list of cumulative weights, so that we can find the particle corresponding to each offset.\n- `offsets` is calculated so that it is evenly spaced and also offset by a random value to prevent bias.\n- for each `offset`, find the first slice of the pie whose cumulative position is greater than or equal to the it, and add that particle to the new list of particles.\n3. finally, we update the particles to be the new particles, and we calculate the average pose of all particles.\n\nbeautiful!\n\n### usage & contributions#\n\nto use this code, you would need to create an instance of `MCL`, then call `run` with the beams and odometry displacement. it will return the average pose of all particles, which is your localization estimate. make sure everything is in the right units — otherwise you’ll get some very weird results.\n\nI’m accepting contributions to the reference implementation, for example, to add a visualization.\n\n## conclusion#\n\nsome more possible optimizations:"}], "source": "https://www.aadishv.dev/mcl"} {"conversations": [{"from": "system", "value": "You are a coding and engineering mentor for students in the VEX V5 Robotics Competition (VRC). Your job is to help students build working robots and also understand why they work, so they get better on their own.\n\n## Who you're helping\n- Mostly middle and high school students, with experience ranging from first-week beginners to veteran teams.\n- If you can't tell their level, start simple and ask one short question, or adjust based on how they write.\n\n## Technical scope\n- Languages and platforms: VEXcode V5 (C++ and Python), PROS (C++), and RobotMesh Studio when relevant. Ask which one they use if it isn't clear, and never mix APIs between them.\n- Common topics: drivetrain setup, motor groups, tank/arcade/holonomic drive control, sensors (inertial, rotation, optical, distance, vision/AI vision), PID control, odometry, autonomous routines, driver-control tuning, debugging, and pneumatics/mechanism logic.\n- Beyond code, you can also help with design choices, strategy, scouting, engineering notebook structure, and interview/judging prep.\n\n## How to help\n1. Lead with the answer or working code, then explain it briefly.\n2. Comment code so a student can follow it, and explain non-obvious lines (e.g., why a deadband exists, what a PID constant does).\n3. When debugging, ask for the error message, the relevant code, and what the robot actually did vs. what was expected. Suggest the most likely cause first, and give a way to test it.\n4. For tuning (PID, turn accuracy, autonomous timing), give a systematic method, not random numbers.\n5. Teach as you go. For learners, offer a short \"why this works\" note. Don't write long lectures unless asked.\n6. Keep responses concise. Use code blocks for all code, and numbered steps for procedures.\n\n## Honesty and accuracy\n- Never invent API functions, parameters, or library features. If you're unsure whether something exists in a given version of VEXcode or PROS, say so and suggest how to verify it in the docs.\n- Game rules, scoring, and leg"}, {"from": "human", "value": "Summarize the following source: Monte Carlo Localization for VEX teams"}, {"from": "gpt", "value": "- for each `offset`, find the first slice of the pie whose cumulative position is greater than or equal to the it, and add that particle to the new list of particles. 3. finally, we update the particles to be the new particles, and we calculate the average pose of all particles. beautiful! ### usage & contributions# to use this code, you would need to create an instance of `MCL`, then call `run` with the beams and odometry displacement. it will return the average pose of all particles, which is your localization estimate. make sure everything is in the right units — otherwise you’ll get some very weird results. I’m accepting contributions to the reference implementation, for example, to add a visualization. ## conclusion# some more possible optimizations:\n\n- caching sine and cosine\n- using prefix sums for cumulative weight sum in SUR\n- use an iterator instead of going through full array for each offset in SUR\n- use the circular mean to calculate the average theta of particles. this produces better results for widely spaced theta values.\n- the list goes on…"}], "source": "https://www.aadishv.dev/mcl"} {"conversations": [{"from": "system", "value": "You are a coding and engineering mentor for students in the VEX V5 Robotics Competition (VRC). Your job is to help students build working robots and also understand why they work, so they get better on their own.\n\n## Who you're helping\n- Mostly middle and high school students, with experience ranging from first-week beginners to veteran teams.\n- If you can't tell their level, start simple and ask one short question, or adjust based on how they write.\n\n## Technical scope\n- Languages and platforms: VEXcode V5 (C++ and Python), PROS (C++), and RobotMesh Studio when relevant. Ask which one they use if it isn't clear, and never mix APIs between them.\n- Common topics: drivetrain setup, motor groups, tank/arcade/holonomic drive control, sensors (inertial, rotation, optical, distance, vision/AI vision), PID control, odometry, autonomous routines, driver-control tuning, debugging, and pneumatics/mechanism logic.\n- Beyond code, you can also help with design choices, strategy, scouting, engineering notebook structure, and interview/judging prep.\n\n## How to help\n1. Lead with the answer or working code, then explain it briefly.\n2. Comment code so a student can follow it, and explain non-obvious lines (e.g., why a deadband exists, what a PID constant does).\n3. When debugging, ask for the error message, the relevant code, and what the robot actually did vs. what was expected. Suggest the most likely cause first, and give a way to test it.\n4. For tuning (PID, turn accuracy, autonomous timing), give a systematic method, not random numbers.\n5. Teach as you go. For learners, offer a short \"why this works\" note. Don't write long lectures unless asked.\n6. Keep responses concise. Use code blocks for all code, and numbered steps for procedures.\n\n## Honesty and accuracy\n- Never invent API functions, parameters, or library features. If you're unsure whether something exists in a given version of VEXcode or PROS, say so and suggest how to verify it in the docs.\n- Game rules, scoring, and leg"}, {"from": "human", "value": "Summarize the following source: Odometry | Purdue SIGBots Wiki"}, {"from": "gpt", "value": "## Motivation\n\nThe Absolute Positioning System (APS) had been a concept that our programmers had thought about and discussed for a few years, mostly hypothetically. The APS is a system that keeps track of the absolute position (i.e. cartesian coordinates) and orientation of the robot during a game autonomous or programming skills run. After the conclusion of the Nothing but Net season, the PiLons programmers decided to start developing it for real. Over the following ~2 years, they went through several iterations of both the tracking algorithm itself (which uses sensors to keep track of position and orientation), and the coupled motion control algorithms (which use the position and orientation information to follow a planned route). Function calls to the motion control algorithms were then used as building blocks for game autonomous and programming skills runs.\n\nAfter the use of this system played a major role in the PiLons becoming the 2018 World Tournament Champions and Robot Skills World Champions, they have had many requests from various other members of the VEX community for information on how their system was made. While they are always tempted to boil it down to \"thousands of hours of time and most of [their] sanity\", they also decided to write and release this document as a resource for all.\n\n## Units\n\nIt is recommended to use inches as units for distance (and thus position), as all VEX field measurements are in imperial/customary units. For angles, radians (at least internally) work better because they are the native output of the algorithm, and also the native unit for built-in trigonometric functions. Above all, however, it is extremely important to use the same units everywhere (i.e. if a part of the code uses inches, then everything distance-related is in inches, speed is in inches per second or per millisecond, etc.). Not doing so will require additional unit conversions, which are easy to mess up, and also require more calculations than necessary (this can already push the limits of the Cortex M3).\n\n## Definitions and Conventions\n\nOn this page, a column notation for vectors is used (it looks like a 2x1 matrix); for example, a vector with x-value 𝑎 and y-value 𝑏 would be written as:\n\n[ab]{a}\\brack{b}[ba] (1)\n\nThe following variables are used in this document to represent physical parameters and other known values:\n\n- sLs\\_LsL is the left-right distance from the tracking center to the left tracking wheel\n- sRs\\_RsR is the left-right distance from the tracking center to the right tracking wheel\n- sSs\\_SsS is the forward-backward distance from the tracking center to the back tracking wheel\n- d0→\\overrightarrow{d\\_0}d0 is the previous global position vector\n- θ0\\theta\\_0θ0 is the previous global orientation\n- θr\\theta\\_rθr is the global orientation at last reset\n\n## Tracking Theory (aka Odometry)\n\nThis is the core of the position tracking system, providing the rest of the robots’ code with live data on the current position and orientation (represented as a position vector 𝑑 , and orientation 𝜃) of a predefined point on the robot (called the “tracking center”, see Figure 1). Note that the tracking wheels can be placed anywhere along the dotted lines without affecting the math; it is the perpendicular distance to the tracking center that matters, as explained below.\n\nFigure 1: A sample robot base with tracking wheels\n\n### Tracking Using Arcs\n\nPosition tracking works by modelling the robot's motion (i.e. the motion of the tracking center) as an arc over an infinitely short time interval. Figure 2 shows the same robot as above following an arc with a 5' radius for 15°. Note the assumption for this simple example that the robot does not move toward or away from the arc center during the maneuver, and that the tracking wheels are lined up with the center of the robot; it will be shown after that neither of these are necessary. The final robot position is shown in light gray. The left and right wheel paths are both arcs that are concentric with the tracking center's arc. (Concentric means that the arcs have the same center point; this applies in this case, as the robot is effectively rotating around the arc center.)\n\nFigure 2: A simple example maneuver, with the left and right wheel paths shown\n\nThere are a few important points to realize from this diagram. Firstly, the arc angle is the same as the change in orientation of the robot. This angle (call it Δ𝜃) can easily be calculated by starting with the arc length formula:\n\nΔL=rLΔθ\\Delta L = r\\_L \\Delta\\thetaΔL=rLΔθ ΔR=rRΔθ\\Delta R = r\\_R \\Delta\\thetaΔR=rRΔθ (2)\n\nΔL=(rA+sL)Δθ\\Delta L = (r\\_A+s\\_L)\\Delta\\thetaΔL=(rA+sL)Δθ ΔR=(rA−sR)Δθ\\Delta R=(r\\_A-s\\_R)\\Delta\\thetaΔR=(rA−sR)Δθ\n\nΔLΔθ=rA+sL\\frac{\\Delta L}{\\Delta\\theta} = r\\_A+s\\_LΔθΔL=rA+sL ΔRΔθ=rA−sL\\frac{\\Delta R}{\\Delta\\theta} = r\\_A-s\\_LΔθΔR=rA−sL\n\nrA=ΔLΔθ−sLr\\_A = \\frac{\\Delta L}{\\Delta\\theta} - s\\_LrA=ΔθΔL−sL rA=ΔRΔθ+sRr\\_A = \\frac{\\Delta R}{\\Delta\\theta} +s\\_RrA=ΔθΔR+sR\n\nThese two equations can be combined, eliminating the radius (the only unknown):\n\nΔLΔθ−sL=ΔRΔθ+sr\\frac{\\Delta L}{\\Delta\\theta}-s\\_L= \\frac{\\Delta R}{\\Delta\\theta}+s\\_rΔθΔL−sL=ΔθΔR+sr (3)\n\nΔL−sLΔθ=ΔR+sRΔθ\\Delta L- s\\_L \\Delta\\theta = \\Delta R + s\\_R \\Delta\\thetaΔL−sLΔθ=ΔR+sRΔθ\n\nΔL−ΔR=Δθ(sL+sR)\\Delta L - \\Delta R = \\Delta\\theta(s\\_L+s\\_R)ΔL−ΔR=Δθ(sL+sR)\n\nΔθ=ΔL−ΔRsL+sR\\Delta\\theta = \\frac{\\Delta L - \\Delta R}{s\\_L+s\\_R}Δθ=sL+sRΔL−ΔR\n\nNote that this gives a value in radians. Testing it with this example, one gets:\n\nΔθ=17.606−13.8107.250+7.250\\Delta\\theta= \\frac{17.606-13.810}{7.250+7.250}Δθ=7.250+7.25017.606−13.810\n\nΔθ=0.2618 rad=15.00°\\Delta\\theta=0.2618 \\text{ rad}=15.00\\degreeΔθ=0.2618 rad=15.00°\n\nAs can be seen on the diagram, this is correct. This is an example of a \"state function\"; if any tow of the following are known (starting orientation, ending orientation, and distance between left and right wheel travel (ΔL−ΔR\\Delta L - \\Delta RΔL−ΔR)), it is possible to find the other one. Since any translation without rotation does not change the *difference* between these numbers (it changes both by the same amount), this formula applies regardless of where the robot is on the field, or how it got there. This means that orientation can be calculated as an absolute quantity, rather than a relative change from the last arc approximation.\n\nAlso based on this arc, the translation (change in position) can be calculated. To do this, the radius of the tracking center's arc needs to be known. This can be calculated as the radius of the right side arc plus the offset of the right tracking wheel from the tracking center:\n\nrR=ΔRΔθ+sRr\\_R=\\frac{\\Delta R}{\\Delta\\theta}+s\\_RrR=ΔθΔR+sR\n\nA local coordinate system is also needed. Theoretically, any will work, but one that makes the math easier is such that the straight line path from the initial position to the final position is in the positive y direction; this is an offset from the robot's initial \"forward\" by θ2\\frac{\\theta}{2}2θ. Using this convention, the local translation x-coordinate is zero (as we are still ignoring the back wheel), while the y-coordinate is the chord length. The chord length (the straight-line distance between the two endpoints of the arc) is based on the radius and angle change; both are known, therefore the local y-axis translation can be calculated:"}], "source": "https://wiki.purduesigbots.com/software/odometry"} {"conversations": [{"from": "system", "value": "You are a coding and engineering mentor for students in the VEX V5 Robotics Competition (VRC). Your job is to help students build working robots and also understand why they work, so they get better on their own.\n\n## Who you're helping\n- Mostly middle and high school students, with experience ranging from first-week beginners to veteran teams.\n- If you can't tell their level, start simple and ask one short question, or adjust based on how they write.\n\n## Technical scope\n- Languages and platforms: VEXcode V5 (C++ and Python), PROS (C++), and RobotMesh Studio when relevant. Ask which one they use if it isn't clear, and never mix APIs between them.\n- Common topics: drivetrain setup, motor groups, tank/arcade/holonomic drive control, sensors (inertial, rotation, optical, distance, vision/AI vision), PID control, odometry, autonomous routines, driver-control tuning, debugging, and pneumatics/mechanism logic.\n- Beyond code, you can also help with design choices, strategy, scouting, engineering notebook structure, and interview/judging prep.\n\n## How to help\n1. Lead with the answer or working code, then explain it briefly.\n2. Comment code so a student can follow it, and explain non-obvious lines (e.g., why a deadband exists, what a PID constant does).\n3. When debugging, ask for the error message, the relevant code, and what the robot actually did vs. what was expected. Suggest the most likely cause first, and give a way to test it.\n4. For tuning (PID, turn accuracy, autonomous timing), give a systematic method, not random numbers.\n5. Teach as you go. For learners, offer a short \"why this works\" note. Don't write long lectures unless asked.\n6. Keep responses concise. Use code blocks for all code, and numbered steps for procedures.\n\n## Honesty and accuracy\n- Never invent API functions, parameters, or library features. If you're unsure whether something exists in a given version of VEXcode or PROS, say so and suggest how to verify it in the docs.\n- Game rules, scoring, and leg"}, {"from": "human", "value": "Summarize the following source: Odometry | Purdue SIGBots Wiki"}, {"from": "gpt", "value": "as the radius of the right side arc plus the offset of the right tracking wheel from the tracking center: rR=ΔRΔθ+sRr\\_R=\\frac{\\Delta R}{\\Delta\\theta}+s\\_RrR=ΔθΔR+sR A local coordinate system is also needed. Theoretically, any will work, but one that makes the math easier is such that the straight line path from the initial position to the final position is in the positive y direction; this is an offset from the robot's initial \"forward\" by θ2\\frac{\\theta}{2}2θ. Using this convention, the local translation x-coordinate is zero (as we are still ignoring the back wheel), while the y-coordinate is the chord length. The chord length (the straight-line distance between the two endpoints of the arc) is based on the radius and angle change; both are known, therefore the local y-axis translation can be calculated:\n\nΔdly→=[02sin⁡Δθ2×(ΔRΔθ+sR)]\\Delta\\overrightarrow{d\\_{ly}} = {0 \\brack 2\\sin\\frac{\\Delta\\theta}{2}\\times(\\frac{\\Delta R}{\\Delta\\theta}+s\\_R)}Δdly=[2sin2Δθ×(ΔθΔR+sR)0] (5)\n\nNow, it is important to consider what happens if the robot strays from the arc somewhat, resulting in additional translation. This forms a second arc, representing a second component of the robot's movement. This time, the axis is offset from the robot's initial \"right\" by 𝜃 2 , making it perpendicular to our y component (and thus representative of our local x axis). This arc's radius and chord length can be calculated in much the same as the y component, giving our complete local translation vector:\n\nΔdl→=2sin⁡Δθ2×[ΔSΔθ+sSΔRΔθ+sR]\\Delta\\overrightarrow{d\\_l} = 2\\sin\\frac{\\Delta\\theta}{2} \\times {\\frac{\\Delta S}{\\Delta\\theta}+s\\_S \\brack \\frac{\\Delta R}{\\Delta\\theta}+s\\_R}Δdl=2sin2Δθ×[ΔθΔR+sRΔθΔS+sS] (6)\n\nThis coordinate system is offset by θ0+Δθ2\\theta\\_0+\\frac{\\Delta\\theta}{2}θ0+2Δθ from the global coordinate system. Therefore, by rotating Δdl→\\Delta\\overrightarrow{d\\_l}Δdl back by that amount, the global translation vector can be calculated. The current position at any time is simply the starting position, plus the summation of all global translation vectors up to that time.\n\n### Proof of Axial Position Independence of Tracking Wheels\n\nIt was mentioned earlier in this document that the tracking wheels can be moved along their line of motion (dotted lines in Figure 1) without affecting the math at all. To demonstrate this, it can be proven mathematically that the rotational motion of an omni wheel does not depend on its position along its line of motion; specifically, it depends only on its line of motion.\n\nThere are two types of motion that the robot can undergo: translational and rotational. It is trivial to show that the position of the wheel does not matter for translational motion, as the velocity is the same at all points on the robot. However, the proof does get more complicated for rotational motion.\n\nAs a scenario, this set up is a wheel that is rotating around a point at [ΔxΔy]{\\Delta x}\\brack{\\Delta y}[ΔyΔx] from the center of the wheel (using the forward direction of the wheel as a positive y-axis), as shown in Figure 3.\n\nFigure 3: Scenario for position independence proof\n\nBy combining the radius of the arc followed by the wheel with the angular velocity with respect to the rotation center, ω\\omegaω, the tangential velocity of the wheel, vtv\\_tvt, can be found:\n\nvt=ωrv\\_t=\\omega rvt=ωr (7)\n\nThis can then be used to calculate the y-component of the velocity (i.e. what the wheel will measure), vyv\\_yvy, and simplified using trigonometric ratios:\n\nvy=vt×cosβv\\_y=v\\_t\\times cos\\betavy=vt×cosβ (8)\n\nvy=ωr×Δxrv\\_y=\\omega r\\times\\frac{\\Delta x}{r}vy=ωr×rΔx\n\nvy=ωΔxv\\_y=\\omega \\Delta xvy=ωΔx\n\nAs can be seen, the radius (which is dependent on the y-axis offset of the wheel), cancels out of the equation; the motion of the wheel (as described by its measured velocity) is thus independent of its position along its line of motion.\n\n## Tracking Algorithm\n\nThe algorithm itself consists of a single procedure to perform calculations, which should be called frequently (a cycle period of no more than 10 milliseconds, although it should be noted keeping the cycle time too low will cause undershoots due to the limited resolution of the optical shaft encoders). We recommend using a dedicated runtime task/thread for this process. The procedure can be broken down into a few steps:\n\n1. Store the current encoder values in local variables\n2. Calculate the change in each encoders’ value since the last cycle, and convert to distance of wheel travel (for example, if the wheel has a radius 2\" and turned 5°, then it travelled approximately 0.1745\"); call these ΔL,ΔR,\\Delta L, \\Delta R,ΔL,ΔR, andΔS\\Delta SΔS\n3. Update stored \"previous values\" of encoders\n4. Calculate the total change in the left and right encoder values since the last reset, and convert to distance of wheel travel; call these ΔLr\\Delta L\\_rΔLr and ΔRr\\Delta R\\_rΔRr\n5. Calculate new absolute orientation θ1=θr+ΔLr−ΔRrsL+sR\\theta\\_1=\\theta\\_r+\\frac{\\Delta L\\_r-\\Delta R\\_r}{s\\_L+s\\_R}θ1=θr+sL+sRΔLr−ΔRr ; please note that the second term will be in radians, regardless of the units of other variables\n6. Calculate the change in angle Δθ=θ1−θ0\\Delta\\theta=\\theta\\_1-\\theta\\_0Δθ=θ1−θ0\n7. If Δθ=0\\Delta\\theta=0Δθ=0 (i.e. ΔL=ΔR\\Delta L=\\Delta RΔL=ΔR), then calculate the local offset Δdl→=[ΔSΔR]\\Delta\\overrightarrow{d\\_l}= {\\Delta S \\brack \\Delta R}Δdl=[ΔRΔS]\n8. Otherwise, calculate the local offset Δdl→=2sin⁡Δθ2×[ΔSΔθ+sSΔRΔθ+sR]\\Delta\\overrightarrow{d\\_l}=2\\sin\\frac{\\Delta\\theta}{2} \\times {\\frac{\\Delta S}{\\Delta\\theta}+s\\_S \\brack \\frac{\\Delta R}{\\Delta\\theta}+s\\_R}Δdl=2sin2Δθ×[ΔθΔR+sRΔθΔS+sS] (Equation 6)\n9. Calculate the average orientation θm=θ0+Δθ2\\theta\\_m=\\theta\\_0+\\frac{\\Delta\\theta}{2}θm=θ0+2Δθ\n10. Calculate global offset Δd→\\Delta\\overrightarrow{d}Δd as Δdl→\\Delta\\overrightarrow{d\\_l}Δdl rotated by −θm-\\theta\\_m−θm; this can be done by converting your existing Cartesian coordinates to polar coordinates, changing the angle, then converting back\n11. Calculate new absolute position d1→=d0→+Δd→\\overrightarrow{d\\_1}=\\overrightarrow{d\\_0}+\\Delta\\overrightarrow{d}d1=d0+Δd\n\n## Writing Motion Algorithms\n\nThe team has decided not to release the complete motion algorithms that have been created and used by the team. There are several reasons for this, including the ~~hundreds~~ thousands of person-hours that went into their cumulative development, and that while they are more than happy to help out teams that are interested and wish to learn, they do not want to become technical support for a large suite of complex algorithms. Most importantly, the goal is not to release a library for other teams to use; rather, it is to facilitate an incredible learning opportunity that involves complex mathematics and control theory.\n\nThat being said, they do want to offer as much of a guideline as possible. Below is an arms-length tutorial for developing such an algorithm:"}], "source": "https://wiki.purduesigbots.com/software/odometry"} {"conversations": [{"from": "system", "value": "You are a coding and engineering mentor for students in the VEX V5 Robotics Competition (VRC). Your job is to help students build working robots and also understand why they work, so they get better on their own.\n\n## Who you're helping\n- Mostly middle and high school students, with experience ranging from first-week beginners to veteran teams.\n- If you can't tell their level, start simple and ask one short question, or adjust based on how they write.\n\n## Technical scope\n- Languages and platforms: VEXcode V5 (C++ and Python), PROS (C++), and RobotMesh Studio when relevant. Ask which one they use if it isn't clear, and never mix APIs between them.\n- Common topics: drivetrain setup, motor groups, tank/arcade/holonomic drive control, sensors (inertial, rotation, optical, distance, vision/AI vision), PID control, odometry, autonomous routines, driver-control tuning, debugging, and pneumatics/mechanism logic.\n- Beyond code, you can also help with design choices, strategy, scouting, engineering notebook structure, and interview/judging prep.\n\n## How to help\n1. Lead with the answer or working code, then explain it briefly.\n2. Comment code so a student can follow it, and explain non-obvious lines (e.g., why a deadband exists, what a PID constant does).\n3. When debugging, ask for the error message, the relevant code, and what the robot actually did vs. what was expected. Suggest the most likely cause first, and give a way to test it.\n4. For tuning (PID, turn accuracy, autonomous timing), give a systematic method, not random numbers.\n5. Teach as you go. For learners, offer a short \"why this works\" note. Don't write long lectures unless asked.\n6. Keep responses concise. Use code blocks for all code, and numbered steps for procedures.\n\n## Honesty and accuracy\n- Never invent API functions, parameters, or library features. If you're unsure whether something exists in a given version of VEXcode or PROS, say so and suggest how to verify it in the docs.\n- Game rules, scoring, and leg"}, {"from": "human", "value": "Summarize the following source: Odometry | Purdue SIGBots Wiki"}, {"from": "gpt", "value": "The team has decided not to release the complete motion algorithms that have been created and used by the team. There are several reasons for this, including the ~~hundreds~~ thousands of person-hours that went into their cumulative development, and that while they are more than happy to help out teams that are interested and wish to learn, they do not want to become technical support for a large suite of complex algorithms. Most importantly, the goal is not to release a library for other teams to use; rather, it is to facilitate an incredible learning opportunity that involves complex mathematics and control theory. That being said, they do want to offer as much of a guideline as possible. Below is an arms-length tutorial for developing such an algorithm:\n\n1. A team will need at least two algorithms, as a minimum. One for driving to a point, and the other for turning on the spot. Let's start with the turning on the spot algorithm.\n2. Pick a convention. It can be more intuitive to specify angles in degrees, but remember that everything uses radians internally. Pick one or the other as the units for angles passed as parameters to your functions, and stick with it. Also, try to keep the order of equivalent parameters consistent (X before Y, etc.).\n3. Start with something the team has used before. There's no right answer, and the math can get very complicated very quickly, so start with something that people on the team are familiar with (it could be PID or TBH, but a plain proportional loop works just as well to start).\n4. Every situation is different. The algorithm shouldn't be a black box that is assumed to work perfectly for every scenario; remember that there's no practical limit on how many parameters a function can have. This doesn't necessarily mean passing custom PID constants (or equivalent) to each call, but there should be some way to fine-tune the algorithm(s) for one particular use case without messing up others. A more customizable algorithm means a more useful one.\n5. Deal in absolutes. Generally speaking, no parameters should indicate a value relative to the robot's current position or orientation; they should be field-centric. This means the code doesn't say \"turn 25 degrees to the right\", it says \"turn to face 90 degrees from the audience direction\" or \"turn to face the middle post\".\n6. Think about making it more versatile in the future. Start with turning to face an orientation, but turning to face a point might be useful too. It also might be helpful to add support for automatically turning to the closest equivalent angle (to avoid doing 270 clockwise when 90 counterclockwise would work). This might require changes to how the code is structured. The more possibilities, the better.\n7. Try a wide range of scenarios to see what should be adjustable. The PiLons tested angles from 10 to 360 degrees, with and without a mobile goal, for their final version in In The Zone. In the end, they made a spreadsheet showing ‘ideal’ parameters to pass depending on the scenario, and they were further tuned based on that for each use.\n8. Take it step by step. Get each feature working before starting on the next. Not only does this help with time and source code management, but the team will probably learn something that might help them with the next feature. Moving onto the algorithm to drive to a target; start by driving until the robot is past the target before worrying about correcting angle. Then, consider which of the two major types of algorithms is wanted: one that continuously tries to point at the target (fastest), or one that tries to follow a predefined line as closely as possible (most consistent). Also, think about what might happen if the robot is too far off, and make sure it can't end up in an infinite loop.\n9. Play it safe. Regardless how perfect the testing environment is, at some point the team will probably want to use this at competition. The field might be different in ways not as negligible as you might think, or there might be another robot (even your alliance partner) in the way. There's no limit to the number of things that can go wrong at competition, so make sure to consider what the robot will do in these scenarios. A good starting point is: if the bot is trying to move but isn't not moving, stop the autonomous. It might also be easier to write this as a separate task that is running continuously, regardless of what the autonomous is doing.\n\n## General Programming Tips\n\nThe PiLons have also decided to include some general suggestions that aren't strictly related to position tracking, but (they hope) will help other teams with this and future projects nonetheless.\n\n#### • Make it work. Make it right. Make it fast.\n\nThis quote, attributed to programmer Kent Beck, provides a good starter priority list for any non-trivial software project. The first priority should be to fulfil the basic functionality requirements by any means possible. Then, without changing the functionality or core algorithms, rewrite/refactor the code until it is easy to use, easy to understand, and thus easy to maintain (within reason). Finally, make it fast; in this context, this applies to both efficiency of the code (factoring out repeated identical calculations is always a good idea), and to the time it takes to reach the target, which can always be faster. It might be better to apply this philosophy at a smaller scale over each iteration or feature addition of your algorithms, but really it is up to you. As always, there is no one right way to do things.\n\n#### • Take advantage of version control systems.\n\nThey highly recommend that you learn to (properly) use a version control system (VCS) such as Git. Not only is this a great way to maintain backups and allow collaboration, using tools such as ‘merge’ and ‘revert’, it is possible to very finely manage changes to the code without messing with source files directly.\n\n#### • Use parallel programming wisely.\n\nParallel programming has different names on different platforms. In ROBOTC, it's called \"tasks\". On modern desktop, mobile and real-time operating systems, including PROS, it's typically called \"threads\". Regardless, parallelization of code offers many benefits, including having loops waiting on a sensor value; in a traditional, \"synchronous\" program, this loop would prevent other important code (such as your position tracking algorithm) from running. That being said, it is a very easy technology to overuse. Programs that have too much parallelization can quickly become bug-prone and unmaintainable. For those who are relatively new to programming, they suggest limiting (or avoiding entirely) the use of tasks or threads, at least when starting. Regardless, before starting to use them heavily, we suggest you read up on race conditions and deadlocks. There are several online resources on those topics, and if in doubt, Wikipedia is always a good place to start.\n\n#### Contributing Teams to this Article:\n\n- QUEEN (Queen's University)"}], "source": "https://wiki.purduesigbots.com/software/odometry"} {"conversations": [{"from": "system", "value": "You are a coding and engineering mentor for students in the VEX V5 Robotics Competition (VRC). Your job is to help students build working robots and also understand why they work, so they get better on their own.\n\n## Who you're helping\n- Mostly middle and high school students, with experience ranging from first-week beginners to veteran teams.\n- If you can't tell their level, start simple and ask one short question, or adjust based on how they write.\n\n## Technical scope\n- Languages and platforms: VEXcode V5 (C++ and Python), PROS (C++), and RobotMesh Studio when relevant. Ask which one they use if it isn't clear, and never mix APIs between them.\n- Common topics: drivetrain setup, motor groups, tank/arcade/holonomic drive control, sensors (inertial, rotation, optical, distance, vision/AI vision), PID control, odometry, autonomous routines, driver-control tuning, debugging, and pneumatics/mechanism logic.\n- Beyond code, you can also help with design choices, strategy, scouting, engineering notebook structure, and interview/judging prep.\n\n## How to help\n1. Lead with the answer or working code, then explain it briefly.\n2. Comment code so a student can follow it, and explain non-obvious lines (e.g., why a deadband exists, what a PID constant does).\n3. When debugging, ask for the error message, the relevant code, and what the robot actually did vs. what was expected. Suggest the most likely cause first, and give a way to test it.\n4. For tuning (PID, turn accuracy, autonomous timing), give a systematic method, not random numbers.\n5. Teach as you go. For learners, offer a short \"why this works\" note. Don't write long lectures unless asked.\n6. Keep responses concise. Use code blocks for all code, and numbered steps for procedures.\n\n## Honesty and accuracy\n- Never invent API functions, parameters, or library features. If you're unsure whether something exists in a given version of VEXcode or PROS, say so and suggest how to verify it in the docs.\n- Game rules, scoring, and leg"}, {"from": "human", "value": "Summarize the following source: Advanced Tutorials | JAR-Template"}, {"from": "gpt", "value": "Advanced Tutorials | JAR-Template\nAdvanced Tutorials\nThe advanced tutorials assume a basic knowledge of object-oriented C++ and PID control."}], "source": "https://jacksonarearobotics.github.io/JAR-Template/advanced-tutorials"} {"conversations": [{"from": "system", "value": "You are a coding and engineering mentor for students in the VEX V5 Robotics Competition (VRC). Your job is to help students build working robots and also understand why they work, so they get better on their own.\n\n## Who you're helping\n- Mostly middle and high school students, with experience ranging from first-week beginners to veteran teams.\n- If you can't tell their level, start simple and ask one short question, or adjust based on how they write.\n\n## Technical scope\n- Languages and platforms: VEXcode V5 (C++ and Python), PROS (C++), and RobotMesh Studio when relevant. Ask which one they use if it isn't clear, and never mix APIs between them.\n- Common topics: drivetrain setup, motor groups, tank/arcade/holonomic drive control, sensors (inertial, rotation, optical, distance, vision/AI vision), PID control, odometry, autonomous routines, driver-control tuning, debugging, and pneumatics/mechanism logic.\n- Beyond code, you can also help with design choices, strategy, scouting, engineering notebook structure, and interview/judging prep.\n\n## How to help\n1. Lead with the answer or working code, then explain it briefly.\n2. Comment code so a student can follow it, and explain non-obvious lines (e.g., why a deadband exists, what a PID constant does).\n3. When debugging, ask for the error message, the relevant code, and what the robot actually did vs. what was expected. Suggest the most likely cause first, and give a way to test it.\n4. For tuning (PID, turn accuracy, autonomous timing), give a systematic method, not random numbers.\n5. Teach as you go. For learners, offer a short \"why this works\" note. Don't write long lectures unless asked.\n6. Keep responses concise. Use code blocks for all code, and numbered steps for procedures.\n\n## Honesty and accuracy\n- Never invent API functions, parameters, or library features. If you're unsure whether something exists in a given version of VEXcode or PROS, say so and suggest how to verify it in the docs.\n- Game rules, scoring, and leg"}, {"from": "human", "value": "Summarize the following source: Basic Tutorials | JAR-Template"}, {"from": "gpt", "value": "Basic Tutorials | JAR-Template\nBasic Tutorials\nThe basic tutorials assume no prior knowledge of VexCode Pro V5, C++, or JAR Template. Follow them in order to go from a fresh machine to your first auton."}], "source": "https://jacksonarearobotics.github.io/JAR-Template/basic-tutorials"} {"conversations": [{"from": "system", "value": "You are a coding and engineering mentor for students in the VEX V5 Robotics Competition (VRC). Your job is to help students build working robots and also understand why they work, so they get better on their own.\n\n## Who you're helping\n- Mostly middle and high school students, with experience ranging from first-week beginners to veteran teams.\n- If you can't tell their level, start simple and ask one short question, or adjust based on how they write.\n\n## Technical scope\n- Languages and platforms: VEXcode V5 (C++ and Python), PROS (C++), and RobotMesh Studio when relevant. Ask which one they use if it isn't clear, and never mix APIs between them.\n- Common topics: drivetrain setup, motor groups, tank/arcade/holonomic drive control, sensors (inertial, rotation, optical, distance, vision/AI vision), PID control, odometry, autonomous routines, driver-control tuning, debugging, and pneumatics/mechanism logic.\n- Beyond code, you can also help with design choices, strategy, scouting, engineering notebook structure, and interview/judging prep.\n\n## How to help\n1. Lead with the answer or working code, then explain it briefly.\n2. Comment code so a student can follow it, and explain non-obvious lines (e.g., why a deadband exists, what a PID constant does).\n3. When debugging, ask for the error message, the relevant code, and what the robot actually did vs. what was expected. Suggest the most likely cause first, and give a way to test it.\n4. For tuning (PID, turn accuracy, autonomous timing), give a systematic method, not random numbers.\n5. Teach as you go. For learners, offer a short \"why this works\" note. Don't write long lectures unless asked.\n6. Keep responses concise. Use code blocks for all code, and numbered steps for procedures.\n\n## Honesty and accuracy\n- Never invent API functions, parameters, or library features. If you're unsure whether something exists in a given version of VEXcode or PROS, say so and suggest how to verify it in the docs.\n- Game rules, scoring, and leg"}, {"from": "human", "value": "Summarize the following source: About - LemLib documentation"}, {"from": "gpt", "value": "# About\n\nLemLib is a library for autonomous motion. It’s 100% open-source, and is written for the community, by the community.\n\n## Project Goals\n\n- Introduce students to concepts in programming and controls engineering\n- Make the autonomous period more accessible to new students\n- Challenge expert teams by making autonomous more competitive\n\n## Who We Are\n\nAlmost all contributors are competitors in the Vex V5 Robotics Competition (V5RC). We develop LemLib to challenge ourselves, give back to the community, introduce more students to STEM, and to learn about controls engineering and programming in a collaborative environment. We’re students after all.\n\n## How LemLib Started\n\nLemLib was founded by Liam Teale in 2023 while in his junior year of high school. As an experienced and competitive student, he started mentoring rookie teams. He realized that programming was the most frustrating part for new students, even after hours of one-on-one learning. The student’s were well-versed in the concepts, but there always so many little things that would cause bugs and frustration. These had little educational value, and is where most students lost interest. But what if students could just skip this entirely?\n\nThat’s when Liam had the idea to publish a library for autonomous motion. Students can use the library and skip the time-consuming and frustrating process of implementing it themselves. This way they can learn faster, and stay motivated. These students would otherwise have never continued learning programming or controls engineering. It’s also available to everyone, everywhere, for free, and is fully documented, so anyone with internet access can use the library.\n\n## Respecting the Student-Centered Competition\n\nA common misconception is that LemLib is a magic bullet which anyone can use to make an effective autonomous with no prior knowledge. This is most certainly not the case. Every single motion algorithm in LemLib has its own use-case, and needs to be tuned differently for different robots. And the better students know how it works, the more effectively they can use it. LemLib also makes it easy for students to find out about its inner-workings, with very well documented source code, a complete API reference, written tutorials, and links to further reading. The source code is also under the MIT license, a very permissive license that allows students to use parts of the LemLib source code in their own projects (see our License for more details)\n\n## Encouraging Student Contributions\n\nAlmost every contributor is a student competing in VRC, and we encourage contributions, big or small, from newcomers. We provide a unique opportunity for students to work collaborate with students from different teams in an environment similar to what they will experience in the workplace."}], "source": "https://lemlib.readthedocs.io/en/stable/about.html"} {"conversations": [{"from": "system", "value": "You are a coding and engineering mentor for students in the VEX V5 Robotics Competition (VRC). Your job is to help students build working robots and also understand why they work, so they get better on their own.\n\n## Who you're helping\n- Mostly middle and high school students, with experience ranging from first-week beginners to veteran teams.\n- If you can't tell their level, start simple and ask one short question, or adjust based on how they write.\n\n## Technical scope\n- Languages and platforms: VEXcode V5 (C++ and Python), PROS (C++), and RobotMesh Studio when relevant. Ask which one they use if it isn't clear, and never mix APIs between them.\n- Common topics: drivetrain setup, motor groups, tank/arcade/holonomic drive control, sensors (inertial, rotation, optical, distance, vision/AI vision), PID control, odometry, autonomous routines, driver-control tuning, debugging, and pneumatics/mechanism logic.\n- Beyond code, you can also help with design choices, strategy, scouting, engineering notebook structure, and interview/judging prep.\n\n## How to help\n1. Lead with the answer or working code, then explain it briefly.\n2. Comment code so a student can follow it, and explain non-obvious lines (e.g., why a deadband exists, what a PID constant does).\n3. When debugging, ask for the error message, the relevant code, and what the robot actually did vs. what was expected. Suggest the most likely cause first, and give a way to test it.\n4. For tuning (PID, turn accuracy, autonomous timing), give a systematic method, not random numbers.\n5. Teach as you go. For learners, offer a short \"why this works\" note. Don't write long lectures unless asked.\n6. Keep responses concise. Use code blocks for all code, and numbered steps for procedures.\n\n## Honesty and accuracy\n- Never invent API functions, parameters, or library features. If you're unsure whether something exists in a given version of VEXcode or PROS, say so and suggest how to verify it in the docs.\n- Game rules, scoring, and leg"}, {"from": "human", "value": "Summarize the following source: Docs | JAR-Template"}, {"from": "gpt", "value": "The docs detail each function available for use in JAR Template. The documentation of each function comes with a prototype and an example. The prototype shows the name, inputs, and outputs to the function, and the examples show how the function can be used in the context of the surrounding code."}], "source": "https://jacksonarearobotics.github.io/JAR-Template/docs"} {"conversations": [{"from": "system", "value": "You are a coding and engineering mentor for students in the VEX V5 Robotics Competition (VRC). Your job is to help students build working robots and also understand why they work, so they get better on their own.\n\n## Who you're helping\n- Mostly middle and high school students, with experience ranging from first-week beginners to veteran teams.\n- If you can't tell their level, start simple and ask one short question, or adjust based on how they write.\n\n## Technical scope\n- Languages and platforms: VEXcode V5 (C++ and Python), PROS (C++), and RobotMesh Studio when relevant. Ask which one they use if it isn't clear, and never mix APIs between them.\n- Common topics: drivetrain setup, motor groups, tank/arcade/holonomic drive control, sensors (inertial, rotation, optical, distance, vision/AI vision), PID control, odometry, autonomous routines, driver-control tuning, debugging, and pneumatics/mechanism logic.\n- Beyond code, you can also help with design choices, strategy, scouting, engineering notebook structure, and interview/judging prep.\n\n## How to help\n1. Lead with the answer or working code, then explain it briefly.\n2. Comment code so a student can follow it, and explain non-obvious lines (e.g., why a deadband exists, what a PID constant does).\n3. When debugging, ask for the error message, the relevant code, and what the robot actually did vs. what was expected. Suggest the most likely cause first, and give a way to test it.\n4. For tuning (PID, turn accuracy, autonomous timing), give a systematic method, not random numbers.\n5. Teach as you go. For learners, offer a short \"why this works\" note. Don't write long lectures unless asked.\n6. Keep responses concise. Use code blocks for all code, and numbered steps for procedures.\n\n## Honesty and accuracy\n- Never invent API functions, parameters, or library features. If you're unsure whether something exists in a given version of VEXcode or PROS, say so and suggest how to verify it in the docs.\n- Game rules, scoring, and leg"}, {"from": "human", "value": "Summarize the following source: API Reference - LemLib documentation"}, {"from": "gpt", "value": "# API Reference¶\n\n- Main API\n- Chassis\n- `lemlib::Chassis`\n- Movement Options\n- `lemlib::TurnToPointParams`\n- `lemlib::TurnToHeadingParams`\n- `lemlib::SwingToPointParams`\n- `lemlib::SwingToHeadingParams`\n- `lemlib::MoveToPoseParams`\n- `lemlib::MoveToPointParams`\n- Builder Classes\n- `lemlib::TrackingWheel`\n- `lemlib::OdomSensors`\n- `lemlib::Omniwheel`\n- `lemlib::Drivetrain`\n- `lemlib::ControllerSettings`\n- `lemlib::ExitCondition`\n- `lemlib::DriveCurve`\n- `lemlib::ExpoDriveCurve`\n- Odometry\n- General\n- `update()`\n- `init()`\n- Pose\n- `lemlib::Pose`\n- `format_as()`\n- Utils\n- Timer\n- `lemlib::Timer`\n- PID\n- `lemlib::PID`\n- Misc\n- `slew()`\n- `radToDeg()`\n- `degToRad()`\n- `sanitizeAngle()`\n- `angleError()`\n- `avg()`\n- `ema()`\n- `getCurvature()`"}], "source": "https://lemlib.readthedocs.io/en/stable/api/index.html"} {"conversations": [{"from": "system", "value": "You are a coding and engineering mentor for students in the VEX V5 Robotics Competition (VRC). Your job is to help students build working robots and also understand why they work, so they get better on their own.\n\n## Who you're helping\n- Mostly middle and high school students, with experience ranging from first-week beginners to veteran teams.\n- If you can't tell their level, start simple and ask one short question, or adjust based on how they write.\n\n## Technical scope\n- Languages and platforms: VEXcode V5 (C++ and Python), PROS (C++), and RobotMesh Studio when relevant. Ask which one they use if it isn't clear, and never mix APIs between them.\n- Common topics: drivetrain setup, motor groups, tank/arcade/holonomic drive control, sensors (inertial, rotation, optical, distance, vision/AI vision), PID control, odometry, autonomous routines, driver-control tuning, debugging, and pneumatics/mechanism logic.\n- Beyond code, you can also help with design choices, strategy, scouting, engineering notebook structure, and interview/judging prep.\n\n## How to help\n1. Lead with the answer or working code, then explain it briefly.\n2. Comment code so a student can follow it, and explain non-obvious lines (e.g., why a deadband exists, what a PID constant does).\n3. When debugging, ask for the error message, the relevant code, and what the robot actually did vs. what was expected. Suggest the most likely cause first, and give a way to test it.\n4. For tuning (PID, turn accuracy, autonomous timing), give a systematic method, not random numbers.\n5. Teach as you go. For learners, offer a short \"why this works\" note. Don't write long lectures unless asked.\n6. Keep responses concise. Use code blocks for all code, and numbered steps for procedures.\n\n## Honesty and accuracy\n- Never invent API functions, parameters, or library features. If you're unsure whether something exists in a given version of VEXcode or PROS, say so and suggest how to verify it in the docs.\n- Game rules, scoring, and leg"}, {"from": "human", "value": "Summarize the following source: Odometry - LemLib documentation"}, {"from": "gpt", "value": "# Odometry¶\n\n## General¶\n\nvoid lemlib::update()¶\n: Update the pose of the robot.\n\nvoid lemlib::init()¶\n: Initialize the odometry system.\n\n## Pose¶\n\nclass Pose¶\n: A pose in 2D space.\n\nA pose is a position and heading in 2D space. Representing a pose as a single object makes it easier to work with, especially in motion algorithms and position tracking.\n\nThe Pose class overloads operators so you can easily add, subtract, multiply, etc.\n\nPublic Functions\n\nPose(float x, float y, float theta = 0)¶\n: Create a new pose.\n\n**Example**\n\n```\n// create a pose\nlemlib::Pose poseA(5, // x position\n10, // y position\n1.57); // heading\n// create a pose\nlemlib::Pose poseB(5.2, 22); // x and y position, heading defaults to 0\n```\n\nNote\n\nPose is unitless. It is up to the user to ensure that the units are consistent.\n\nParameters:\n: - **x** – component\n- **y** – component\n- **theta** – heading. Defaults to 0\n\nPose operator+(const Pose &other) const¶\n: Add a pose to this pose.\n\n**Example**\n\n```\n// create a pose\nlemlib::Pose poseA(5, 10, 1.57);\n// create a pose\nlemlib::Pose poseB(5.2, 22, 2.22);\n// add the two poses\nlemlib::Pose poseC = poseA + poseB;\n// poseC.x = 10.2, poseC.y = 32, poseC.theta = 1.57\n```\n\nNote\n\nheading is not modified, and is taken from this pose\n\nParameters:\n: **other** – other pose\n\nReturns:\n: Pose\n\nPose operator-(const Pose &other) const¶\n: Subtract a pose from this pose.\n\n**Example**\n\n```\n// create a pose\nlemlib::Pose poseA(5, 10, 1.57);\n// create a pose\nlemlib::Pose poseB(5.2, 22, 2.22);\n// subtract the two poses\nlemlib::Pose poseC = poseA - poseB;\n// poseC.x = -0.2, poseC.y = -12, poseC.theta = 1.57\n```\n\nNote\n\nheading is not modified, and is taken from this pose\n\nParameters:\n: **other** – other pose\n\nReturns:\n: Pose\n\nfloat operator\\*(const Pose &other) const¶\n: Multiply a pose by this pose (dot product)\n\n**Example**\n\n```\n// create a pose\nlemlib::Pose poseA(5, 10, 1.57);\n// create a pose\nlemlib::Pose poseB(5.2, 22, 2.22);\n// multiply the two poses\nfloat result = poseA * poseB; // 246\n```\n\nNote\n\nheading is not considered in this operation\n\nParameters:\n: **other** – other pose\n\nReturns:\n: Pose\n\nPose operator\\*(const float &other) const¶\n: Multiply a pose by a float.\n\n**Example**\n\n```\n// create a pose\nlemlib::Pose pose(1, 2);\n// multiply the pose by 4.0\nlemlib::Pose result = pose * 4.0;\n// result.x = 4, result.y = 8\n```\n\nNote\n\nheading is not considered in this operation\n\nParameters:\n: **other** – float\n\nReturns:\n: Pose\n\nPose operator/(const float &other) const¶\n: Divide a pose by a float.\n\n**Example**\n\n```\n// create a pose\nlemlib::Pose pose(6, 8);\n// divide the pose by 2\nlemlib::Pose result = pose / 2;\n// result.x = 3, result.y = 4\n```\n\nNote\n\nheading is not considered in this operation\n\nParameters:\n: **other** – float\n\nReturns:\n: Pose\n\nPose lerp(Pose other, float t) const¶\n: Linearly interpolate between two poses.\n\n**Example**\n\n```\n// create poses\nlemlib::Pose poseA(0, 0);\nlemlib::Pose poseB(0, 2);\n// find the pose in between the 2 poses\nlemlib::Pose result = poseA.lerp(poseB, 0.5);\n// result.x = 0, result.y = 1\n```\n\nNote\n\nheading is not considered in this operation\n\nParameters:\n: - **other** – the other pose\n- **t** – t value\n\nReturns:\n: Pose\n\nfloat distance(Pose other) const¶\n: Get the distance between two poses.\n\n**Example**\n\n```\n// create poses\nlemlib::Pose poseA(0, 0);\nlemlib::Pose poseB(3, 4);\n// find the distance between the poses\nfloat result = poseA.distance(poseB); // result = 5\n```\n\nNote\n\nheading is not considered in this operation\n\nParameters:\n: **other** – the other pose\n\nReturns:\n: float\n\nfloat angle(Pose other) const¶\n: Get the angle between two poses.\n\n**Example**\n\n```\n// create poses\nlemlib::Pose poseA(-1, -2);\nlemlib::Pose poseB(2, 1);\n// find angle between poses\nfloat result = poseA.angle(poseB); // result = 0.785398\n```\n\nNote\n\nheading is not considered in this operation\n\nParameters:\n: **other** – the other pose\n\nReturns:\n: float in radians\n\nPose rotate(float angle) const¶\n: Rotate a pose by an angle.\n\n**Example**\n\n```\n// create pose\nlemlib::Pose pose(1, 0);\n// rotate pose by pi/2\nlemlib::Pose result = pose.rotate(M_PI_2);\n// result.x = 0, result.y = 1\n```\n\nNote\n\nheading is not considered in this operation\n\nParameters:\n: **angle** – angle in radians\n\nReturns:\n: Pose\n\nstd::string lemlib::format\\_as(const Pose &pose)¶\n: Format a pose.\n\nParameters:\n: **pose** –\n\nReturns:\n: std::string"}], "source": "https://lemlib.readthedocs.io/en/stable/api/odom.html"} {"conversations": [{"from": "system", "value": "You are a coding and engineering mentor for students in the VEX V5 Robotics Competition (VRC). Your job is to help students build working robots and also understand why they work, so they get better on their own.\n\n## Who you're helping\n- Mostly middle and high school students, with experience ranging from first-week beginners to veteran teams.\n- If you can't tell their level, start simple and ask one short question, or adjust based on how they write.\n\n## Technical scope\n- Languages and platforms: VEXcode V5 (C++ and Python), PROS (C++), and RobotMesh Studio when relevant. Ask which one they use if it isn't clear, and never mix APIs between them.\n- Common topics: drivetrain setup, motor groups, tank/arcade/holonomic drive control, sensors (inertial, rotation, optical, distance, vision/AI vision), PID control, odometry, autonomous routines, driver-control tuning, debugging, and pneumatics/mechanism logic.\n- Beyond code, you can also help with design choices, strategy, scouting, engineering notebook structure, and interview/judging prep.\n\n## How to help\n1. Lead with the answer or working code, then explain it briefly.\n2. Comment code so a student can follow it, and explain non-obvious lines (e.g., why a deadband exists, what a PID constant does).\n3. When debugging, ask for the error message, the relevant code, and what the robot actually did vs. what was expected. Suggest the most likely cause first, and give a way to test it.\n4. For tuning (PID, turn accuracy, autonomous timing), give a systematic method, not random numbers.\n5. Teach as you go. For learners, offer a short \"why this works\" note. Don't write long lectures unless asked.\n6. Keep responses concise. Use code blocks for all code, and numbered steps for procedures.\n\n## Honesty and accuracy\n- Never invent API functions, parameters, or library features. If you're unsure whether something exists in a given version of VEXcode or PROS, say so and suggest how to verify it in the docs.\n- Game rules, scoring, and leg"}, {"from": "human", "value": "Summarize the following source: Main API - LemLib documentation"}, {"from": "gpt", "value": "```\n// set the pose of the chassis to x = 0, y = 0, theta = 0\nchassis.setPose(0, 0, 0);\n// set the pose of the chassis to x = 5.3, y = 12.2, theta = 3.14\n// this time with theta in radians\nchassis.setPose(5.3, 12.2, 3.14, true);\n```\n\n```\n// set the pose of the chassis to x = 0, y = 0, theta = 0\nlemlib::Pose poseA(0, 0, 0);\nchassis.setPose(poseA);\n// set the pose of the chassis to x = 5.3, y = 12.2, theta = 3.14\n// this time with theta in radians\nlemlib::Pose poseB(5.3, 12.2, 3.14);\nchassis.setPose(poseB, true);\n```\n\n```\n// get the pose of the chassis\nlemlib::Pose pose = chassis.getPose();\n// print the x, y, and theta values of the pose\nprintf(\"X: %f, Y: %f, Theta: %f\\n\", pose.x, pose.y, pose.theta);\n// get the pose of the chassis in radians\nlemlib::Pose poseRad = chassis.getPose(true);\n// print the x, y, and theta values of the pose\nprintf(\"X: %f, Y: %f, Theta: %f\\n\", poseRad.x, poseRad.y, poseRad.theta);\n// get the pose of the chassis in radians and standard position\nlemlib::Pose poseRadStandard = chassis.getPose(true, true);\n// print the x, y, and theta values of the pose\nprintf(\"X: %f, Y: %f, Theta: %f\\n\", poseRadStandard.x, poseRadStandard.y, poseRadStandard.theta);\n```\n\n```\n// move the robot to x = 20, y = 15, and face heading 90\nchassis.moveToPose(20, 15, 90, 4000);\n// wait until the robot has traveled 10 inches\nchassis.waitUntil(10);\n// output \"traveled 10 inches\" to the console\nstd::cout << \"traveled 10 inches\" << std::endl;\n// turn the robot to face 270 degrees\n// this will wait for the last motion to complete before running\nchassis.turnToHeading(270, 4000);\n// wait until the robot has traveled 45 degrees\nchassis.waitUntil(45);\n// output \"traveled 45 degrees\" to the console\nstd::cout << \"traveled 45 degrees\" << std::endl;\n```\n\n```\n// move the robot to x = 20, y = 15, and face heading 90\nchassis.moveToPose(20, 15, 90, 4000);\n// wait until the robot has completed the motion\nchassis.waitUntilDone();\n// output \"motion completed\" to the console\nstd::cout << \"motion completed\" << std::endl;\n```\n\n```\n// set the brake mode of the drivetrain motors to hold\nchassis.setBrakeMode(pros::E_MOTOR_BRAKE_HOLD);\n// set the brake mode of the drivetrain motors to coast\nchassis.setBrakeMode(pros::E_MOTOR_BRAKE_COAST);\n// set the brake mode of the drivetrain motors to brake\nchassis.setBrakeMode(pros::E_MOTOR_BRAKE_BRAKE);\n```\n\n```\nchassis.setPose(0, 0, 0); // set the pose of the chassis to x = 0, y = 0, theta = 0\n// turn the robot to face the point x = 45, y = -45, with a timeout of 1000ms\nchassis.turnToPoint(45, -45, 1000);\n// turn the robot to face the point x = 45, y = -45, with a timeout of 1000ms\n// but face the point with the back of the robot\nchassis.turnToPoint(45, -45, 1000, {.forwards = false});\n// turn the robot to face the point x = -20, 32.5 with a timeout of 2000ms\n// and a maximum speed of 60\nchassis.turnToPoint(-20, 32.5, 2000, {.maxSpeed = 60});\n// turn the robot to face the point x = -30, y = 22.5 with a timeout of 1500ms\n// and turn counterclockwise\nchassis.turnToPoint(-30, 22.5, 1500, {.direction = AngularDirection::CCW_COUNTERCLOCKWISE});\n// turn the robot to face the point x = 10, y = 10 with a timeout of 500ms\n// with a minSpeed of 20 and a maxSpeed of 60\nchassis.turnToPoint(10, 10, 500, {.maxSpeed = 60, .minSpeed = 20});\n// turn the robot to face the point x = 7.5, y = 7.5 with a timeout of 2000ms\n// and a minSpeed of 60, and exit the movement if the robot is within 5 degrees of the target\nchassis.turnToPoint(7.5, 7.5, 2000, {.minSpeed = 60, .earlyExitRange = 5});\n```\n\n```\nchassis.setPose(0, 0, 0); // set the pose of the chassis to x = 0, y = 0, theta = 0\n// turn the robot to face heading 135, with a timeout of 1000ms\nchassis.turnToHeading(135, 1000);\n// turn the robot to face heading 230.5 with a timeout of 2000ms\n// and a maximum speed of 60\nchassis.turnToHeading(230.5, 2000, {.maxSpeed = 60});\n// turn the robot to face heading -90 with a timeout of 1500ms\n// and turn counterclockwise\nchassis.turnToHeading(-90, 1500, {.direction = AngularDirection::CCW_COUNTERCLOCKWISE});\n// turn the robot to face heading 90 with a timeout of 500ms\n// with a minSpeed of 20 and a maxSpeed of 60\nchassis.turnToHeading(90, 500, {.maxSpeed = 60, .minSpeed = 20});\n// turn the robot to face heading 45 with a timeout of 2000ms\n// and a minSpeed of 60, and exit the movement if the robot is within 5 degrees of the target\nchassis.turnToHeading(45, 2000, {.minSpeed = 60, .earlyExitRange = 5});\n```\n\n```\nchassis.setPose(0, 0, 0); // set the pose of the chassis to x = 0, y = 0, theta = 0\n// turn the robot to face heading 135, with a timeout of 1000ms\n// and lock the left side of the drivetrain\nchassis.swingToHeading(135, DriveSide::LEFT, 1000);\n// turn the robot to face heading 230.5 with a timeout of 2000ms\n// and a maximum speed of 60\n// and lock the right side of the drivetrain\nchassis.swingToHeading(230.5, DriveSide::RIGHT, 2000, {.maxSpeed = 60});\n// turn the robot to face heading -90 with a timeout of 1500ms\n// and turn counterclockwise\n// and lock the left side of the drivetrain\nchassis.swingToHeading(-90, DriveSide::LEFT, 1500, {.direction = AngularDirection::CCW_COUNTERCLOCKWISE});\n// turn the robot to face heading 90 with a timeout of 500ms\n// with a minSpeed of 20 and a maxSpeed of 60\n// and lock the right side of the drivetrain\nchassis.swingToHeading(90, DriveSide::RIGHT, 500, {.maxSpeed = 60, .minSpeed = 20});\n// turn the robot to face heading 45 with a timeout of 2000ms\n// and a minSpeed of 60, and exit the movement if the robot is within 5 degrees of the target\n// and lock the left side of the drivetrain\nchassis.swingToHeading(45, DriveSide::LEFT, 2000, {.minSpeed = 60, .earlyExitRange = 5});\n```"}], "source": "https://lemlib.readthedocs.io/en/stable/api/chassis.html"} {"conversations": [{"from": "system", "value": "You are a coding and engineering mentor for students in the VEX V5 Robotics Competition (VRC). Your job is to help students build working robots and also understand why they work, so they get better on their own.\n\n## Who you're helping\n- Mostly middle and high school students, with experience ranging from first-week beginners to veteran teams.\n- If you can't tell their level, start simple and ask one short question, or adjust based on how they write.\n\n## Technical scope\n- Languages and platforms: VEXcode V5 (C++ and Python), PROS (C++), and RobotMesh Studio when relevant. Ask which one they use if it isn't clear, and never mix APIs between them.\n- Common topics: drivetrain setup, motor groups, tank/arcade/holonomic drive control, sensors (inertial, rotation, optical, distance, vision/AI vision), PID control, odometry, autonomous routines, driver-control tuning, debugging, and pneumatics/mechanism logic.\n- Beyond code, you can also help with design choices, strategy, scouting, engineering notebook structure, and interview/judging prep.\n\n## How to help\n1. Lead with the answer or working code, then explain it briefly.\n2. Comment code so a student can follow it, and explain non-obvious lines (e.g., why a deadband exists, what a PID constant does).\n3. When debugging, ask for the error message, the relevant code, and what the robot actually did vs. what was expected. Suggest the most likely cause first, and give a way to test it.\n4. For tuning (PID, turn accuracy, autonomous timing), give a systematic method, not random numbers.\n5. Teach as you go. For learners, offer a short \"why this works\" note. Don't write long lectures unless asked.\n6. Keep responses concise. Use code blocks for all code, and numbered steps for procedures.\n\n## Honesty and accuracy\n- Never invent API functions, parameters, or library features. If you're unsure whether something exists in a given version of VEXcode or PROS, say so and suggest how to verify it in the docs.\n- Game rules, scoring, and leg"}, {"from": "human", "value": "Summarize the following source: Main API - LemLib documentation"}, {"from": "gpt", "value": "= 60}); // turn the robot to face heading -90 with a timeout of 1500ms // and turn counterclockwise // and lock the left side of the drivetrain chassis.swingToHeading(-90, DriveSide::LEFT, 1500, {.direction = AngularDirection::CCW_COUNTERCLOCKWISE}); // turn the robot to face heading 90 with a timeout of 500ms // with a minSpeed of 20 and a maxSpeed of 60 // and lock the right side of the drivetrain chassis.swingToHeading(90, DriveSide::RIGHT, 500, {.maxSpeed = 60, .minSpeed = 20}); // turn the robot to face heading 45 with a timeout of 2000ms // and a minSpeed of 60, and exit the movement if the robot is within 5 degrees of the target // and lock the left side of the drivetrain chassis.swingToHeading(45, DriveSide::LEFT, 2000, {.minSpeed = 60, .earlyExitRange = 5}); ```\n\n```\nchassis.setPose(0, 0, 0); // set the pose of the chassis to x = 0, y = 0, theta = 0\n// turn the robot to face the point x = 45, y = -45, with a timeout of 1000ms\n// and lock the left side of the drivetrain\nchassis.swingToPoint(45, -45, DriveSide::LEFT, 1000);\n// turn the robot to face the point x = 45, y = -45, with a timeout of 1000ms\n// but face the point with the back of the robot\n// and lock the right side of the drivetrain\nchassis.swingToPoint(45, -45, DriveSide::RIGHT, 1000, {.forwards = false});\n// turn the robot to face the point x = -20, 32.5 with a timeout of 2000ms\n// and a maximum speed of 60\n// and lock the left side of the drivetrain\nchassis.swingToPoint(-20, 32.5, DriveSide::LEFT, 2000, {.maxSpeed = 60});\n// turn the robot to face the point x = -30, y = 22.5 with a timeout of 1500ms\n// and turn counterclockwise\n// and lock the right side of the drivetrain\nchassis.swingToPoint(-30, 22.5, DriveSide::RIGHT, 1500, {.direction =\nAngularDirection::CCW_COUNTERCLOCKWISE});\n// turn the robot to face the point x = 10, y = 10 with a timeout of 500ms\n// with a minSpeed of 20 and a maxSpeed of 60\n// and lock the left side of the drivetrain\nchassis.swingToPoint(10, 10, DriveSide::LEFT, 500, {.maxSpeed = 60, .minSpeed = 20});\n// turn the robot to face the point x = 7.5, y = 7.5 with a timeout of 2000ms\n// and a minSpeed of 60, and exit the movement if the robot is within 5 degrees of the target\n// and lock the right side of the drivetrain\nchassis.swingToPoint(7.5, 7.5, DriveSide::RIGHT, 2000, {.minSpeed = 60, .earlyExitRange = 5});\n```\n\n```\n// move the robot to x = 20, y = 15, and face heading 90 with a timeout of 4000ms\nchassis.moveToPose(20, 15, 90, 4000);\n// move the robot to x = 20, y = 15, and face heading 90 with a timeout of 4000ms\n// but face the point with the back of the robot\nchassis.moveToPose(20, 15, 90, 4000, {.forwards = false});\n// move the robot to x = -20, 32.5 and face heading 90 with a timeout of 4000ms\n// with a maxSpeed of 60\nchassis.moveToPose(-20, 32.5, 90, 4000, {.maxSpeed = 60});\n// move the robot to x = 10, y = 10 and face heading 90\n// with a minSpeed of 20 and a maxSpeed of 60\nchassis.moveToPose(10, 10, 90, 4000, {.maxSpeed = 60, .minSpeed = 20});\n// move the robot to x = 7.5, y = 7.5 and face heading 90 with a timeout of 4000ms\n// with a minSpeed of 60, and exit the movement if the robot is within 5 inches of the target\nchassis.moveToPose(7.5, 7.5, 90, 4000, {.minSpeed = 60, .earlyExitRange = 5});\n// move the robot to 0, 0, and facing heading 0 with a timeout of 4000ms\n// this motion should not be as curved as the others, so we set lead to a smaller value (0.3)\nchassis.moveToPose(0, 0, 0, 4000, {.lead = 0.3});\n```\n\n```\n// move the robot to x = 20, y = 15 with a timeout of 4000ms\nchassis.moveToPoint(20, 15, 4000);\n// move the robot to x = 20, y = 15 with a timeout of 4000ms\n// but face the point with the back of the robot\nchassis.moveToPoint(20, 15, 4000, {.forwards = false});\n// move the robot to x = -20, 32.5 with a timeout of 4000ms\n// with a maxSpeed of 60\nchassis.moveToPoint(-20, 32.5, 4000, {.maxSpeed = 60});\n// move the robot to x = 10, y = 10 with a timeout of 4000ms\n// with a minSpeed of 20 and a maxSpeed of 60\nchassis.moveToPoint(10, 10, 4000, {.maxSpeed = 60, .minSpeed = 20});\n// move the robot to x = 7.5, y = 7.5 with a timeout of 4000ms\n// with a minSpeed of 60, and exit the movement if the robot is within 5 inches of the target\nchassis.moveToPoint(7.5, 7.5, 4000, {.minSpeed = 60, .earlyExitRange = 5});\n```\n\n```\n// load \"myPath.txt\"\n// the file should be in the \"static\" folder in the project root directory\n// this should also be done outside of any functions, otherwise it won't compile\nASSET(myPath_txt); // we replace \".\" with \"_\" to make the asset name valid\n\n// autonomous function in your project. The function that runs during the autonomous period\nvoid autonomous() {\n// follow the path in \"myPath.txt\" with a lookahead of 10 inches and a timeout of 4000ms\nchassis.follow(myPath_txt, 10, 4000);\n// follow the path in \"myPath.txt\" with a lookahead of 10 inches and a timeout of 4000ms\n// but follow the path backwards\nchassis.follow(myPath_txt, 10, 4000, false);\n}\n```\n\n```\n// opcontrol function in your project. The function that runs during the driver control period\nvoid opcontrol() {\n// controller\npros::Controller controller(pros::E_CONTROLLER_MASTER);\n// loop to continuously update motors\nwhile (true) {\n// get joystick positions\nint leftY = controller.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_Y);\nint rightY = controller.get_analog(pros::E_CONTROLLER_ANALOG_RIGHT_Y);\n// move the chassis with tank controls\nchassis.tank(leftY, rightY);\n// delay to save resources\npros::delay(25);\n}\n}\n```\n\n```\n// opcontrol function in your project. The function that runs during the driver control period\nvoid opcontrol() {\n// controller\npros::Controller controller(pros::E_CONTROLLER_MASTER);\n// loop to continuously update motors\nwhile (true) {\n// get joystick positions\nint leftY = controller.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_Y);\nint rightX = controller.get_analog(pros::E_CONTROLLER_ANALOG_RIGHT_X);\n// move the chassis with arcade controls\nchassis.arcade(leftY, // throttle\nrightX, // steer\nfalse, // enable drive curves\n0.75 // slightly prioritize steering\n);\n// delay to save resources\npros::delay(25);\n}\n}\n```\n\n```\n// opcontrol function in your project. The function that runs during the driver control period\nvoid opcontrol() {\n// controller\npros::Controller controller(pros::E_CONTROLLER_MASTER);\n// loop to continuously update motors\nwhile (true) {\n// get joystick positions\nint leftY = controller.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_Y);\nint rightX = controller.get_analog(pros::E_CONTROLLER_ANALOG_RIGHT_X);\n// move the chassis with curvature controls\nchassis.curvature(leftY, rightX);\n// delay to save resources\npros::delay(25);\n}\n}\n```"}], "source": "https://lemlib.readthedocs.io/en/stable/api/chassis.html"} {"conversations": [{"from": "system", "value": "You are a coding and engineering mentor for students in the VEX V5 Robotics Competition (VRC). Your job is to help students build working robots and also understand why they work, so they get better on their own.\n\n## Who you're helping\n- Mostly middle and high school students, with experience ranging from first-week beginners to veteran teams.\n- If you can't tell their level, start simple and ask one short question, or adjust based on how they write.\n\n## Technical scope\n- Languages and platforms: VEXcode V5 (C++ and Python), PROS (C++), and RobotMesh Studio when relevant. Ask which one they use if it isn't clear, and never mix APIs between them.\n- Common topics: drivetrain setup, motor groups, tank/arcade/holonomic drive control, sensors (inertial, rotation, optical, distance, vision/AI vision), PID control, odometry, autonomous routines, driver-control tuning, debugging, and pneumatics/mechanism logic.\n- Beyond code, you can also help with design choices, strategy, scouting, engineering notebook structure, and interview/judging prep.\n\n## How to help\n1. Lead with the answer or working code, then explain it briefly.\n2. Comment code so a student can follow it, and explain non-obvious lines (e.g., why a deadband exists, what a PID constant does).\n3. When debugging, ask for the error message, the relevant code, and what the robot actually did vs. what was expected. Suggest the most likely cause first, and give a way to test it.\n4. For tuning (PID, turn accuracy, autonomous timing), give a systematic method, not random numbers.\n5. Teach as you go. For learners, offer a short \"why this works\" note. Don't write long lectures unless asked.\n6. Keep responses concise. Use code blocks for all code, and numbered steps for procedures.\n\n## Honesty and accuracy\n- Never invent API functions, parameters, or library features. If you're unsure whether something exists in a given version of VEXcode or PROS, say so and suggest how to verify it in the docs.\n- Game rules, scoring, and leg"}, {"from": "human", "value": "Summarize the following source: Main API - LemLib documentation"}, {"from": "gpt", "value": "during the driver control period void opcontrol() { // controller pros::Controller controller(pros::E_CONTROLLER_MASTER); // loop to continuously update motors while (true) { // get joystick positions int leftY = controller.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_Y); int rightX = controller.get_analog(pros::E_CONTROLLER_ANALOG_RIGHT_X); // move the chassis with arcade controls chassis.arcade(leftY, // throttle rightX, // steer false, // enable drive curves 0.75 // slightly prioritize steering ); // delay to save resources pros::delay(25); } } ``` ``` // opcontrol function in your project. The function that runs during the driver control period void opcontrol() { // controller pros::Controller controller(pros::E_CONTROLLER_MASTER); // loop to continuously update motors while (true) { // get joystick positions int leftY = controller.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_Y); int rightX = controller.get_analog(pros::E_CONTROLLER_ANALOG_RIGHT_X); // move the chassis with curvature controls chassis.curvature(leftY, rightX); // delay to save resources pros::delay(25); } } ```\n\n```\n// move the robot to x = 20, y = 20 with a timeout of 4000ms\nchassis.moveToPoint(20, 20, 4000);\n// wait 500 milliseconds\npros::delay(500);\n// cancel the current motion. This stops it immediately\nchassis.cancelMotion();\n```\n\n```\n// this example shows how the cancelMotion function behaves when a motion is queued\n// this is an advanced example since we will be using tasks here\n// move the robot to x = 20, y = 20 with a timeout of 4000ms\nchassis.moveToPoint(20, 20, 4000);\n// start a lambda task that will be used to cancel the motion after 500ms\npros::Task task([] {\n// wait 500 milliseconds\npros::delay(500);\n// cancel the current motion. This stops it immediately\nchassis.cancelMotion();\n});\n// queue a motion to x = 10, y = 10 with a timeout of 4000ms\n// this will run after the first motion is cancelled\nchassis.moveToPoint(10, 10, 4000);\n```\n\n```\n// move the robot to x = 20, y = 20 with a timeout of 4000ms\nchassis.moveToPoint(20, 20, 4000);\n// wait 500 milliseconds\npros::delay(500);\n// cancel all motions. The robot will stop immediately\nchassis.cancelAllMotions();\n```\n\n```\n// this example shows how the cancelMotion function behaves when a motion is queued\n// this is an advanced example since we will be using tasks here\n// move the robot to x = 20, y = 20 with a timeout of 4000ms\nchassis.moveToPoint(20, 20, 4000);\n// start a lambda task that will be used to cancel all motions after 500ms\npros::Task task([] {\n// wait 500 milliseconds\npros::delay(500);\n// cancels both motions\nchassis.cancelAllMotions();\n});\n// queue a motion to x = 10, y = 10 with a timeout of 4000ms\n// this will never run because cancelAllMotions will be called while this motion is in the queue\nchassis.moveToPoint(10, 10, 4000);\n```\n\n```\n// move the robot to x = 20, y = 15, and face heading 90\nchassis.moveToPose(20, 15, 90, 4000);\n// delay for 500ms\n// this returns true, since the robot is still in motion\nchassis.isInMotion();\n```\n\n```\n// set robot position to x = 10, y = 15, and heading 90\nchassis.setPose(10, 15, 90);\n// reset the robot's x and y position\nchassis.resetLocalPosition();\n// the robot's position is now x = 0, y = 0, and heading 90\n```\n\n```\n// Create a new optical shaft encoder on ports 'A' and 'B'\n// this sensor is also reversed\npros::adi::Encoder verticalEncoder('A', 'B', true);\n// create a new vertical tracking wheel\n// it's using a new 2.75 inch wheel\n// it's also 5 inches away from the tracking center. This tracking wheel is to the left\n// of the tracking center, so we use a negative distance. If it was to the right of the\n// tracking center, we would use a positive distance\nlemlib::TrackingWheel verticalTrackingWheel(&verticalEncoder, lemlib::Omniwheel::NEW_275, -5);\n// create a new optical shaft encoder on ports `C` and `D`\n// this sensor is not reversed\npros::adi::Encoder horizontalEncoder('C', 'D', false);\n// create a new horizontal tracking wheel\n// it's using an old 3.25 inch wheel\n// it's also 2 inches away from the tracking center. This tracking wheel is to the back\n// of the tracking center, so we use a negative distance. If it was to the front of the\n// tracking center, we would use a positive distance\n// this wheel also has a 5:3 gear ratio\nlemlib::TrackingWheel horizontalTrackingWheel(&horizontalEncoder, lemlib::Omniwheel::OLD_325, -2, 5.0/3.0);\n```\n\n```\n// Create a new rotation sensor on port 1\n// this sensor is not reversed\npros::Rotation verticalEncoder(1, false);\n// create a new vertical tracking wheel\n// it's using a new 2.75 inch wheel\n// it's also 5 inches away from the tracking center. This tracking wheel is to the left\n// of the tracking center, so we use a negative distance. If it was to the right of the\n// tracking center, we would use a positive distance\nlemlib::TrackingWheel verticalTrackingWheel(&verticalEncoder, lemlib::Omniwheel::NEW_275, -5);\n// create a new rotation sensor on port 2\n// this sensor is reversed\npros::Rotation horizontalEncoder(2, true);\n// create a new horizontal tracking wheel\n// it's using an old 3.25 inch wheel\n// it's also 2 inches away from the tracking center. This tracking wheel is to the back\n// of the tracking center, so we use a negative distance. If it was to the front of the\n// tracking center, we would use a positive distance\n// this wheel also has a 5:3 gear ratio\nlemlib::TrackingWheel horizontalTrackingWheel(&horizontalEncoder, lemlib::Omniwheel::OLD_325, -2, 5.0/3.0);\n```\n\n```\n// Create motor objects\n// note its important to include the motor gearset otherwise the gear ratio will be incorrect\npros::Motor lF(-5, pros::E_MOTOR_GEARSET_06); // left front motor. port 5, reversed\npros::Motor lM(4, pros::E_MOTOR_GEARSET_06); // left middle motor. port 4\npros::Motor lB(-3, pros::E_MOTOR_GEARSET_06); // left back motor. port 3, reversed\n// create a motor group for the left side of the drivetrain\npros::MotorGroup leftMotors({lF, lM, lB});\n// Create a new tracking wheel using the left motor group\n// it's using an old 4 inch wheel\n// and its distance is half the track width of the drivetrain\n// distance is also negative because the left drive side is to the left of the tracking center\n// if it was to the right of the tracking center, we would use a positive distance\n// the rpm is 360\nlemlib::TrackingWheel leftTrackingWheel(&leftMotors, lemlib::Omniwheel::OLD_4, -5, 360);\n```\n\n```\nvoid initialize() {\n// create a tracking wheel that uses a rotation sensor\nlemlib::TrackingWheel exampleTrackingWheel(&exampleRotationSensor, lemlib::Omniwheel::NEW_275, 0.5);\n// this prints 0 to the terminal, because it uses a rotation sensor. If it used a motor group, it would\n// have returned 1\nstd::cout << \"type: \" << exampleTrackingWheel.getType() << std::endl;\n}\n```\n\n```\npros::Rotation vertical_rotation(1); // rotation sensor on port 1\npros::Imu imu(2); // IMU on port 2\n// tracking wheel using a new 2.75\" wheel, 0.5 inches to the right of the tracking center\nlemlib::TrackingWheel vertical1(&vertical_rotation, lemlib::Omniwheel::NEW_275, 0.5);\nlemlib::OdomSensors sensors(&vertical1, // vertical tracking wheel\nnullptr, // no second vertical tracking wheel, set to nullptr\nnullptr, // no horizontal tracking wheels, set to nullptr\nnullptr, // no second horizontal tracking wheel, set to nullptr\n&imu); // IMU\n```"}], "source": "https://lemlib.readthedocs.io/en/stable/api/chassis.html"} {"conversations": [{"from": "system", "value": "You are a coding and engineering mentor for students in the VEX V5 Robotics Competition (VRC). Your job is to help students build working robots and also understand why they work, so they get better on their own.\n\n## Who you're helping\n- Mostly middle and high school students, with experience ranging from first-week beginners to veteran teams.\n- If you can't tell their level, start simple and ask one short question, or adjust based on how they write.\n\n## Technical scope\n- Languages and platforms: VEXcode V5 (C++ and Python), PROS (C++), and RobotMesh Studio when relevant. Ask which one they use if it isn't clear, and never mix APIs between them.\n- Common topics: drivetrain setup, motor groups, tank/arcade/holonomic drive control, sensors (inertial, rotation, optical, distance, vision/AI vision), PID control, odometry, autonomous routines, driver-control tuning, debugging, and pneumatics/mechanism logic.\n- Beyond code, you can also help with design choices, strategy, scouting, engineering notebook structure, and interview/judging prep.\n\n## How to help\n1. Lead with the answer or working code, then explain it briefly.\n2. Comment code so a student can follow it, and explain non-obvious lines (e.g., why a deadband exists, what a PID constant does).\n3. When debugging, ask for the error message, the relevant code, and what the robot actually did vs. what was expected. Suggest the most likely cause first, and give a way to test it.\n4. For tuning (PID, turn accuracy, autonomous timing), give a systematic method, not random numbers.\n5. Teach as you go. For learners, offer a short \"why this works\" note. Don't write long lectures unless asked.\n6. Keep responses concise. Use code blocks for all code, and numbered steps for procedures.\n\n## Honesty and accuracy\n- Never invent API functions, parameters, or library features. If you're unsure whether something exists in a given version of VEXcode or PROS, say so and suggest how to verify it in the docs.\n- Game rules, scoring, and leg"}, {"from": "human", "value": "Summarize the following source: Main API - LemLib documentation"}, {"from": "gpt", "value": "void initialize() { // create a tracking wheel that uses a rotation sensor lemlib::TrackingWheel exampleTrackingWheel(&exampleRotationSensor, lemlib::Omniwheel::NEW_275, 0.5); // this prints 0 to the terminal, because it uses a rotation sensor. If it used a motor group, it would // have returned 1 std::cout << \"type: \" << exampleTrackingWheel.getType() << std::endl; } ``` ``` pros::Rotation vertical_rotation(1); // rotation sensor on port 1 pros::Imu imu(2); // IMU on port 2 // tracking wheel using a new 2.75\" wheel, 0.5 inches to the right of the tracking center lemlib::TrackingWheel vertical1(&vertical_rotation, lemlib::Omniwheel::NEW_275, 0.5); lemlib::OdomSensors sensors(&vertical1, // vertical tracking wheel nullptr, // no second vertical tracking wheel, set to nullptr nullptr, // no horizontal tracking wheels, set to nullptr nullptr, // no second horizontal tracking wheel, set to nullptr &imu); // IMU ```\n\n```\n// drive motors\npros::Motor lF(-5, pros::E_MOTOR_GEARSET_06); // left front motor. port 5, reversed\npros::Motor lM(4, pros::E_MOTOR_GEARSET_06); // left middle motor. port 4\npros::Motor lB(-3, pros::E_MOTOR_GEARSET_06); // left back motor. port 3, reversed\npros::Motor rF(6, pros::E_MOTOR_GEARSET_06); // right front motor. port 6\npros::Motor rM(-9, pros::E_MOTOR_GEARSET_06); // right middle motor. port 9, reversed\npros::Motor rB(7, pros::E_MOTOR_GEARSET_06); // right back motor. port 7\n\n// motor groups\npros::MotorGroup leftMotors({lF, lM, lB}); // left motor group\npros::MotorGroup rightMotors({rF, rM, rB}); // right motor group\n\nlemlib::Drivetrain drivetrain(&leftMotors, // left motor group\n&rightMotors, // right motor group\n10, // 10 inch track width\nlemlib::Omniwheel::NEW_4, // using new 4\" omnis\n360, // drivetrain rpm is 360\n2); // horizontalDrift is 2. If we had traction wheels, it would have been 8\n```\n\n```\nlemlib::ControllerSettings lateralSettings(10, // proportional gain (kP)\n0, // integral gain (kI), set to 0 to disable\n3, // derivative gain (kD), set to 3\n3, // integral anti windup range, set to 0 to disable\n1, // small error range, in inches\n100, // small error range timeout, in milliseconds\n3, // large error range, in inches\n500, // large error range timeout, in milliseconds\n5); // maximum acceleration (slew)\n```\n\n```\n// create a new exponential drive curve\n// controller deadband is set to 5\n// minimum output is set to 12\n// curve gain is set to 1.132\nlemlib::ExpoDriveCurve driveCurve(5, 12, 1.132);\n```\n\n```\nvoid opcontrol() {\n// create a new exponential drive curve\nlemlib::ExpoDriveCurve driveCurve(5, 12, 1.132);\n// input 4\nstd::cout << driveCurve.curve(4) << std::endl; // outputs 0 because input is within deadzone\n// input 6\nstd::cout << driveCurve.curve(6) << std::endl; // outputs 12, the minimum output\nstd::cout << driveCurve.curve(127) << std::endl; // outputs 127, the maximum output\n}\n```"}], "source": "https://lemlib.readthedocs.io/en/stable/api/chassis.html"} {"conversations": [{"from": "system", "value": "You are a coding and engineering mentor for students in the VEX V5 Robotics Competition (VRC). Your job is to help students build working robots and also understand why they work, so they get better on their own.\n\n## Who you're helping\n- Mostly middle and high school students, with experience ranging from first-week beginners to veteran teams.\n- If you can't tell their level, start simple and ask one short question, or adjust based on how they write.\n\n## Technical scope\n- Languages and platforms: VEXcode V5 (C++ and Python), PROS (C++), and RobotMesh Studio when relevant. Ask which one they use if it isn't clear, and never mix APIs between them.\n- Common topics: drivetrain setup, motor groups, tank/arcade/holonomic drive control, sensors (inertial, rotation, optical, distance, vision/AI vision), PID control, odometry, autonomous routines, driver-control tuning, debugging, and pneumatics/mechanism logic.\n- Beyond code, you can also help with design choices, strategy, scouting, engineering notebook structure, and interview/judging prep.\n\n## How to help\n1. Lead with the answer or working code, then explain it briefly.\n2. Comment code so a student can follow it, and explain non-obvious lines (e.g., why a deadband exists, what a PID constant does).\n3. When debugging, ask for the error message, the relevant code, and what the robot actually did vs. what was expected. Suggest the most likely cause first, and give a way to test it.\n4. For tuning (PID, turn accuracy, autonomous timing), give a systematic method, not random numbers.\n5. Teach as you go. For learners, offer a short \"why this works\" note. Don't write long lectures unless asked.\n6. Keep responses concise. Use code blocks for all code, and numbered steps for procedures.\n\n## Honesty and accuracy\n- Never invent API functions, parameters, or library features. If you're unsure whether something exists in a given version of VEXcode or PROS, say so and suggest how to verify it in the docs.\n- Game rules, scoring, and leg"}, {"from": "human", "value": "Summarize the following source: Utils - LemLib documentation"}, {"from": "gpt", "value": "# Utils¶\n\n## Timer¶\n\nclass Timer¶\n: Public Functions\n\nTimer(uint32\\_t time)¶\n: Construct a new Timer.\n\n**Example**\n\n```\n// create a timer that will wait for 1 second\nTimer timer(1000);\n```\n\nNote\n\nthe timer will start counting down as soon as it is created\n\nNote\n\nthe timer constructor is non-blocking so code after it will be executed immediately\n\nNote\n\nif the timer is constructed in a global scope, its behavior is undefined. You can call set() before using the timer if you absolutely need to construct it in a global scope\n\nParameters:\n: **time** – how long to wait, in milliseconds\n\nuint32\\_t getTimeSet()¶\n: Get the amount of time the timer was set to.\n\n**Example**\n\n```\n// create a timer that will wait for 1 second\nTimer timer(1000);\n// get the time the timer was set to\nconst uint32_t time = timer.getTimeSet(); // time = 1000\n```\n\nReturns:\n: uint32\\_t time, in milliseconds\n\nuint32\\_t getTimeLeft()¶\n: Get the amount of time left on the timer.\n\n**Example**\n\n```\n// create a timer that will wait for 1 second\nTimer timer(1000);\n// delay for 300ms\npros::delay(300);\n// get the time left on the timer\nconst uint32_t time = timer.getTimeLeft(); // time = 700\n```\n\nReturns:\n: uint32\\_t time in milliseconds\n\nuint32\\_t getTimePassed()¶\n: Get the amount of time passed on the timer.\n\n**Example**\n\n```\n// create a timer that will wait for 1 second\nTimer timer(1000);\n// delay for 300ms\npros::delay(300);\n// get the time passed on the timer\nconst uint32_t time = timer.getTimePassed(); // time = 300\n```\n\nReturns:\n: uint32\\_t time in milliseconds\n\nbool isDone()¶\n: Get whether the timer is done or not.\n\n**Example**\n\n```\n// create a timer that will wait for 1 second\nTimer timer(1000);\n// delay for 500ms\npros::delay(500);\n// check if the timer is done\nconst bool done = timer.isDone(); // done = false\n// delay for another 500ms\npros::delay(500);\n// check if the timer is done\nconst bool done = timer.isDone(); // done = true\n```\n\nReturns:\n: true the timer is done\n\nReturns:\n: false the timer is not done\n\nbool isPaused()¶\n: Get whether the timer is paused or not.\n\n**Example**\n\n```\n// create a timer that will wait for 1 second\nTimer timer(1000);\n// pause the timer\ntimer.pause();\n// check if the timer is paused\nbool paused = timer.isPaused(); // paused = true\n// resume the timer\ntimer.resume();\n// check if the timer is paused\npaused = timer.isPaused(); // paused = false\n```\n\nReturns:\n: true the timer is paused\n\nReturns:\n: false the timer is not paused\n\nvoid set(uint32\\_t time)¶\n: Set the amount of time the timer should count down. Resets the timer.\n\n**Example**\n\n```\n// create a timer that will wait for 1 second\nTimer timer(1000);\n// set the timer to wait for 2 seconds\ntimer.set(2000);\n```\n\nParameters:\n: **time** – time in milliseconds\n\nvoid reset()¶\n: reset the timer\n\n**Example**\n\n```\n// create a timer that will wait for 1 second\nTimer timer(1000);\n// delay for 500ms\npros::delay(500);\n// reset the timer\ntimer.reset();\n// delay for another 500ms\npros::delay(500);\n// check if the timer is done\nconst bool done = timer.isDone(); // done = false\n```\n\nvoid pause()¶\n: pause the timer\n\n**Example**\n\n```\n// create a timer that will wait for 1 second\nTimer timer(1000);\n// pause the timer\ntimer.pause();\n// delay for 2000ms\npros::delay(2000);\n// check if the timer is done\nconst bool done = timer.isDone(); // done = false\n```\n\nvoid resume()¶\n: resume the timer\n\n**Example**\n\n```\n// create a timer that will wait for 1 second\nTimer timer(1000);\n// pause the timer\ntimer.pause();\n// delay for 500ms\npros::delay(500);\n// resume the timer\ntimer.resume();\n// delay for another 500ms\npros::delay(500);\n// check if the timer is done\nconst bool done = timer.isDone(); // done = false\n```\n\nvoid waitUntilDone()¶\n: wait until the timer is done\n\n**Example**\n\n```\n// create a timer that will wait for 1 second\nTimer timer(1000);\n// wait until the timer is done\ntimer.waitUntilDone();\nstd::cout << \"done!\" << std::endl;\n```\n\n## PID¶\n\nclass PID¶\n: Public Functions\n\nPID(float kP, float kI, float kD, float windupRange = 0, bool signFlipReset = false)¶\n: Construct a new PID.\n\n**Example**\n\n```\n// create a PID\nPID pid(5, // kP\n0.01, // kI\n20, // kD\n5, // integral anti windup range\nfalse); // don't reset integral when sign of error flips\n```\n\nParameters:\n: - **kP** – proportional gain\n- **kI** – integral gain\n- **kD** – derivative gain\n- **windupRange** – integral anti windup range\n- **signFlipReset** – whether to reset integral when sign of error flips\n\nfloat update(float error)¶\n: Update the PID.\n\n**Example**\n\n```\nvoid opcontrol() {\n// create a PID\nPID pid(5, 0, 20);\n// give the pid a test input\n// the pid will then return an output\nfloat output = pid.update(10);\n}\n```\n\nParameters:\n: **error** – target minus position - AKA error\n\nReturns:\n: float output\n\nvoid reset()¶\n: reset integral, derivative, and prevTime\n\n**Example**\n\n```\nvoid opcontrol() {\n// create a PID\nPID pid(5, 0, 20);\n// give the pid a test input\n// the pid will then return an output\nfloat output = pid.update(10);\n// reset the pid\npid.reset();\n}\n```\n\n## Misc¶\n\nfloat lemlib::slew(float target, float current, float maxChange)¶\n: Slew rate limiter.\n\n**Example**\n\n```\nfloat limited = slew(100, // target value\n0, // current value\n10); // maximum allowed change\n// limited == 10\nfloat limited2 = slew(4, // target value\n0, // current value\n10); // maximum allowed change\n// limited2 == 4\n```\n\nParameters:\n: - **target** – target value\n- **current** – current value\n- **maxChange** – maximum change. No maximum if set to 0\n\nReturns:\n: float - the limited value\n\nconstexpr float lemlib::radToDeg(float rad)¶\n: Convert radians to degrees.\n\n**Example**\n\n```\nradToDeg(M_PI); // returns 180\n```\n\nParameters:\n: **rad** – radians\n\nReturns:\n: float degrees\n\nconstexpr float lemlib::degToRad(float deg)¶\n: Convert degrees to radians.\n\n**Example**\n\n```\ndegToRad(180); // returns 3.14159... (pi)\n```\n\nParameters:\n: **deg** – degrees\n\nReturns:\n: float radians\n\nconstexpr float lemlib::sanitizeAngle(float angle, bool radians = true)¶\n: Sanitize an angle so its positive and within the range of 0 to 2pi or 0 to 360.\n\n**Example**\n\n```\n// sanitize angle in degrees\nsanitizeAngle(-90, false); // returns 270\nsanitizeAngle(370, false); // returns 10\n// sanitize angle in radians\nsanitizeAngle(-M_PI, true); // returns pi\nsanitizeAngle(7 * M_PI, true); // returns pi\n// you can also use the default value of radians\nsanitizeAngle(-M_PI); // returns pi\nsanitizeAngle(7 * M_PI); // returns pi\n```\n\nParameters:\n: - **angle** – the angle to sanitize\n- **radians** – whether the angle is in radians or no. True by default\n\nReturns:\n: constexpr float\n\nfloat lemlib::angleError(float target, float position, bool radians = true, AngularDirection direction = AngularDirection::AUTO)¶\n: Calculate the error between 2 angles. Useful when calculating the error between 2 headings.\n\n**Example**\n\n```\nangleError(10, 350, false); // returns 20\nangleError(350, 10, false); // returns -20\n```\n\nParameters:\n: - **target** – target angle\n- **position** – position angle\n- **radians** – true if angle is in radians, false if not. False by default\n- **direction** – which direction to turn to get to the target angle\n\nReturns:\n: float wrapped angle\n\nfloat lemlib::avg(std::vector values)¶\n: Return the average of a vector of numbers.\n\n**Example**\n\n```\nstd::vector values = {1, 2, 3, 4, 5};\navg(values); // returns 3\n```\n\nParameters:\n: **values** –\n\nReturns:\n: float\n\nfloat lemlib::ema(float current, float previous, float smooth)¶\n: Exponential moving average.\n\n**Example**"}], "source": "https://lemlib.readthedocs.io/en/stable/api/utils.html"} {"conversations": [{"from": "system", "value": "You are a coding and engineering mentor for students in the VEX V5 Robotics Competition (VRC). Your job is to help students build working robots and also understand why they work, so they get better on their own.\n\n## Who you're helping\n- Mostly middle and high school students, with experience ranging from first-week beginners to veteran teams.\n- If you can't tell their level, start simple and ask one short question, or adjust based on how they write.\n\n## Technical scope\n- Languages and platforms: VEXcode V5 (C++ and Python), PROS (C++), and RobotMesh Studio when relevant. Ask which one they use if it isn't clear, and never mix APIs between them.\n- Common topics: drivetrain setup, motor groups, tank/arcade/holonomic drive control, sensors (inertial, rotation, optical, distance, vision/AI vision), PID control, odometry, autonomous routines, driver-control tuning, debugging, and pneumatics/mechanism logic.\n- Beyond code, you can also help with design choices, strategy, scouting, engineering notebook structure, and interview/judging prep.\n\n## How to help\n1. Lead with the answer or working code, then explain it briefly.\n2. Comment code so a student can follow it, and explain non-obvious lines (e.g., why a deadband exists, what a PID constant does).\n3. When debugging, ask for the error message, the relevant code, and what the robot actually did vs. what was expected. Suggest the most likely cause first, and give a way to test it.\n4. For tuning (PID, turn accuracy, autonomous timing), give a systematic method, not random numbers.\n5. Teach as you go. For learners, offer a short \"why this works\" note. Don't write long lectures unless asked.\n6. Keep responses concise. Use code blocks for all code, and numbered steps for procedures.\n\n## Honesty and accuracy\n- Never invent API functions, parameters, or library features. If you're unsure whether something exists in a given version of VEXcode or PROS, say so and suggest how to verify it in the docs.\n- Game rules, scoring, and leg"}, {"from": "human", "value": "Summarize the following source: Utils - LemLib documentation"}, {"from": "gpt", "value": "radians = true, AngularDirection direction = AngularDirection::AUTO)¶ : Calculate the error between 2 angles. Useful when calculating the error between 2 headings. **Example** ``` angleError(10, 350, false); // returns 20 angleError(350, 10, false); // returns -20 ``` Parameters: : - **target** – target angle - **position** – position angle - **radians** – true if angle is in radians, false if not. False by default - **direction** – which direction to turn to get to the target angle Returns: : float wrapped angle float lemlib::avg(std::vector values)¶ : Return the average of a vector of numbers. **Example** ``` std::vector values = {1, 2, 3, 4, 5}; avg(values); // returns 3 ``` Parameters: : **values** – Returns: : float float lemlib::ema(float current, float previous, float smooth)¶ : Exponential moving average. **Example**\n\n```\nema(10, 0, 0.5); // returns 5\n```\n\nParameters:\n: - **current** – current measurement\n- **previous** – previous output\n- **smooth** – smoothing factor (0-1). 1 means no smoothing, 0 means no change\n\nReturns:\n: float - the smoothed output\n\nfloat lemlib::getCurvature(Pose pose, Pose other)¶\n: Get the signed curvature of a circle that intersects the first pose and the second pose.\n\nThis is a very niche function that is only used in Pure Pursuit and Boomerang. It calculates the curvature of a circle that is tangent to the first pose and intersects the second pose. It’s also signed to indicate whether the robot should turn clockwise or counter-clockwise to get to the second pose\n\n**Example**\n\n```\nPose pose = {0, 0, 0};\nPose other = {0, 10, 0};\nfloat curvature = getCurvature(pose, other);\n```\n\nNote\n\nThe circle will be tangent to the theta value of the first pose\n\nNote\n\nThe curvature is signed. Positive curvature means the circle is going clockwise, negative means counter-clockwise\n\nNote\n\nTheta has to be in radians and in standard form. That means 0 is right and increases counter-clockwise\n\nParameters:\n: - **pose** – the first pose\n- **other** – the second pose\n\nReturns:\n: float curvature"}], "source": "https://lemlib.readthedocs.io/en/stable/api/utils.html"} {"conversations": [{"from": "system", "value": "You are a coding and engineering mentor for students in the VEX V5 Robotics Competition (VRC). Your job is to help students build working robots and also understand why they work, so they get better on their own.\n\n## Who you're helping\n- Mostly middle and high school students, with experience ranging from first-week beginners to veteran teams.\n- If you can't tell their level, start simple and ask one short question, or adjust based on how they write.\n\n## Technical scope\n- Languages and platforms: VEXcode V5 (C++ and Python), PROS (C++), and RobotMesh Studio when relevant. Ask which one they use if it isn't clear, and never mix APIs between them.\n- Common topics: drivetrain setup, motor groups, tank/arcade/holonomic drive control, sensors (inertial, rotation, optical, distance, vision/AI vision), PID control, odometry, autonomous routines, driver-control tuning, debugging, and pneumatics/mechanism logic.\n- Beyond code, you can also help with design choices, strategy, scouting, engineering notebook structure, and interview/judging prep.\n\n## How to help\n1. Lead with the answer or working code, then explain it briefly.\n2. Comment code so a student can follow it, and explain non-obvious lines (e.g., why a deadband exists, what a PID constant does).\n3. When debugging, ask for the error message, the relevant code, and what the robot actually did vs. what was expected. Suggest the most likely cause first, and give a way to test it.\n4. For tuning (PID, turn accuracy, autonomous timing), give a systematic method, not random numbers.\n5. Teach as you go. For learners, offer a short \"why this works\" note. Don't write long lectures unless asked.\n6. Keep responses concise. Use code blocks for all code, and numbered steps for procedures.\n\n## Honesty and accuracy\n- Never invent API functions, parameters, or library features. If you're unsure whether something exists in a given version of VEXcode or PROS, say so and suggest how to verify it in the docs.\n- Game rules, scoring, and leg"}, {"from": "human", "value": "Summarize the following source: Support - LemLib documentation"}, {"from": "gpt", "value": "# Support\n\nIf you love LemLib, and want to give back to the community, there are many ways to do so.\n\n## Testing\n\nTesting is a great way to help us speed up development. Testing is required for all of our pull requests in order to assure the quality of our software, but lack of access to V5 hardware and time constraints can often make it difficult to get things tested quickly.\n\nTo get started, join our Discord, and check out the pull requests that need testing here.\n\n## Contributing\n\nContributing is another great way to help us improve LemLib. All contributions are welcome, no matter how large or small. We ask that before you contribute, you read the contributing guide."}], "source": "https://lemlib.readthedocs.io/en/stable/support.html"} {"conversations": [{"from": "system", "value": "You are a coding and engineering mentor for students in the VEX V5 Robotics Competition (VRC). Your job is to help students build working robots and also understand why they work, so they get better on their own.\n\n## Who you're helping\n- Mostly middle and high school students, with experience ranging from first-week beginners to veteran teams.\n- If you can't tell their level, start simple and ask one short question, or adjust based on how they write.\n\n## Technical scope\n- Languages and platforms: VEXcode V5 (C++ and Python), PROS (C++), and RobotMesh Studio when relevant. Ask which one they use if it isn't clear, and never mix APIs between them.\n- Common topics: drivetrain setup, motor groups, tank/arcade/holonomic drive control, sensors (inertial, rotation, optical, distance, vision/AI vision), PID control, odometry, autonomous routines, driver-control tuning, debugging, and pneumatics/mechanism logic.\n- Beyond code, you can also help with design choices, strategy, scouting, engineering notebook structure, and interview/judging prep.\n\n## How to help\n1. Lead with the answer or working code, then explain it briefly.\n2. Comment code so a student can follow it, and explain non-obvious lines (e.g., why a deadband exists, what a PID constant does).\n3. When debugging, ask for the error message, the relevant code, and what the robot actually did vs. what was expected. Suggest the most likely cause first, and give a way to test it.\n4. For tuning (PID, turn accuracy, autonomous timing), give a systematic method, not random numbers.\n5. Teach as you go. For learners, offer a short \"why this works\" note. Don't write long lectures unless asked.\n6. Keep responses concise. Use code blocks for all code, and numbered steps for procedures.\n\n## Honesty and accuracy\n- Never invent API functions, parameters, or library features. If you're unsure whether something exists in a given version of VEXcode or PROS, say so and suggest how to verify it in the docs.\n- Game rules, scoring, and leg"}, {"from": "human", "value": "Summarize the following source: 1 - Getting Started - LemLib documentation"}, {"from": "gpt", "value": "# 1 - Getting Started\n\n## Installation - VS Code\n\nWe recommend using Visual Studio Code as a code editor. Click on the link and click the download button, as shown in the image below:\n\n## Installation - PROS\n\nPROS provides the tooling needed to build and upload programs. It can be installed as a VSCode Extension. Simply click on the blocks at the bottom of the sidebar on the left in VSCode, search up `PROS`, and click `install`, as shown in the image below:\n\nAfter the extension has been downloaded, you should see a notification as seen in the image below. Click install, and wait for it to finish:\n\nAfter the toolchain has been installed, you can create a new PROS project. Select the PROS logo in the sidebar, click `Create Project`, select an empty folder for the project, give it a suitable name, e.g `1010N-Spin-Up`, select `v5`, and for kernel version select `4.2.0`. A notification in the bottom right will pop up notifying you that the project is being created. VSCode will open a new window as soon as it is ready. There will be a popup asking whether to “trust” the folder, click `yes`. You have now installed PROS and created your first project!\n\n## Installation - clangd\n\nclangd is a linter and provides code completion, and is essential for any programmer. We recommend this over the C/C++ extension as its much faster.\n\nTo install clangd, repeat the steps to install the PROS extension, but search up `clangd` instead of `PROS`. After it has been installed, open the `main.cpp` file in your project. A notification from clangd will appear in the bottom right stating that it needs to install. Click `install` and wait for it to finish installing. If the notification does not appear, ensure you have clangd installed and reopen `main.cpp`. You have now installed clangd!\n\n## LemLib Installation\n\nTo install LemLib, first need to open the PROS integrated terminal. This can be done by clicking on the PROS icon on the left of the screen and clicking `integrated terminal`\n\nThen, copy/paste the following commands into your command line. This will tell PROS where it can find LemLib, and to apply the latest version of LemLib to your project:\n\n```\npros c add-depot LemLib https://raw.githubusercontent.com/LemLib/LemLib/depot/stable.json # adds LemLib's stable depot\npros c apply LemLib # applies latest stable version of LemLib\n```\n\nfinally, put this at the top of your main.cpp file\n\n```\n#include \"lemlib/api.hpp\" // IWYU pragma: keep\n```\n\nNote\n\nThe `// IWYU pragma: keep` comment is there to prevent unhelpful unused include warnings. You can remove it if you wish\n\nYou’ve now installed LemLib, and you’re ready to configure your robot!"}], "source": "https://lemlib.readthedocs.io/en/stable/tutorials/1_getting_started.html"} {"conversations": [{"from": "system", "value": "You are a coding and engineering mentor for students in the VEX V5 Robotics Competition (VRC). Your job is to help students build working robots and also understand why they work, so they get better on their own.\n\n## Who you're helping\n- Mostly middle and high school students, with experience ranging from first-week beginners to veteran teams.\n- If you can't tell their level, start simple and ask one short question, or adjust based on how they write.\n\n## Technical scope\n- Languages and platforms: VEXcode V5 (C++ and Python), PROS (C++), and RobotMesh Studio when relevant. Ask which one they use if it isn't clear, and never mix APIs between them.\n- Common topics: drivetrain setup, motor groups, tank/arcade/holonomic drive control, sensors (inertial, rotation, optical, distance, vision/AI vision), PID control, odometry, autonomous routines, driver-control tuning, debugging, and pneumatics/mechanism logic.\n- Beyond code, you can also help with design choices, strategy, scouting, engineering notebook structure, and interview/judging prep.\n\n## How to help\n1. Lead with the answer or working code, then explain it briefly.\n2. Comment code so a student can follow it, and explain non-obvious lines (e.g., why a deadband exists, what a PID constant does).\n3. When debugging, ask for the error message, the relevant code, and what the robot actually did vs. what was expected. Suggest the most likely cause first, and give a way to test it.\n4. For tuning (PID, turn accuracy, autonomous timing), give a systematic method, not random numbers.\n5. Teach as you go. For learners, offer a short \"why this works\" note. Don't write long lectures unless asked.\n6. Keep responses concise. Use code blocks for all code, and numbered steps for procedures.\n\n## Honesty and accuracy\n- Never invent API functions, parameters, or library features. If you're unsure whether something exists in a given version of VEXcode or PROS, say so and suggest how to verify it in the docs.\n- Game rules, scoring, and leg"}, {"from": "human", "value": "Summarize the following source: Download - LemLib documentation"}, {"from": "gpt", "value": "# Download¶\n\n## Manual Download¶\n\nLemLib can be downloaded as a PROS template from the releases tab in the LemLib github repository.\n\n## Depot Download¶\n\nIf you don’t want to re-download LemLib every time a new release comes out, we’ve set up a depot to make the updating process easier.\n\nYou can use the following commands to add the depot to your `pros-cli` installation.\n\n```\npros c add-depot LemLib https://raw.githubusercontent.com/LemLib/LemLib/depot/stable.json # adds LemLib's stable depot\npros c apply LemLib # applies latest stable version of LemLib\n```\n\nTo update LemLib, all you have to do is run the following command:\n\n```\npros c update\n```\n\n### Beta Depot¶\n\nWarning\n\nBeta versions of LemLib may not be fully tested or documented. Use at your own risk.\n\nIf you’d like to use a beta version of LemLib you can add our beta depot like so:\n\n```\npros c add-depot LemLib https://raw.githubusercontent.com/LemLib/LemLib/depot/beta.json # adds LemLib's beta depot\n```\n\n## Further steps¶\n\nOnce you’ve downloaded LemLib we recommend you take a look at our tutorials."}], "source": "https://lemlib.readthedocs.io/en/stable/download.html"} {"conversations": [{"from": "system", "value": "You are a coding and engineering mentor for students in the VEX V5 Robotics Competition (VRC). Your job is to help students build working robots and also understand why they work, so they get better on their own.\n\n## Who you're helping\n- Mostly middle and high school students, with experience ranging from first-week beginners to veteran teams.\n- If you can't tell their level, start simple and ask one short question, or adjust based on how they write.\n\n## Technical scope\n- Languages and platforms: VEXcode V5 (C++ and Python), PROS (C++), and RobotMesh Studio when relevant. Ask which one they use if it isn't clear, and never mix APIs between them.\n- Common topics: drivetrain setup, motor groups, tank/arcade/holonomic drive control, sensors (inertial, rotation, optical, distance, vision/AI vision), PID control, odometry, autonomous routines, driver-control tuning, debugging, and pneumatics/mechanism logic.\n- Beyond code, you can also help with design choices, strategy, scouting, engineering notebook structure, and interview/judging prep.\n\n## How to help\n1. Lead with the answer or working code, then explain it briefly.\n2. Comment code so a student can follow it, and explain non-obvious lines (e.g., why a deadband exists, what a PID constant does).\n3. When debugging, ask for the error message, the relevant code, and what the robot actually did vs. what was expected. Suggest the most likely cause first, and give a way to test it.\n4. For tuning (PID, turn accuracy, autonomous timing), give a systematic method, not random numbers.\n5. Teach as you go. For learners, offer a short \"why this works\" note. Don't write long lectures unless asked.\n6. Keep responses concise. Use code blocks for all code, and numbered steps for procedures.\n\n## Honesty and accuracy\n- Never invent API functions, parameters, or library features. If you're unsure whether something exists in a given version of VEXcode or PROS, say so and suggest how to verify it in the docs.\n- Game rules, scoring, and leg"}, {"from": "human", "value": "Summarize the following source: Contributing - LemLib documentation"}, {"from": "gpt", "value": "## 🙋I Have a Question\n\n> If you want to ask a question, we assume that you have read the available Documentation.\n\nBefore you ask a question, it is best to search for existing Issues that might help you. In case you have found a suitable issue and still need clarification, you can write your question in this issue. In addition, you can also search for existing questions in the Vex Discord, the VEX Forum, or our Discord.\n\nIf you then still feel the need to ask a question and need clarification, we recommend the following:\n\n- Open an Issue.\n- Provide as much context as you can about what you’re running into.\n- Provide Kernel, CLI, and LemLib versions (e.g PROS 3.8.0, CLI 3.4.1, LemLib 0.4.5)\n- Any additional information you think is relevant\n\nWe will then take care of the issue as soon as possible.\n\n## 🧑‍💻I Want To Contribute\n\n> Legal Notice\n>\n> When contributing to this project, you must agree that you have authored 100% of the content, that you have the necessary rights to the content and that the content you contribute may be provided under the project license.\n\n### 🐛Reporting Bugs\n\n#### 🐛Before Submitting a Bug Report\n\nA good bug report shouldn’t leave others needing to chase you up for more information. Therefore, we ask you to investigate carefully, collect information and describe the issue in detail in your report. Please complete the following steps in advance to help us fix any potential bug as fast as possible.\n\n- Make sure that you are using the latest version of LemLib, PROS, and the CLI.\n- Determine if your bug is really a bug and not an error on your side e.g. incorrect chassis setup (Make sure that you have read the documentation. If you are looking for support, you might want to check this section).\n- To see if other users have experienced (and potentially already solved) the same issue you are having, check if there is not already a bug report existing for your bug or error in the bug tracker.\n- Collect information about the bug:\n\n- Logger Messages\n- Kernel, CLI, and LemLib versions\n- Any additional templates being used and their versions\n- Can you reliably reproduce the issue?\n\n#### 🐛How Do I Submit a Good Bug Report?\n\n> You must never report security-related issues, vulnerabilities, or bugs including sensitive information to the issue tracker, or elsewhere in public. Instead sensitive bugs must be sent by email to liamteale6@gmail.com.\n\nWe use GitHub issues to track bugs and errors. If you run into an issue with the project:\n\n- Open an Issue. Use the Bug Report issue template.\n- Explain the behavior you would expect and the actual behavior.\n- Provide the version of the PROS kernel, the PROS CLI, and LemLib\n- List any additional templates and their versions\n- Please provide as much context as possible and describe the *reproduction steps* that someone else can follow to recreate the issue on their own. This usually includes your code. For good bug reports you should isolate the problem and create a reduced test case.\n- Provide the information you collected in the previous section.\n- Provide any additional information you think is relevant, but does not fit previous sections.\n\nOnce it’s filed:\n\n- The project team will label the issue accordingly.\n- A team member will try to reproduce the issue with your provided steps. If there are no reproduction steps or no obvious way to reproduce the issue, the team will ask you for those steps and mark the issue as `needs-repro`. Bugs with the `needs-repro` tag will not be addressed until they are reproduced.\n- If the team is able to reproduce the issue, it will be marked `confirmed-bug`, as well as possibly other tags (such as `p: critical`), and the issue will be left to be implemented by someone.\n\n### ✨Suggesting Enhancements\n\nThis section guides you through submitting an enhancement suggestion for LemLib, **including completely new features and minor improvements to existing functionality**. Following these guidelines will help maintainers and the community to understand your suggestion and find related suggestions.\n\n#### ✨Before Submitting an Enhancement\n\n- Make sure that you are using the latest version.\n- Read the documentation carefully and find out if the functionality is already covered, maybe by an individual configuration.\n- Perform a search to see if the enhancement has already been suggested. If it has, add a comment to the existing issue instead of opening a new one.\n- Find out whether your idea fits with the scope and aims of the project. It’s up to you to make a strong case to convince the project’s developers of the merits of this feature. Keep in mind that we want features that will be useful to the majority of our users and not just a small subset.\n\n#### ✨How Do I Submit a Good Enhancement Suggestion?\n\nEnhancement suggestions are tracked as GitHub issues. You can use the Feature Request issue template upon creation of a new issue.\n\n- Use a **clear and descriptive title** for the issue to identify the suggestion.\n- Provide a **step-by-step description of the suggested enhancement** in as many details as possible.\n- **Describe the current behavior** so the project team can understand the difference between your suggestion and the current behavior.\n- **Explain why this enhancement would be useful** to most LemLib users and/or maintainers.\n- **(Optional) List possible implementations and alternatives** you have in mind.\n\n### 🚀Your First Code Contribution\n\n> [!NOTE]\n> Using a development environment different from the one recommended below is fine, but you will have to adjust the steps yourself.\n\n> [!NOTE]\n> We do not recommend using the C/C++ extension, as its slow for linting and autocomplete.\n\n> [!NOTE]\n> At a minimum, we recommend the PROS and clangd extensions\n\nWe recommend using Visual Studio Code as your IDE. It is free, (mostly) open-source, and cross-platform.\nHere is a list of recommended extensions:\n\n> If asked to disable the IntelliSense in favor of clangd, do so.\n\nIn order to build the project, you need to use PROS\n\n- Generate compile commands: `pros build-compile-commands`\n- Build the project: `pros build`\n- Create the template zip: `pros build template`\n\nYou can apply the kernel to your project with the following commands\n\n- Fetch the kernel: `pros c fetch LemLib@a.b.c-d.zip`\n- Apply the kernel: `pros c apply LemLib@a.b.c-d`\n- Remove the template: `pros c remove LemLib@a.b.c-d`\n\nIn order to contribute to LemLib, you will need to fork the repository and clone it to your local machine. You can then commit your changes to your fork. Once you are done, you can create a pull request to the master branch. You can use the Pull Request Template to structure your pull request.\n\n### 📝Improving The Documentation\n\nWe use a combination of Doxygen, Breathe, and Sphinx to generate our documentation. The documentation is hosted on Read The Docs, which gives us both free hosting, and automatic versioning of the documentation. It automatically deploys after every commit.\n\nYou can improve the documentation by:\n\nChanges should be requested via a Pull Request to the LemLib repository. You can use the Pull Request Template to structure your pull request. Additionally, you should verify that the documentation builds correctly on your machine.\n\nYou can do so by installing Doxygen, and all of the python dependencies listed in `docs/requirements.txt`. Once you’ve done that, run the following commands to render the documentation:\n\n```\ncd docs\ndoxygen\nmake html\n```\n\nThen you can view the documentation by pointing your browser at the `./_build/html/index.html` file."}], "source": "https://lemlib.readthedocs.io/en/stable/contribute.html"} {"conversations": [{"from": "system", "value": "You are a coding and engineering mentor for students in the VEX V5 Robotics Competition (VRC). Your job is to help students build working robots and also understand why they work, so they get better on their own.\n\n## Who you're helping\n- Mostly middle and high school students, with experience ranging from first-week beginners to veteran teams.\n- If you can't tell their level, start simple and ask one short question, or adjust based on how they write.\n\n## Technical scope\n- Languages and platforms: VEXcode V5 (C++ and Python), PROS (C++), and RobotMesh Studio when relevant. Ask which one they use if it isn't clear, and never mix APIs between them.\n- Common topics: drivetrain setup, motor groups, tank/arcade/holonomic drive control, sensors (inertial, rotation, optical, distance, vision/AI vision), PID control, odometry, autonomous routines, driver-control tuning, debugging, and pneumatics/mechanism logic.\n- Beyond code, you can also help with design choices, strategy, scouting, engineering notebook structure, and interview/judging prep.\n\n## How to help\n1. Lead with the answer or working code, then explain it briefly.\n2. Comment code so a student can follow it, and explain non-obvious lines (e.g., why a deadband exists, what a PID constant does).\n3. When debugging, ask for the error message, the relevant code, and what the robot actually did vs. what was expected. Suggest the most likely cause first, and give a way to test it.\n4. For tuning (PID, turn accuracy, autonomous timing), give a systematic method, not random numbers.\n5. Teach as you go. For learners, offer a short \"why this works\" note. Don't write long lectures unless asked.\n6. Keep responses concise. Use code blocks for all code, and numbered steps for procedures.\n\n## Honesty and accuracy\n- Never invent API functions, parameters, or library features. If you're unsure whether something exists in a given version of VEXcode or PROS, say so and suggest how to verify it in the docs.\n- Game rules, scoring, and leg"}, {"from": "human", "value": "Summarize the following source: 2 - Configuration - LemLib documentation"}, {"from": "gpt", "value": "```\npros::MotorGroup left_motors({1, 2, 3}); // left motors on ports 1, 2, 3\npros::MotorGroup right_motors({4, 5, 6}); // right motors on ports 4, 5, 6\n```\n\n```\npros::MotorGroup left_motors({-1, 2, -3}); // left motors on ports 1 (reversed), 2 (forwards), and 3 (reversed)\npros::MotorGroup right_motors({4, -5, 6}); // right motors on ports 4 (forwards), 5 (reversed), and 6 (forwards)\n```\n\n```\npros::MotorGroup left_motors({-1, 2, -3}, pros::MotorGearset::blue); // left motors use 600 RPM cartridges\npros::MotorGroup right_motors({4, -5, 6}, pros::MotorGearset::green); // right motors use 200 RPM cartridges\n```\n\n```\n// drivetrain settings\nlemlib::Drivetrain drivetrain(&left_motor_group, // left motor group\n&right_motor_group, // right motor group\n10, // 10 inch track width\nlemlib::Omniwheel::NEW_4, // using new 4\" omnis\n360, // drivetrain rpm is 360\n2 // horizontal drift is 2 (for now)\n);\n```\n\n```\n// replace 'A', 'B', with the ports the sensor is connected to\npros::adi::Encoder vertical_encoder('A', 'B');\n// replace 1 with the port the rotation sensor is connected to\npros::Rotation horizontal_sensor(1);\n\n// this runs at the start of the program\nvoid initialize() {\npros::lcd::initialize(); // initialize brain screen\nwhile (true) { // infinite loop\n// print measurements from the adi encoder\npros::lcd::print(0, \"ADI Encoder: %i\", adi_encoder.get_value());\n// print measurements from the rotation sensor\npros::lcd::print(1, \"Rotation Sensor: %i\", rotation_sensor.get_position());\npros::delay(10); // delay to save resources. DO NOT REMOVE\n}\n}\n```\n\n```\n// reversed ADI Encoder\npros::adi::Encoder adi_encoder('A', 'B', true);\n// reversed rotation sensor\npros::Rotation rotation_sensor(-1);\n```\n\n```\n// horizontal tracking wheel encoder\npros::Rotation horizontal_encoder(20);\n// vertical tracking wheel encoder\npros::adi::Encoder vertical_encoder('C', 'D', true);\n// horizontal tracking wheel\nlemlib::TrackingWheel horizontal_tracking_wheel(&horizontal_encoder, lemlib::Omniwheel::NEW_275, -5.75);\n// vertical tracking wheel\nlemlib::TrackingWheel vertical_tracking_wheel(&vertical_encoder, lemlib::Omniwheel::NEW_275, -2.5);\n```\n\n```\nlemlib::OdomSensors sensors(&vertical_tracking_wheel, // vertical tracking wheel 1, set to null\nnullptr, // vertical tracking wheel 2, set to nullptr as we are using IMEs\n&horizontal_tracking_wheel, // horizontal tracking wheel 1\nnullptr, // horizontal tracking wheel 2, set to nullptr as we don't have a second one\n&imu // inertial sensor\n);\n```\n\n```\n// lateral PID controller\nlemlib::ControllerSettings lateral_controller(10, // proportional gain (kP)\n0, // integral gain (kI)\n3, // derivative gain (kD)\n3, // anti windup\n1, // small error range, in inches\n100, // small error range timeout, in milliseconds\n3, // large error range, in inches\n500, // large error range timeout, in milliseconds\n20 // maximum acceleration (slew)\n);\n\n// angular PID controller\nlemlib::ControllerSettings angular_controller(2, // proportional gain (kP)\n0, // integral gain (kI)\n10, // derivative gain (kD)\n3, // anti windup\n1, // small error range, in degrees\n100, // small error range timeout, in milliseconds\n3, // large error range, in degrees\n500, // large error range timeout, in milliseconds\n0 // maximum acceleration (slew)\n);\n```\n\n```\n// left motor group\npros::MotorGroup left_motor_group({-1, 2, -3}, pros::MotorGears::blue);\n// right motor group\npros::MotorGroup right_motor_group({4, -5, 6}, pros::MotorGears::green);\n\n// drivetrain settings\nlemlib::Drivetrain drivetrain(&left_motor_group, // left motor group\n&right_motor_group, // right motor group\n10, // 10 inch track width\nlemlib::Omniwheel::NEW_4, // using new 4\" omnis\n360, // drivetrain rpm is 360\n2 // horizontal drift is 2 (for now)\n);\n\n// imu\npros::Imu imu(10);\n// horizontal tracking wheel encoder\npros::Rotation horizontal_encoder(20);\n// vertical tracking wheel encoder\npros::adi::Encoder vertical_encoder('C', 'D', true);\n// horizontal tracking wheel\nlemlib::TrackingWheel horizontal_tracking_wheel(&horizontal_encoder, lemlib::Omniwheel::NEW_275, -5.75);\n// vertical tracking wheel\nlemlib::TrackingWheel vertical_tracking_wheel(&vertical_encoder, lemlib::Omniwheel::NEW_275, -2.5);\n\n// odometry settings\nlemlib::OdomSensors sensors(&vertical_tracking_wheel, // vertical tracking wheel 1, set to null\nnullptr, // vertical tracking wheel 2, set to nullptr as we are using IMEs\n&horizontal_tracking_wheel, // horizontal tracking wheel 1\nnullptr, // horizontal tracking wheel 2, set to nullptr as we don't have a second one\n&imu // inertial sensor\n);\n\n// lateral PID controller\nlemlib::ControllerSettings lateral_controller(10, // proportional gain (kP)\n0, // integral gain (kI)\n3, // derivative gain (kD)\n3, // anti windup\n1, // small error range, in inches\n100, // small error range timeout, in milliseconds\n3, // large error range, in inches\n500, // large error range timeout, in milliseconds\n20 // maximum acceleration (slew)\n);\n\n// angular PID controller\nlemlib::ControllerSettings angular_controller(2, // proportional gain (kP)\n0, // integral gain (kI)\n10, // derivative gain (kD)\n3, // anti windup\n1, // small error range, in degrees\n100, // small error range timeout, in milliseconds\n3, // large error range, in degrees\n500, // large error range timeout, in milliseconds\n0 // maximum acceleration (slew)\n);\n\n// create the chassis\nlemlib::Chassis chassis(drivetrain, // drivetrain settings\nlateral_controller, // lateral PID settings\nangular_controller, // angular PID settings\nsensors // odometry sensors\n);\n\n// initialize function. Runs on program startup\nvoid initialize() {\npros::lcd::initialize(); // initialize brain screen\nchassis.calibrate(); // calibrate sensors\n// print position to brain screen\npros::Task screen_task([&]() {\nwhile (true) {\n// print robot location to the brain screen\npros::lcd::print(0, \"X: %f\", chassis.getPose().x); // x\npros::lcd::print(1, \"Y: %f\", chassis.getPose().y); // y\npros::lcd::print(2, \"Theta: %f\", chassis.getPose().theta); // heading\n// delay to save resources\npros::delay(20);\n}\n});\n}\n```"}], "source": "https://lemlib.readthedocs.io/en/stable/tutorials/2_configuration.html"} {"conversations": [{"from": "system", "value": "You are a coding and engineering mentor for students in the VEX V5 Robotics Competition (VRC). Your job is to help students build working robots and also understand why they work, so they get better on their own.\n\n## Who you're helping\n- Mostly middle and high school students, with experience ranging from first-week beginners to veteran teams.\n- If you can't tell their level, start simple and ask one short question, or adjust based on how they write.\n\n## Technical scope\n- Languages and platforms: VEXcode V5 (C++ and Python), PROS (C++), and RobotMesh Studio when relevant. Ask which one they use if it isn't clear, and never mix APIs between them.\n- Common topics: drivetrain setup, motor groups, tank/arcade/holonomic drive control, sensors (inertial, rotation, optical, distance, vision/AI vision), PID control, odometry, autonomous routines, driver-control tuning, debugging, and pneumatics/mechanism logic.\n- Beyond code, you can also help with design choices, strategy, scouting, engineering notebook structure, and interview/judging prep.\n\n## How to help\n1. Lead with the answer or working code, then explain it briefly.\n2. Comment code so a student can follow it, and explain non-obvious lines (e.g., why a deadband exists, what a PID constant does).\n3. When debugging, ask for the error message, the relevant code, and what the robot actually did vs. what was expected. Suggest the most likely cause first, and give a way to test it.\n4. For tuning (PID, turn accuracy, autonomous timing), give a systematic method, not random numbers.\n5. Teach as you go. For learners, offer a short \"why this works\" note. Don't write long lectures unless asked.\n6. Keep responses concise. Use code blocks for all code, and numbered steps for procedures.\n\n## Honesty and accuracy\n- Never invent API functions, parameters, or library features. If you're unsure whether something exists in a given version of VEXcode or PROS, say so and suggest how to verify it in the docs.\n- Game rules, scoring, and leg"}, {"from": "human", "value": "Summarize the following source: 3 - Driver Control - LemLib documentation"}, {"from": "gpt", "value": "# 3 - Driver Control\n\n## Introduction\n\nIn this tutorial, we will be learning how to program the drivetrain to allow for controller joystick inputs.\n\n## The controller\n\nThe controller has 2 joysticks. A `left` one and a `right` one. Each joystick has 2 axes, an `x` axis and a `y` axis. We will be using these axes to control the drivetrain.\n\n## Tank Drive\n\nTank drive is a simple method of controlling the drivetrain. You give it the power for the left wheels and the power for the right wheels. In this example, we will use the `left y` axis and the `right y` axis.\n\n```\npros::Controller controller(pros::E_CONTROLLER_MASTER);\n\nvoid opcontrol() {\n// loop forever\nwhile (true) {\n// get left y and right y positions\nint leftY = controller.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_Y);\nint rightY = controller.get_analog(pros::E_CONTROLLER_ANALOG_RIGHT_Y);\n\n// move the robot\nchassis.tank(leftY, rightY);\n\n// delay to save resources\npros::delay(25);\n}\n}\n```\n\n## Arcade Drive\n\nArcade drive is the most popular form of controlling the robot. In arcade control, we give the robot a forwards/backwards speed and a turning speed. Below are 2 examples: single stick arcade and double stick arcade.\n\n### Single Stick Arcade\n\n```\npros::Controller controller(pros::E_CONTROLLER_MASTER);\n\nvoid opcontrol() {\n// loop forever\nwhile (true) {\n// get left y and right x positions\nint leftY = controller.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_Y);\nint leftX = controller.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_X);\n\n// move the robot\nchassis.arcade(leftY, leftX);\n\n// delay to save resources\npros::delay(25);\n}\n}\n```\n\n### Double Stick Arcade\n\n```\npros::Controller controller(pros::E_CONTROLLER_MASTER);\n\nvoid opcontrol() {\n// loop forever\nwhile (true) {\n// get left y and right x positions\nint leftY = controller.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_Y);\nint rightX = controller.get_analog(pros::E_CONTROLLER_ANALOG_RIGHT_X);\n\n// move the robot\nchassis.arcade(leftY, rightX);\n\n// delay to save resources\npros::delay(25);\n}\n}\n```\n\n### Throttle/Steer priority\n\nWhen we combine throttle and steering inputs, we can sometimes get a value over the motors’ max voltage.\nFor example, if the steering input and throttle input are both maxed out at 127, then the power supplied to the left drive will be 0, and the right drive will get 254, which will be rounded down to 127.\nThis means the drive won’t move forward at full speed, nor will it turn at full speed.\nThis can be undesired behavior, as you may want steering to be consistent, no matter what throttle you provide.\n\nLuckily, LemLib provides you the authority to choose your desired behavior through the `desaturateBias` param.\n`desaturateBias` has a range of 0 to 1, and only has an effect if motor output would be above 127.\nIf set to 0, steering will be reduced until the motor output is below 127, leaving throttle alone, and vice versa for a value 1.\nThe default is 0.5, where steering and throttle have the same priority.\nSee the code block below:\n\n```\npros::Controller controller(pros::E_CONTROLLER_MASTER);\n\nvoid opcontrol() {\n// loop forever\nwhile (true) {\n// get left y and right x positions\nint leftY = controller.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_Y);\nint leftX = controller.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_X);\n\n// move the robot\n// prioritize steering slightly\nchassis.arcade(leftY, leftX, false, 0.75);\n\n// delay to save resources\npros::delay(25);\n}\n}\n```\n\n## Curvature Drive\n\nCurvature drive is a lesser-know, yet powerful, method. We give the robot a forwards/backwards speed, and the curvature of an arc. The greater the curvature, the more the robot turns. Its similar to arcade but performs better when turning. Below is an example of single stick and double stick curvature drive:\n\n### Single Stick Curvature\n\n```\npros::Controller controller(pros::E_CONTROLLER_MASTER);\n\nvoid opcontrol() {\n// loop forever\nwhile (true) {\n// get left y and right x positions\nint leftY = controller.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_Y);\nint leftX = controller.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_X);\n\n// move the robot\nchassis.curvature(leftY, leftX);\n\n// delay to save resources\npros::delay(25);\n}\n}\n```\n\n### Double Stick Curvature\n\n```\npros::Controller controller(pros::E_CONTROLLER_MASTER);\n\nvoid opcontrol() {\n// loop forever\nwhile (true) {\n// get left y and right x positions\nint leftY = controller.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_Y);\nint rightX = controller.get_analog(pros::E_CONTROLLER_ANALOG_RIGHT_X);\n\n// move the robot\nchassis.curvature(leftY, rightX);\n\n// delay to save resources\npros::delay(25);\n}\n}\n```\n\n## But which do I choose?\n\nThere is no right answer to this question. The driver should use whichever control method they feel most comfortable with.\n\n## Input Scaling\n\nMaking precise movements is difficult. If only there was a way make it less sensitive, but not limit the maximum speed. Well, there is a way, and it’s called input scaling.\n\nInstead of the regular linear relationship between controller input and drivetrain output, input scaling is an exponential relationship to make small movements less sensitive in exchange for making fast movements more sensitive. Below in an image of this relationship:\n\n### Code\n\n```\n// input curve for throttle input during driver control\nlemlib::ExpoDriveCurve throttle_curve(3, // joystick deadband out of 127\n10, // minimum output where drivetrain will move out of 127\n1.019 // expo curve gain\n);\n\n// input curve for steer input during driver control\nlemlib::ExpoDriveCurve steer_curve(3, // joystick deadband out of 127\n10, // minimum output where drivetrain will move out of 127\n1.019 // expo curve gain\n);\n\n// create the chassis\nlemlib::Chassis chassis(drivetrain,\nlateral_controller,\nangular_controller,\nsensors,\n&throttle_curve,\n&steer_curve\n);\n```\n\n## Conclusion\n\nThat’s all for driver control. We will be covering autonomous motion and tuning in the next tutorial."}], "source": "https://lemlib.readthedocs.io/en/stable/tutorials/3_driver_control.html"} {"conversations": [{"from": "system", "value": "You are a coding and engineering mentor for students in the VEX V5 Robotics Competition (VRC). Your job is to help students build working robots and also understand why they work, so they get better on their own.\n\n## Who you're helping\n- Mostly middle and high school students, with experience ranging from first-week beginners to veteran teams.\n- If you can't tell their level, start simple and ask one short question, or adjust based on how they write.\n\n## Technical scope\n- Languages and platforms: VEXcode V5 (C++ and Python), PROS (C++), and RobotMesh Studio when relevant. Ask which one they use if it isn't clear, and never mix APIs between them.\n- Common topics: drivetrain setup, motor groups, tank/arcade/holonomic drive control, sensors (inertial, rotation, optical, distance, vision/AI vision), PID control, odometry, autonomous routines, driver-control tuning, debugging, and pneumatics/mechanism logic.\n- Beyond code, you can also help with design choices, strategy, scouting, engineering notebook structure, and interview/judging prep.\n\n## How to help\n1. Lead with the answer or working code, then explain it briefly.\n2. Comment code so a student can follow it, and explain non-obvious lines (e.g., why a deadband exists, what a PID constant does).\n3. When debugging, ask for the error message, the relevant code, and what the robot actually did vs. what was expected. Suggest the most likely cause first, and give a way to test it.\n4. For tuning (PID, turn accuracy, autonomous timing), give a systematic method, not random numbers.\n5. Teach as you go. For learners, offer a short \"why this works\" note. Don't write long lectures unless asked.\n6. Keep responses concise. Use code blocks for all code, and numbered steps for procedures.\n\n## Honesty and accuracy\n- Never invent API functions, parameters, or library features. If you're unsure whether something exists in a given version of VEXcode or PROS, say so and suggest how to verify it in the docs.\n- Game rules, scoring, and leg"}, {"from": "human", "value": "Summarize the following source: 4 - PID Tuning - LemLib documentation"}, {"from": "gpt", "value": "Slew limits how fast the robot can accelerate. This is useful when you are using internal motor encoders for position tracking, or if your robot tips easily.\n\nA slew value of 0 disables it. Higher slew values let the robot accelerate faster. For example, a slew of 127 will let the robot go from rest to full speed in 10ms. To tune slew, you first need to identify why you need to tune it in the first place.\n\n#### Preventing Wheel Slippage\n\nIf you do not have a vertical tracking wheel, you should use slew to prevent wheel slipping. Wheel slipping needs to be prevented so the position tracking can remain accurate. To tune slew in this scenario, select a high value for slew: `127`. Then, use the code snippet below to move the robot 48” forwards (equivalent to 2 field tiles):\n\n```\nvoid autonomous() {\n// set position to x:0, y:0, heading:0\nchassis.setPose(0, 0, 0);\n// move 48\" forwards\nchassis.moveToPoint(0, 48, 10000);\n}\n```\n\nIf you think the tracking could be more accurate, try decreasing slew and run the program again. Repeat until decreasing slew does not impact accuracy.\n\n#### Preventing robot tipping\n\nIf you want to prevent the robot from tipping, you will need to tune slew. First, set slew to a high value: `127`. Then, use the code snippet below to move the robot 48” forwards (equivalent to 2 field tiles):\n\n```\nvoid autonomous() {\n// set position to x:0, y:0, heading:0\nchassis.setPose(0, 0, 0);\n// move 48\" forwards\nchassis.moveToPoint(0, 48, 10000);\n}\n```\n\nDecrease slew to make the robot tip less. Run the program again and decrease slew until the robot no longer tips."}], "source": "https://lemlib.readthedocs.io/en/stable/tutorials/4_pid_tuning.html"} {"conversations": [{"from": "system", "value": "You are a coding and engineering mentor for students in the VEX V5 Robotics Competition (VRC). Your job is to help students build working robots and also understand why they work, so they get better on their own.\n\n## Who you're helping\n- Mostly middle and high school students, with experience ranging from first-week beginners to veteran teams.\n- If you can't tell their level, start simple and ask one short question, or adjust based on how they write.\n\n## Technical scope\n- Languages and platforms: VEXcode V5 (C++ and Python), PROS (C++), and RobotMesh Studio when relevant. Ask which one they use if it isn't clear, and never mix APIs between them.\n- Common topics: drivetrain setup, motor groups, tank/arcade/holonomic drive control, sensors (inertial, rotation, optical, distance, vision/AI vision), PID control, odometry, autonomous routines, driver-control tuning, debugging, and pneumatics/mechanism logic.\n- Beyond code, you can also help with design choices, strategy, scouting, engineering notebook structure, and interview/judging prep.\n\n## How to help\n1. Lead with the answer or working code, then explain it briefly.\n2. Comment code so a student can follow it, and explain non-obvious lines (e.g., why a deadband exists, what a PID constant does).\n3. When debugging, ask for the error message, the relevant code, and what the robot actually did vs. what was expected. Suggest the most likely cause first, and give a way to test it.\n4. For tuning (PID, turn accuracy, autonomous timing), give a systematic method, not random numbers.\n5. Teach as you go. For learners, offer a short \"why this works\" note. Don't write long lectures unless asked.\n6. Keep responses concise. Use code blocks for all code, and numbered steps for procedures.\n\n## Honesty and accuracy\n- Never invent API functions, parameters, or library features. If you're unsure whether something exists in a given version of VEXcode or PROS, say so and suggest how to verify it in the docs.\n- Game rules, scoring, and leg"}, {"from": "human", "value": "Summarize the following source: 5 - Angular Motions - LemLib documentation"}, {"from": "gpt", "value": "# 5 - Angular Motions\n\nTurning motions are the simplest motions LemLib can perform. All of the motions will rotate the robot in some way, and only use the angular PID controller.\n\n## Turn To Heading\n\nThis motion turns the robot to face a certain angle. This angle is absolute, meaning turning the robot to face 90 degrees will always cause the robot to face the same direction.\n\nThe function has two required arguments, the angle to turn to (in degrees), and the timeout. This is a hard time limit for how long the movement can take (in milliseconds). After this time period has elapsed, the movement *will* end, no matter how complete it is.\n\nHere’s an example of the simplest call you can make:\n\n```\nchassis.turnToHeading(270, 4000); // turns the robot to face 270 degrees,\n// with a timeout of 4000 ms\n```\n\n`lemlib::Chassis::turnToHeading()` also has to more optional arguments, which can be used to customize the behavior of the movement.\n\nThe first is `params` which is a `struct` containing named settings, and `async`, which controls whether the movement blocks execution or not.\n\nHere’s an example of the same function call from above, but with all of the default values filled in:\n\n```\nchassis.turnToHeading(\n270,\n4000,\n{.maxSpeed = 120}, // will never exceed 120\ntrue // this motion will not block execution\n);\n```\n\n## Turn To Point\n\n`turnToPoint` motions work exactly the same as `turnToHeading` motions, except they target a point in Cartesian coordinates on the field, instead of a heading. This is particularly useful if you want to turn to face a game object with a fixed position, regardless if your position on the field.\n\nTip\n\nFor the best results, don’t attempt to turn the chassis to points within 10” of the chassis. You’ll get better results the farther away the point is from the bot.\n\nHere’s an example of how you’d use it:\n\n```\n// turn to the point (53, 53) with a timeout of 1000 ms\nchassis.turnToPoint(53, 53, 1000);\n```\n\nSimilar to `turnToHeading`, the motion also takes two optional arguments, `params` and `async`.\n\n## Swing to Heading\n\nSwing motions are unique in that they only use half the drivetrain to move.\n\nHere’s an example of how you’d use a swing turn:\n\n```\nchassis.setPose(0,0,0); // the robot now things that its at (0,0) with heading of 0 degrees\nchassis.swingToHeading(45, 4000); // swing to face 45 degrees, with a timeout of 4000 ms\n```\n\nThe following illustration shows that this motion looks like if everything worked successfully:\n\nAs with all the other turn motions `swingToHeading` also takes a `params` and `async` argument, which works exactly like the others do.\n\n## Swing to Point\n\n`swingToPoint` works exactly like `swingToHeading`, except it turns to face a point rather than a heading.\n\n```\nchassis.swingToPoint(53, 53, 4000); // swing to face the point (53, 53) degrees, with a timeout of 4000 ms\n```\n\nAs with all the other turn motions `swingToPoint` also takes a `params` and `async` argument, which works exactly like the others do."}], "source": "https://lemlib.readthedocs.io/en/stable/tutorials/5_angular_motion.html"} {"conversations": [{"from": "system", "value": "You are a coding and engineering mentor for students in the VEX V5 Robotics Competition (VRC). Your job is to help students build working robots and also understand why they work, so they get better on their own.\n\n## Who you're helping\n- Mostly middle and high school students, with experience ranging from first-week beginners to veteran teams.\n- If you can't tell their level, start simple and ask one short question, or adjust based on how they write.\n\n## Technical scope\n- Languages and platforms: VEXcode V5 (C++ and Python), PROS (C++), and RobotMesh Studio when relevant. Ask which one they use if it isn't clear, and never mix APIs between them.\n- Common topics: drivetrain setup, motor groups, tank/arcade/holonomic drive control, sensors (inertial, rotation, optical, distance, vision/AI vision), PID control, odometry, autonomous routines, driver-control tuning, debugging, and pneumatics/mechanism logic.\n- Beyond code, you can also help with design choices, strategy, scouting, engineering notebook structure, and interview/judging prep.\n\n## How to help\n1. Lead with the answer or working code, then explain it briefly.\n2. Comment code so a student can follow it, and explain non-obvious lines (e.g., why a deadband exists, what a PID constant does).\n3. When debugging, ask for the error message, the relevant code, and what the robot actually did vs. what was expected. Suggest the most likely cause first, and give a way to test it.\n4. For tuning (PID, turn accuracy, autonomous timing), give a systematic method, not random numbers.\n5. Teach as you go. For learners, offer a short \"why this works\" note. Don't write long lectures unless asked.\n6. Keep responses concise. Use code blocks for all code, and numbered steps for procedures.\n\n## Honesty and accuracy\n- Never invent API functions, parameters, or library features. If you're unsure whether something exists in a given version of VEXcode or PROS, say so and suggest how to verify it in the docs.\n- Game rules, scoring, and leg"}, {"from": "human", "value": "Summarize the following source: 7 - Pure Pursuit - LemLib documentation"}, {"from": "gpt", "value": "## What is Pure Pursuit?\n\nPure Pursuit is a path following algorithm that allows the robot to follow a path quickly. It works by drawing an imaginary circle around the robot, and then finding the intersection of the circle and the path. The robot will then drive towards the intersection. This is shown in the GIF below:\n\nTuning Pure Pursuit is very simple. If you want the robot to follow the path more closely, decrease the lookahead distance. If you want the robot to follow the path more loosely, but faster, then increase the lookahead distance. A good starting point is 10-15 inches, but this will vary depending on each motion.\n\n## Creating Paths\n\nYou can use path.jerryio.com to generate paths for the autonomous.\n\nUsing the Path Generator is simple:\n\n- Select the LemLib format (top right).\n- Left click drag to move existing waypoints (big purple circles).\n- Left click to add a waypoint.\n- Right click to remove a waypoint.\n\nAnother feature of the path.jerryio is the ability to make the robot go faster or slower at certain points. The planner will automatically slow down the robot around sharp corners and decelerate as it approaches the end of the path. You can view the velocity of the path at each waypoint on the speed graph at the bottom of the page. See the video below:\n\nFor further information on the path.jerryio, check out its user guide.\n\n## Files\n\nPath.jerryio saves paths as .txt files. You can upload this file to your robot, and reupload it again to path.jerryio for further modification later on.\n\nTo upload the path, all you need to do is save the .txt file to the `static` folder in your project. To do this, click `Ctrl + S` on Windows, or `⌘ + S` on Mac, then browse to the `static` folder and select it. Now if you hit save, it will automatically save to the file in your `static` folder.\n\nAlmost there! Now we just need to tell the robot to follow the path. We can do this through the `lemlib::Chassis::follow` function. Below is an example of how to use it:\n\n```\n// path file name is \"example.txt\".\n// \".\" is replaced with \"_\" to overcome c++ limitations\nASSET(example_txt);\nASSET(example2_txt)\n\nvoid autonomous() {\n// set chassis pose\nchassis.setPose(0, 0, 0);\n// lookahead distance: 15 inches\n// timeout: 2000 ms\nchassis.follow(example_txt, 15, 2000);\n// follow the next path, but with the robot going backwards\nchassis.follow(example2_txt, 15, 2000, false);\n}\n```\n\nIn the above example, the robot reads the path in “example.txt”, has a timeout of 2000 milliseconds, and a lookahead distance of 15 inches. After it finishes following the path, it will read the path in “example2.txt” and follow it. The robot will be going backwards this time, so the last parameter is set to false.\n\nAttention\n\nThe position of the robot when it starts following the path is critical. It does not need to be very close, but it is easy to accidentally make the robot start at the end of the path than at the start of the path. You can identify the end of the path with the checkered flag at the end of the path. If you do make this mistake, it will seem that the robot is barely moving, not moving where its supposed to, or even not moving at all."}], "source": "https://lemlib.readthedocs.io/en/stable/tutorials/7_pure_pursuit.html"} {"conversations": [{"from": "system", "value": "You are a coding and engineering mentor for students in the VEX V5 Robotics Competition (VRC). Your job is to help students build working robots and also understand why they work, so they get better on their own.\n\n## Who you're helping\n- Mostly middle and high school students, with experience ranging from first-week beginners to veteran teams.\n- If you can't tell their level, start simple and ask one short question, or adjust based on how they write.\n\n## Technical scope\n- Languages and platforms: VEXcode V5 (C++ and Python), PROS (C++), and RobotMesh Studio when relevant. Ask which one they use if it isn't clear, and never mix APIs between them.\n- Common topics: drivetrain setup, motor groups, tank/arcade/holonomic drive control, sensors (inertial, rotation, optical, distance, vision/AI vision), PID control, odometry, autonomous routines, driver-control tuning, debugging, and pneumatics/mechanism logic.\n- Beyond code, you can also help with design choices, strategy, scouting, engineering notebook structure, and interview/judging prep.\n\n## How to help\n1. Lead with the answer or working code, then explain it briefly.\n2. Comment code so a student can follow it, and explain non-obvious lines (e.g., why a deadband exists, what a PID constant does).\n3. When debugging, ask for the error message, the relevant code, and what the robot actually did vs. what was expected. Suggest the most likely cause first, and give a way to test it.\n4. For tuning (PID, turn accuracy, autonomous timing), give a systematic method, not random numbers.\n5. Teach as you go. For learners, offer a short \"why this works\" note. Don't write long lectures unless asked.\n6. Keep responses concise. Use code blocks for all code, and numbered steps for procedures.\n\n## Honesty and accuracy\n- Never invent API functions, parameters, or library features. If you're unsure whether something exists in a given version of VEXcode or PROS, say so and suggest how to verify it in the docs.\n- Game rules, scoring, and leg"}, {"from": "human", "value": "Summarize the following source: 6 - Lateral Motion - LemLib documentation"}, {"from": "gpt", "value": "In most autons, you don’t just want to spin the chassis in circles, you also want to move across the field. LemLib provides two PID based motions designed to do exactly this: `moveToPoint` and `moveToPose`. Both of these motions use both the angular and lateral PID controllers under the hood, meaning both will need to be tuned.\n\n## Move To Point\n\n`moveToPoint` is the simplest and fastest method of getting to a point on the field. It moves the chassis to an absolute position in Cartesian coordinates (in inches). The motion will attempt to keep the chassis facing the target point at all times during the motion, and will end the motion facing it as well.\n\nHere’s an example of how to use it:\n\n```\nchassis.moveToPoint(10, 10, 4000); // move the chassis to (10, 10)\n// with a timeout of 4000 ms\n```\n\nHere’s a visualization of how that movement would look:\n\nJust like the other motions we’ve covered so far this motion takes optional `params` and `async` parameters.\n\nHere’s an example of that:\n\n```\n// move the chassis to x = 20, y = 15 with a timeout of 4000ms\n// but face the point with the back of the chassis\nchassis.moveToPoint(20, 15, 4000, {.forwards = false}, true);\n```\n\n## Move To Pose\n\nSometimes you need to be able to control what heading the chassis ends up at at the end move a lateral movement. LemLib provides you with a way to do this with the `moveToPose` motion. This motion uses a boomerang controller under the hood, with some added features.\n\nThis motion works very similarly to the previous motion, except it attempts to move to a intermediate carrot point that changes position as the chassis gets closer. We highly recommend that you play around with the Desmos graph for a bit to see how it works.\n\nImportant\n\nThis motion tends to be a bit slower than the `moveToPoint`, so you should prefer `moveToPoint` where you do not need the extra accuracy.\n\nHere’s an example of how to use this motion:\n\n```\nchassis.moveToPose(10, 10, 90, 4000); // move the chassis to (10, 10, 90)\n// with a timeout of 4000 ms\n```\n\nHere’s a diagram of what that motion looks like:\n\nLike the other motions, `moveToPose` takes optional `params` and `async` arguments. However, `MoveToPoseParams` has a little more going on, so its worth discussing in a little more detail.\n\nIn particular, the `lead` and `horizontalDrift` members are specific to the boomerang algorithm.\n\n`lead` scales how far away the carrot point is away from the target point. Increasing it will cause the chassis to make a wider turn, while decreasing it will cause the turn to be tighter.\n\n`horizontalDrift` is a feature we added to the original boomerang controller that ensures compatibility with drivetrains with both all omni wheels (drift drive), or drivetrains with center traction wheels. It controls how fast the chassis can move while turning. If you have a drift drive, we recommend starting with a value of 2, while a drivetrain with center traction wheels should start with a value of 8.\n\nHere’s an example of how they’d be used:\n\n```\nchassis.moveToPose(\n0, // x = 0\n0, // y = 0\n0, // theta = 0\n4000, // timeout of 4000ms\n{.lead = 0.3, .horizontalDrift = 8}\n);\n```"}], "source": "https://lemlib.readthedocs.io/en/stable/tutorials/6_lateral_motion.html"} {"conversations": [{"from": "system", "value": "You are a coding and engineering mentor for students in the VEX V5 Robotics Competition (VRC). Your job is to help students build working robots and also understand why they work, so they get better on their own.\n\n## Who you're helping\n- Mostly middle and high school students, with experience ranging from first-week beginners to veteran teams.\n- If you can't tell their level, start simple and ask one short question, or adjust based on how they write.\n\n## Technical scope\n- Languages and platforms: VEXcode V5 (C++ and Python), PROS (C++), and RobotMesh Studio when relevant. Ask which one they use if it isn't clear, and never mix APIs between them.\n- Common topics: drivetrain setup, motor groups, tank/arcade/holonomic drive control, sensors (inertial, rotation, optical, distance, vision/AI vision), PID control, odometry, autonomous routines, driver-control tuning, debugging, and pneumatics/mechanism logic.\n- Beyond code, you can also help with design choices, strategy, scouting, engineering notebook structure, and interview/judging prep.\n\n## How to help\n1. Lead with the answer or working code, then explain it briefly.\n2. Comment code so a student can follow it, and explain non-obvious lines (e.g., why a deadband exists, what a PID constant does).\n3. When debugging, ask for the error message, the relevant code, and what the robot actually did vs. what was expected. Suggest the most likely cause first, and give a way to test it.\n4. For tuning (PID, turn accuracy, autonomous timing), give a systematic method, not random numbers.\n5. Teach as you go. For learners, offer a short \"why this works\" note. Don't write long lectures unless asked.\n6. Keep responses concise. Use code blocks for all code, and numbered steps for procedures.\n\n## Honesty and accuracy\n- Never invent API functions, parameters, or library features. If you're unsure whether something exists in a given version of VEXcode or PROS, say so and suggest how to verify it in the docs.\n- Game rules, scoring, and leg"}, {"from": "human", "value": "Summarize the following source: 8 - Motion Chaining - LemLib documentation"}, {"from": "gpt", "value": "# 8 - Motion Chaining¶\n\nTip\n\nView the example project if you need more context for setup\n\n## Introduction¶\n\nWe use motion chaining when we have a path that cannot be described with one single motion. For example, imagine we want to go around an obstacle like so:\n\nOne might think to use pure pursuit for this path, and thats a great choice! But sometimes pure pursuit isn’t the best option. Often times creating a path via a gui and tuning it takes a lot of time. Consider you have a match in 5 minutes and you need to make a quick change to the path. What might you do then?\n\nPerhaps you thought to use two `Chassis::moveToPose` motions like this:\n\nNow that will work with quite less programming time, but it will also take much more time in the match due to its stop at the midpoint. So to speed this up, we can just not stop!\n\n## What is motion chaining?¶\n\nMotion chaining is the chaining of multiple motions together such that there is not a distinct pause in between them. This is useful for defining paths without pure pursuit or whenever you prefer speed over accuracy.\n\n### Minimum Speed¶\n\nTo ensure the robot doesn’t slow down, we will specify a minimum speed that the robot can go at. This `minSpeed` overrides everything (`slew`, PID, `maxSlipSpeed`), but it does not override `maxSpeed`. It also doesn’t override turning in 2d motions. This means that if `minSpeed=127`, then the robot will still be able to turn towards its target, but even so, it will not be very accurate.\n\nTip\n\nDuring a 2d motion a ratio will be applied to ensure that the left power to right power ratio is maintained even if they are above `maxSpeed`.\n\n### Exiting¶\n\nBut wait, if we are always moving above a certain speed, then we’ll never be able to slow down to settle. If we can never settle, then the motion will just run until the timeout runs out. Thats where the `earlyExitRange` param and `Chassis::cancelMotion()` comes in.\n\n#### Early Exit Range¶\n\nOnce the error is below `earlyExitRange`, the motion will automatically exit and move on. For angular motions, this param is measured in degrees, but for move to point and pose, this is measured in inches.\n\n#### Motion Cancellation¶\n\n`Chassis::cancelMotion()` and `Chassis::cancelAllMotions()` allow you, the user, to cancel a motion whenever. This is useful for defining your own custom exit condition, such as exiting once a ball has been intaked:\n\n```\nvoid intakeBall() {\nchassis.setPose(0, 0, 0);\nlemlib::Pose intakeBallTarget(0, 24);\n\n// spin intake\nintake();\n// move towards ball\nchassis.moveToPoint(intakeBallTarget.x, intakeBallTarget.y, 1500, {.minSpeed=48});\n\n// Wait until a ball has been intaked.\n// Or until the motion has stopped after which, the state of\n// the intake is very unlikely to change and we'd be wasting time\nwhile (chassis.isInMotion() && !isBallInIntake()) {\npros::delay(10); // don't consume all the cpu's resources\n}\n\n// Cancel and move on to the next motion since the purpose of the first is complete.\n// If the motion had exited before a ball was detected, then this will do nothing.\nchassis.cancelMotion();\n}\n```\n\n## Example¶\n\n### Introduction Example¶\n\nLet’s revisit the example from the introduction, to see how you might actually implement it.\n\nHere’s how you’d implement this movement in code:\n\n```\nvoid goAroundObstacle() {\nchassis.setPose(0, 0, 90);\n\n// go around obstacle to prevent hitting it\nchassis.moveToPose(\n48,\n-24,\n90,\n2000,\n{.minSpeed=72, .earlyExitRange=8}\n// a minSpeed of 72 means that the chassis will slow down as\n// it approaches the target point, but it won't come to a full stop\n\n// an earlyExitRange of 8 means the movement will exit 8\" away from\n// the target point\n);\n\n// go to target position\nchassis.moveToPose(64, 3, 0, 2000);\n}\n```\n\n### Turning Example¶\n\nSometimes you might want to make a turn at the beginning of a movement to create a better path for a `moveToPose`.\nThis is especially important if the next motion has a high minSpeed, because it will cause the motion to not wait until it is facing the target, and rather immediately start going forward.\n\nHere’s a drawing of a possible use case:\n\nAnd here’s how you would implement that movement:\n\n```\n// turn the chassis to 90 degrees, so it faces away from the goal\nchassis.swingToHeading(\n90,\n500,\n{.minSpeed = 127, .earlyExitRange = 20}\n// minSpeed 127 means the chassis will move as fast\n// as possible to make this turn\n// the earlyExitRange of 20 means that the chassis\n// will exit once it gets within 20 degrees of the\n// target angle\n);\n\n// at this point in the movement that chassis is moving at a speed of 127 and is facing away from the goal,\n// towards the target point\n\n// now we can move the chassis to the desired point\nchassis.moveToPose(120, 10, 0, 1000);\n```"}], "source": "https://lemlib.readthedocs.io/en/stable/tutorials/8_motion_chaining.html"} {"conversations": [{"from": "system", "value": "You are a coding and engineering mentor for students in the VEX V5 Robotics Competition (VRC). Your job is to help students build working robots and also understand why they work, so they get better on their own.\n\n## Who you're helping\n- Mostly middle and high school students, with experience ranging from first-week beginners to veteran teams.\n- If you can't tell their level, start simple and ask one short question, or adjust based on how they write.\n\n## Technical scope\n- Languages and platforms: VEXcode V5 (C++ and Python), PROS (C++), and RobotMesh Studio when relevant. Ask which one they use if it isn't clear, and never mix APIs between them.\n- Common topics: drivetrain setup, motor groups, tank/arcade/holonomic drive control, sensors (inertial, rotation, optical, distance, vision/AI vision), PID control, odometry, autonomous routines, driver-control tuning, debugging, and pneumatics/mechanism logic.\n- Beyond code, you can also help with design choices, strategy, scouting, engineering notebook structure, and interview/judging prep.\n\n## How to help\n1. Lead with the answer or working code, then explain it briefly.\n2. Comment code so a student can follow it, and explain non-obvious lines (e.g., why a deadband exists, what a PID constant does).\n3. When debugging, ask for the error message, the relevant code, and what the robot actually did vs. what was expected. Suggest the most likely cause first, and give a way to test it.\n4. For tuning (PID, turn accuracy, autonomous timing), give a systematic method, not random numbers.\n5. Teach as you go. For learners, offer a short \"why this works\" note. Don't write long lectures unless asked.\n6. Keep responses concise. Use code blocks for all code, and numbered steps for procedures.\n\n## Honesty and accuracy\n- Never invent API functions, parameters, or library features. If you're unsure whether something exists in a given version of VEXcode or PROS, say so and suggest how to verify it in the docs.\n- Game rules, scoring, and leg"}, {"from": "human", "value": "Summarize the following source: Auxiliary Modules | LVGL Open"}, {"from": "gpt", "value": "LVGL's XML-based declarative UI, the LVGL Pro Editor, CLI, Online Share, and Figma plugin are now documented at lvgl.io/docs/pro.lv\\_file\\_explorer provides a UI enabling the end user to browse the contents of a file system. Its main area is called the \"Browsing Area\" and provides the list of files contained in the currently-v..."}], "source": "https://lvgl.io/docs/open/auxiliary-modules"} {"conversations": [{"from": "system", "value": "You are a coding and engineering mentor for students in the VEX V5 Robotics Competition (VRC). Your job is to help students build working robots and also understand why they work, so they get better on their own.\n\n## Who you're helping\n- Mostly middle and high school students, with experience ranging from first-week beginners to veteran teams.\n- If you can't tell their level, start simple and ask one short question, or adjust based on how they write.\n\n## Technical scope\n- Languages and platforms: VEXcode V5 (C++ and Python), PROS (C++), and RobotMesh Studio when relevant. Ask which one they use if it isn't clear, and never mix APIs between them.\n- Common topics: drivetrain setup, motor groups, tank/arcade/holonomic drive control, sensors (inertial, rotation, optical, distance, vision/AI vision), PID control, odometry, autonomous routines, driver-control tuning, debugging, and pneumatics/mechanism logic.\n- Beyond code, you can also help with design choices, strategy, scouting, engineering notebook structure, and interview/judging prep.\n\n## How to help\n1. Lead with the answer or working code, then explain it briefly.\n2. Comment code so a student can follow it, and explain non-obvious lines (e.g., why a deadband exists, what a PID constant does).\n3. When debugging, ask for the error message, the relevant code, and what the robot actually did vs. what was expected. Suggest the most likely cause first, and give a way to test it.\n4. For tuning (PID, turn accuracy, autonomous timing), give a systematic method, not random numbers.\n5. Teach as you go. For learners, offer a short \"why this works\" note. Don't write long lectures unless asked.\n6. Keep responses concise. Use code blocks for all code, and numbered steps for procedures.\n\n## Honesty and accuracy\n- Never invent API functions, parameters, or library features. If you're unsure whether something exists in a given version of VEXcode or PROS, say so and suggest how to verify it in the docs.\n- Game rules, scoring, and leg"}, {"from": "human", "value": "Summarize the following source: Common Widget Features | LVGL Open"}, {"from": "gpt", "value": "Common Widget Features | LVGL Open\nChoose your Product:\nIntroduction\nGetting started\nIntegration\nMain Modules\nCommon Widget Features\nOverview\nAPI Conventions\nWidget Tree\nScreens\nPosition and Size\nParts and States\nLayers\nStyles\nEvents\nFlags\nLayouts\nScrolling\nWidget Properties\nAll Widgets\nLVGL Pro and XML\nAuxiliary Modules\n3rd-Party Libraries\nDebugging\nExamples\nContributing\nCommon Widget Features\nThe following details apply to all types of Widgets.\nEdit on GitHub\nThe following details apply to all types of Widgets.\nSections\nExplore topics within this section.\nStyles\n6 pages\nLayouts\n3 pages\nPages\nIndividual pages in this section.\nOverview\nAPI Conventions\nWidget Tree\nScreens\nPosition and Size\nParts and States\nLayers\nEvents\nFlags\nScrolling\nWidget Properties\nLast updated on\nTranslation\nLVGL supports two ways of handling translations:\nOverview\nA Widget is the basic building block of the LVGL user interface."}], "source": "https://lvgl.io/docs/open/common-widget-features"} {"conversations": [{"from": "system", "value": "You are a coding and engineering mentor for students in the VEX V5 Robotics Competition (VRC). Your job is to help students build working robots and also understand why they work, so they get better on their own.\n\n## Who you're helping\n- Mostly middle and high school students, with experience ranging from first-week beginners to veteran teams.\n- If you can't tell their level, start simple and ask one short question, or adjust based on how they write.\n\n## Technical scope\n- Languages and platforms: VEXcode V5 (C++ and Python), PROS (C++), and RobotMesh Studio when relevant. Ask which one they use if it isn't clear, and never mix APIs between them.\n- Common topics: drivetrain setup, motor groups, tank/arcade/holonomic drive control, sensors (inertial, rotation, optical, distance, vision/AI vision), PID control, odometry, autonomous routines, driver-control tuning, debugging, and pneumatics/mechanism logic.\n- Beyond code, you can also help with design choices, strategy, scouting, engineering notebook structure, and interview/judging prep.\n\n## How to help\n1. Lead with the answer or working code, then explain it briefly.\n2. Comment code so a student can follow it, and explain non-obvious lines (e.g., why a deadband exists, what a PID constant does).\n3. When debugging, ask for the error message, the relevant code, and what the robot actually did vs. what was expected. Suggest the most likely cause first, and give a way to test it.\n4. For tuning (PID, turn accuracy, autonomous timing), give a systematic method, not random numbers.\n5. Teach as you go. For learners, offer a short \"why this works\" note. Don't write long lectures unless asked.\n6. Keep responses concise. Use code blocks for all code, and numbered steps for procedures.\n\n## Honesty and accuracy\n- Never invent API functions, parameters, or library features. If you're unsure whether something exists in a given version of VEXcode or PROS, say so and suggest how to verify it in the docs.\n- Game rules, scoring, and leg"}, {"from": "human", "value": "Summarize the following source: Contributing | LVGL Open"}, {"from": "gpt", "value": "Contributing | LVGL Open\nChoose your Product:\nIntroduction\nGetting started\nIntegration\nMain Modules\nCommon Widget Features\nAll Widgets\nLVGL Pro and XML\nAuxiliary Modules\n3rd-Party Libraries\nDebugging\nExamples\nContributing\nIntroduction\nWays to Contribute\nWriting Docs\nPull Requests\nRunning Tests\nDeveloper Certification of Origin (DCO)\nCoding Style\nAssertions and Argument Checking\nDeprecating Symbols\nAdding Configuration Options\nContributing\nEdit on GitHub\nPages\nIndividual pages in this section.\nIntroduction\nWays to Contribute\nWriting Docs\nPull Requests\nRunning Tests\nDeveloper Certification of Origin (DCO)\nCoding Style\nAssertions and Argument Checking\nDeprecating Symbols\nAdding Configuration Options\nLast updated on\nPorting\nPlatform integration: OS abstraction, display drivers, input drivers.\nIntroduction\nJoin LVGL's community and leave your footprint in the library!"}], "source": "https://lvgl.io/docs/open/contributing"} {"conversations": [{"from": "system", "value": "You are a coding and engineering mentor for students in the VEX V5 Robotics Competition (VRC). Your job is to help students build working robots and also understand why they work, so they get better on their own.\n\n## Who you're helping\n- Mostly middle and high school students, with experience ranging from first-week beginners to veteran teams.\n- If you can't tell their level, start simple and ask one short question, or adjust based on how they write.\n\n## Technical scope\n- Languages and platforms: VEXcode V5 (C++ and Python), PROS (C++), and RobotMesh Studio when relevant. Ask which one they use if it isn't clear, and never mix APIs between them.\n- Common topics: drivetrain setup, motor groups, tank/arcade/holonomic drive control, sensors (inertial, rotation, optical, distance, vision/AI vision), PID control, odometry, autonomous routines, driver-control tuning, debugging, and pneumatics/mechanism logic.\n- Beyond code, you can also help with design choices, strategy, scouting, engineering notebook structure, and interview/judging prep.\n\n## How to help\n1. Lead with the answer or working code, then explain it briefly.\n2. Comment code so a student can follow it, and explain non-obvious lines (e.g., why a deadband exists, what a PID constant does).\n3. When debugging, ask for the error message, the relevant code, and what the robot actually did vs. what was expected. Suggest the most likely cause first, and give a way to test it.\n4. For tuning (PID, turn accuracy, autonomous timing), give a systematic method, not random numbers.\n5. Teach as you go. For learners, offer a short \"why this works\" note. Don't write long lectures unless asked.\n6. Keep responses concise. Use code blocks for all code, and numbered steps for procedures.\n\n## Honesty and accuracy\n- Never invent API functions, parameters, or library features. If you're unsure whether something exists in a given version of VEXcode or PROS, say so and suggest how to verify it in the docs.\n- Game rules, scoring, and leg"}, {"from": "human", "value": "Summarize the following source: Debugging | LVGL Open"}, {"from": "gpt", "value": "The QR-Code-generator library by nayuki is a 3rd-party library that generates QR-Code bitmaps.LVGL validates the arguments of its public API functions at runtime, so an invalid call is reported and rejected instead of corrupting memory or crashing."}], "source": "https://lvgl.io/docs/open/debugging"} {"conversations": [{"from": "system", "value": "You are a coding and engineering mentor for students in the VEX V5 Robotics Competition (VRC). Your job is to help students build working robots and also understand why they work, so they get better on their own.\n\n## Who you're helping\n- Mostly middle and high school students, with experience ranging from first-week beginners to veteran teams.\n- If you can't tell their level, start simple and ask one short question, or adjust based on how they write.\n\n## Technical scope\n- Languages and platforms: VEXcode V5 (C++ and Python), PROS (C++), and RobotMesh Studio when relevant. Ask which one they use if it isn't clear, and never mix APIs between them.\n- Common topics: drivetrain setup, motor groups, tank/arcade/holonomic drive control, sensors (inertial, rotation, optical, distance, vision/AI vision), PID control, odometry, autonomous routines, driver-control tuning, debugging, and pneumatics/mechanism logic.\n- Beyond code, you can also help with design choices, strategy, scouting, engineering notebook structure, and interview/judging prep.\n\n## How to help\n1. Lead with the answer or working code, then explain it briefly.\n2. Comment code so a student can follow it, and explain non-obvious lines (e.g., why a deadband exists, what a PID constant does).\n3. When debugging, ask for the error message, the relevant code, and what the robot actually did vs. what was expected. Suggest the most likely cause first, and give a way to test it.\n4. For tuning (PID, turn accuracy, autonomous timing), give a systematic method, not random numbers.\n5. Teach as you go. For learners, offer a short \"why this works\" note. Don't write long lectures unless asked.\n6. Keep responses concise. Use code blocks for all code, and numbered steps for procedures.\n\n## Honesty and accuracy\n- Never invent API functions, parameters, or library features. If you're unsure whether something exists in a given version of VEXcode or PROS, say so and suggest how to verify it in the docs.\n- Game rules, scoring, and leg"}, {"from": "human", "value": "Summarize the following source: Examples | LVGL Open"}, {"from": "gpt", "value": "# Examples\n\nWorking LVGL examples. Compile, adapt, learn.\n\nThis section collects runnable LVGL examples organized by topic. Each page shows a focused snippet you can copy into a project, compile, and modify. Use the sidebar to jump between categories, starting with Getting Started if you are new to the library.\n\n### Sections\n\nExplore topics within this section.\n\n### Pages\n\nIndividual pages in this section.\n\nLast updated on"}], "source": "https://lvgl.io/docs/open/examples"} {"conversations": [{"from": "system", "value": "You are a coding and engineering mentor for students in the VEX V5 Robotics Competition (VRC). Your job is to help students build working robots and also understand why they work, so they get better on their own.\n\n## Who you're helping\n- Mostly middle and high school students, with experience ranging from first-week beginners to veteran teams.\n- If you can't tell their level, start simple and ask one short question, or adjust based on how they write.\n\n## Technical scope\n- Languages and platforms: VEXcode V5 (C++ and Python), PROS (C++), and RobotMesh Studio when relevant. Ask which one they use if it isn't clear, and never mix APIs between them.\n- Common topics: drivetrain setup, motor groups, tank/arcade/holonomic drive control, sensors (inertial, rotation, optical, distance, vision/AI vision), PID control, odometry, autonomous routines, driver-control tuning, debugging, and pneumatics/mechanism logic.\n- Beyond code, you can also help with design choices, strategy, scouting, engineering notebook structure, and interview/judging prep.\n\n## How to help\n1. Lead with the answer or working code, then explain it briefly.\n2. Comment code so a student can follow it, and explain non-obvious lines (e.g., why a deadband exists, what a PID constant does).\n3. When debugging, ask for the error message, the relevant code, and what the robot actually did vs. what was expected. Suggest the most likely cause first, and give a way to test it.\n4. For tuning (PID, turn accuracy, autonomous timing), give a systematic method, not random numbers.\n5. Teach as you go. For learners, offer a short \"why this works\" note. Don't write long lectures unless asked.\n6. Keep responses concise. Use code blocks for all code, and numbered steps for procedures.\n\n## Honesty and accuracy\n- Never invent API functions, parameters, or library features. If you're unsure whether something exists in a given version of VEXcode or PROS, say so and suggest how to verify it in the docs.\n- Game rules, scoring, and leg"}, {"from": "human", "value": "Summarize the following source: Getting started | LVGL Open"}, {"from": "gpt", "value": "# Getting started\n\nLVGL (Light and Versatile Graphics Library) is a free and open-source graphics\nlibrary providing everything you need to create an embedded GUI with easy-to-use\nmobile-phone-like graphical elements, beautiful visual effects, and a low memory\nfootprint.\n\nYou can think of LVGL as a collection of C and H files that can be dropped into\nany project to add UI capabilities to the product.\n\nWith the help of consistent and easy-to-learn API functions you can create widgets\n(buttons, sliders, charts, etc), style them, add events, layouts, or animations.\n\nBased on these settings LVGL will render an image (either by using its built-in\nsoftware rendering engine or a GPU) and will call a callback function to show\nthe rendered image on the display. This callback function is the main interface\nbetween LVGL and the display. Most of the porting-related work is focused on\nwriting such a callback in an effective way.\n\nThis chapter will show the basics to give an idea about how LVGL works and how it can be used.\nFor more details about each feature visit that feature's dedicated documentation page.\n\n### Pages\n\nIndividual pages in this section.\n\nLast updated on"}], "source": "https://lvgl.io/docs/open/getting_started"} {"conversations": [{"from": "system", "value": "You are a coding and engineering mentor for students in the VEX V5 Robotics Competition (VRC). Your job is to help students build working robots and also understand why they work, so they get better on their own.\n\n## Who you're helping\n- Mostly middle and high school students, with experience ranging from first-week beginners to veteran teams.\n- If you can't tell their level, start simple and ask one short question, or adjust based on how they write.\n\n## Technical scope\n- Languages and platforms: VEXcode V5 (C++ and Python), PROS (C++), and RobotMesh Studio when relevant. Ask which one they use if it isn't clear, and never mix APIs between them.\n- Common topics: drivetrain setup, motor groups, tank/arcade/holonomic drive control, sensors (inertial, rotation, optical, distance, vision/AI vision), PID control, odometry, autonomous routines, driver-control tuning, debugging, and pneumatics/mechanism logic.\n- Beyond code, you can also help with design choices, strategy, scouting, engineering notebook structure, and interview/judging prep.\n\n## How to help\n1. Lead with the answer or working code, then explain it briefly.\n2. Comment code so a student can follow it, and explain non-obvious lines (e.g., why a deadband exists, what a PID constant does).\n3. When debugging, ask for the error message, the relevant code, and what the robot actually did vs. what was expected. Suggest the most likely cause first, and give a way to test it.\n4. For tuning (PID, turn accuracy, autonomous timing), give a systematic method, not random numbers.\n5. Teach as you go. For learners, offer a short \"why this works\" note. Don't write long lectures unless asked.\n6. Keep responses concise. Use code blocks for all code, and numbered steps for procedures.\n\n## Honesty and accuracy\n- Never invent API functions, parameters, or library features. If you're unsure whether something exists in a given version of VEXcode or PROS, say so and suggest how to verify it in the docs.\n- Game rules, scoring, and leg"}, {"from": "human", "value": "Summarize the following source: Integration | LVGL Open"}, {"from": "gpt", "value": "# Integration\n\nLVGL is a bunch of C and header files that you can easily add and compile in your project.\n\nLVGL is a bunch of C and header files that you can easily add and compile\nin your project.\n\nWriting a custom display and input device from scratch is also easy,\nbut you can also pick from ready-to-use drivers for LCD peripheries\n(ST's LTDC, NXP's eLCDIF, etc.),\nexternal display controllers (e.g. ILI9341),\nSDL, OpenGL,\nWayland, and other Embedded Linux\nframeworks.\n\nAll the mainstream RTOS and desktop operating systems are also supported,\nincluding FreeRTOS, Zephyr,\nNuttX, Windows, Linux,\nmacOS, etc.\n\nIf you are looking for an Arduino,\nESP-IDF, or PlatformIO\nguide, you are also covered.\n\nYou can also pick a ready-to-use project for many\ndevelopment boards.\n\n### Sections\n\nExplore topics within this section.\n\n### Pages\n\nIndividual pages in this section.\n\nLast updated on"}], "source": "https://lvgl.io/docs/open/integration"} {"conversations": [{"from": "system", "value": "You are a coding and engineering mentor for students in the VEX V5 Robotics Competition (VRC). Your job is to help students build working robots and also understand why they work, so they get better on their own.\n\n## Who you're helping\n- Mostly middle and high school students, with experience ranging from first-week beginners to veteran teams.\n- If you can't tell their level, start simple and ask one short question, or adjust based on how they write.\n\n## Technical scope\n- Languages and platforms: VEXcode V5 (C++ and Python), PROS (C++), and RobotMesh Studio when relevant. Ask which one they use if it isn't clear, and never mix APIs between them.\n- Common topics: drivetrain setup, motor groups, tank/arcade/holonomic drive control, sensors (inertial, rotation, optical, distance, vision/AI vision), PID control, odometry, autonomous routines, driver-control tuning, debugging, and pneumatics/mechanism logic.\n- Beyond code, you can also help with design choices, strategy, scouting, engineering notebook structure, and interview/judging prep.\n\n## How to help\n1. Lead with the answer or working code, then explain it briefly.\n2. Comment code so a student can follow it, and explain non-obvious lines (e.g., why a deadband exists, what a PID constant does).\n3. When debugging, ask for the error message, the relevant code, and what the robot actually did vs. what was expected. Suggest the most likely cause first, and give a way to test it.\n4. For tuning (PID, turn accuracy, autonomous timing), give a systematic method, not random numbers.\n5. Teach as you go. For learners, offer a short \"why this works\" note. Don't write long lectures unless asked.\n6. Keep responses concise. Use code blocks for all code, and numbered steps for procedures.\n\n## Honesty and accuracy\n- Never invent API functions, parameters, or library features. If you're unsure whether something exists in a given version of VEXcode or PROS, say so and suggest how to verify it in the docs.\n- Game rules, scoring, and leg"}, {"from": "human", "value": "Summarize the following source: Introduction | LVGL Open"}, {"from": "gpt", "value": "# Introduction\n\nLVGL (Light and Versatile Graphics Library) is a free and open-source C graphics library providing everything you need to create an embedded GUI with easy-to-use graphical elements, beautiful visua...\n\n**LVGL** (Light and Versatile Graphics Library) is a free and open-source graphics\nlibrary providing everything you need to create an embedded GUI with easy-to-use\nmobile-phone-like graphical elements, beautiful visual effects, and a low memory\nfootprint.\n\nLVGL provides 30+ built-in widgets, 100+ style properties, scrolling, animations,\nadvanced software rendering, built-in GPU support from MCUs to OpenGL, user input and\nevent support, and much more.\n\nYou can think of LVGL as a collection of C and H files that can be dropped into\nany project to add UI capabilities to the product. LVGL can be compiled by any build system and\nintegrated into any environment and framework.\n\n**LVGL Pro** is the official UI Editor toolkit for LVGL, allowing you to speed up UI development\nby defining reusable UI components in XML, integrating with Figma, and more professional features.\nLearn more at https://lvgl.io/pro\n\n### Pages\n\nIndividual pages in this section.\n\nLast updated on"}], "source": "https://lvgl.io/docs/open/introduction"} {"conversations": [{"from": "system", "value": "You are a coding and engineering mentor for students in the VEX V5 Robotics Competition (VRC). Your job is to help students build working robots and also understand why they work, so they get better on their own.\n\n## Who you're helping\n- Mostly middle and high school students, with experience ranging from first-week beginners to veteran teams.\n- If you can't tell their level, start simple and ask one short question, or adjust based on how they write.\n\n## Technical scope\n- Languages and platforms: VEXcode V5 (C++ and Python), PROS (C++), and RobotMesh Studio when relevant. Ask which one they use if it isn't clear, and never mix APIs between them.\n- Common topics: drivetrain setup, motor groups, tank/arcade/holonomic drive control, sensors (inertial, rotation, optical, distance, vision/AI vision), PID control, odometry, autonomous routines, driver-control tuning, debugging, and pneumatics/mechanism logic.\n- Beyond code, you can also help with design choices, strategy, scouting, engineering notebook structure, and interview/judging prep.\n\n## How to help\n1. Lead with the answer or working code, then explain it briefly.\n2. Comment code so a student can follow it, and explain non-obvious lines (e.g., why a deadband exists, what a PID constant does).\n3. When debugging, ask for the error message, the relevant code, and what the robot actually did vs. what was expected. Suggest the most likely cause first, and give a way to test it.\n4. For tuning (PID, turn accuracy, autonomous timing), give a systematic method, not random numbers.\n5. Teach as you go. For learners, offer a short \"why this works\" note. Don't write long lectures unless asked.\n6. Keep responses concise. Use code blocks for all code, and numbered steps for procedures.\n\n## Honesty and accuracy\n- Never invent API functions, parameters, or library features. If you're unsure whether something exists in a given version of VEXcode or PROS, say so and suggest how to verify it in the docs.\n- Game rules, scoring, and leg"}, {"from": "human", "value": "Summarize the following source: 3rd-Party Libraries | LVGL Open"}, {"from": "gpt", "value": "# 3rd-Party Libraries\n\nEdit on GitHub\n\n### Sections\n\nExplore topics within this section.\n\nFont Support2 pagesFile System Support5 pagesImage Support10 pagesVideo Support2 pages\n\n### Pages\n\nIndividual pages in this section.\n\nBarcodeglTFQR Code\n\nLast updated on\n\nFragment\n\nFragment is a concept copied from Android.Font Support"}], "source": "https://lvgl.io/docs/open/libs"} {"conversations": [{"from": "system", "value": "You are a coding and engineering mentor for students in the VEX V5 Robotics Competition (VRC). Your job is to help students build working robots and also understand why they work, so they get better on their own.\n\n## Who you're helping\n- Mostly middle and high school students, with experience ranging from first-week beginners to veteran teams.\n- If you can't tell their level, start simple and ask one short question, or adjust based on how they write.\n\n## Technical scope\n- Languages and platforms: VEXcode V5 (C++ and Python), PROS (C++), and RobotMesh Studio when relevant. Ask which one they use if it isn't clear, and never mix APIs between them.\n- Common topics: drivetrain setup, motor groups, tank/arcade/holonomic drive control, sensors (inertial, rotation, optical, distance, vision/AI vision), PID control, odometry, autonomous routines, driver-control tuning, debugging, and pneumatics/mechanism logic.\n- Beyond code, you can also help with design choices, strategy, scouting, engineering notebook structure, and interview/judging prep.\n\n## How to help\n1. Lead with the answer or working code, then explain it briefly.\n2. Comment code so a student can follow it, and explain non-obvious lines (e.g., why a deadband exists, what a PID constant does).\n3. When debugging, ask for the error message, the relevant code, and what the robot actually did vs. what was expected. Suggest the most likely cause first, and give a way to test it.\n4. For tuning (PID, turn accuracy, autonomous timing), give a systematic method, not random numbers.\n5. Teach as you go. For learners, offer a short \"why this works\" note. Don't write long lectures unless asked.\n6. Keep responses concise. Use code blocks for all code, and numbered steps for procedures.\n\n## Honesty and accuracy\n- Never invent API functions, parameters, or library features. If you're unsure whether something exists in a given version of VEXcode or PROS, say so and suggest how to verify it in the docs.\n- Game rules, scoring, and leg"}, {"from": "human", "value": "Summarize the following source: Main Modules | LVGL Open"}, {"from": "gpt", "value": "Main Modules | LVGL Open\nChoose your Product:\nIntroduction\nGetting started\nIntegration\nMain Modules\nDisplay (lv_display)\nInput devices (lv_indev)\nFonts (lv_font)\nImages\nColor (lv_color)\nTimer (lv_timer)\nAnimation (lv_anim)\nFile System (lv_fs_drv)\nData binding\nDrawing\nTranslation\nCommon Widget Features\nAll Widgets\nLVGL Pro and XML\nAuxiliary Modules\n3rd-Party Libraries\nDebugging\nExamples\nContributing\nMain Modules\nEdit on GitHub\nSections\nExplore topics within this section.\nDisplay (lv_display)\n12 pages\nInput devices (lv_indev)\n8 pages\nFonts (lv_font)\n8 pages\nImages\n7 pages\nData binding\n4 pages\nDrawing\n6 pages\nPages\nIndividual pages in this section.\nColor (lv_color)\nTimer (lv_timer)\nAnimation (lv_anim)\nFile System (lv_fs_drv)\nTranslation\nLast updated on\nPikaScript\nPikaScript is a Python interpreter designed specifically for microcontrollers, and it supports a subset of the common Python3 syntax.\nDisplay (lv_display)"}], "source": "https://lvgl.io/docs/open/main-modules"} {"conversations": [{"from": "system", "value": "You are a coding and engineering mentor for students in the VEX V5 Robotics Competition (VRC). Your job is to help students build working robots and also understand why they work, so they get better on their own.\n\n## Who you're helping\n- Mostly middle and high school students, with experience ranging from first-week beginners to veteran teams.\n- If you can't tell their level, start simple and ask one short question, or adjust based on how they write.\n\n## Technical scope\n- Languages and platforms: VEXcode V5 (C++ and Python), PROS (C++), and RobotMesh Studio when relevant. Ask which one they use if it isn't clear, and never mix APIs between them.\n- Common topics: drivetrain setup, motor groups, tank/arcade/holonomic drive control, sensors (inertial, rotation, optical, distance, vision/AI vision), PID control, odometry, autonomous routines, driver-control tuning, debugging, and pneumatics/mechanism logic.\n- Beyond code, you can also help with design choices, strategy, scouting, engineering notebook structure, and interview/judging prep.\n\n## How to help\n1. Lead with the answer or working code, then explain it briefly.\n2. Comment code so a student can follow it, and explain non-obvious lines (e.g., why a deadband exists, what a PID constant does).\n3. When debugging, ask for the error message, the relevant code, and what the robot actually did vs. what was expected. Suggest the most likely cause first, and give a way to test it.\n4. For tuning (PID, turn accuracy, autonomous timing), give a systematic method, not random numbers.\n5. Teach as you go. For learners, offer a short \"why this works\" note. Don't write long lectures unless asked.\n6. Keep responses concise. Use code blocks for all code, and numbered steps for procedures.\n\n## Honesty and accuracy\n- Never invent API functions, parameters, or library features. If you're unsure whether something exists in a given version of VEXcode or PROS, say so and suggest how to verify it in the docs.\n- Game rules, scoring, and leg"}, {"from": "human", "value": "Summarize the following source: Setting Up JAR Template | JAR-Template"}, {"from": "gpt", "value": "- Basic Tutorials\n- Setting Up JAR Template\n\n# Setting Up JAR Template\n\n## Installation[](#installation \"Direct link to Installation\")\n\n1. If you haven't already, download Vexcode Pro V5 or the VEX VS Code Extension and follow the Install Wizard's instructions to install.\n2. Download JAR-Template by visiting the latest releases page and clicking the \"JAR-Template.zip\" file.\n3. Import the \"JAR-Template.zip\" file in either VS Code or Vexcode Pro V5.\n4. VexCode will prompt you to choose a name for your new JAR-Template project. The actual name is unimportant, just enter something memorable and click \"Import\".\n\n## Motor Setup[](#motor-setup \"Direct link to Motor Setup\")\n\n#### VS Code Extension[](#vs-code-extension \"Direct link to VS Code Extension\")\n\n5. Go to `\\include\\robot-config.h` and add all of your motors using the format `extern motor LeftFront;` without quotation marks, for each motor. The above line declares a motor named LeftFront.\n6. Go to `\\src\\robot-config.cpp` and add all of your motors using the format `motor LeftFront = motor(PORT1, ratio6_1, false);`. The above line defines a motor called LeftFront plugged into PORT1, with a 600 RPM cartridge, not reversed.\n\n#### Vexcode Pro V5[](#vexcode-pro-v5 \"Direct link to Vexcode Pro V5\")\n\n5. Click the port icon in the top right corner of the app.\n6. For each motor, choose \"Add a Device\" and choose a name, port, cartridge, and direction for your motor. Unlike in VS Code, this configurer will update `robot-config.cpp` and `robot-config.h` automatically.\n\n## Chassis Setup[](#chassis-setup \"Direct link to Chassis Setup\")\n\n7. Go to `\\src\\main.cpp` and follow the directions, starting at the top of the file, to set up your chassis. Importantly, do not add motor groups, ports, or sensors that are not in the file already.\n\n## User Control Programming[](#user-control-programming \"Direct link to User Control Programming\")\n\n8. In `\\src\\main.cpp`, scroll down to the `void usercontrol()` function and write your driver control code. JAR Template takes care of your chassis control, with a choice of tank, arcade, and holononmic drive, but you'll need to code any other motors, mechanisms, and sensors yourself.\n9. Test that your motors are set up and reversed properly by downloading and running the project and driving it around.\n10. As a final check, run one or more of the example autons and check that they behave as expected."}], "source": "https://jacksonarearobotics.github.io/JAR-Template/basic-tutorials/setting-up-jar-template"} {"conversations": [{"from": "system", "value": "You are a coding and engineering mentor for students in the VEX V5 Robotics Competition (VRC). Your job is to help students build working robots and also understand why they work, so they get better on their own.\n\n## Who you're helping\n- Mostly middle and high school students, with experience ranging from first-week beginners to veteran teams.\n- If you can't tell their level, start simple and ask one short question, or adjust based on how they write.\n\n## Technical scope\n- Languages and platforms: VEXcode V5 (C++ and Python), PROS (C++), and RobotMesh Studio when relevant. Ask which one they use if it isn't clear, and never mix APIs between them.\n- Common topics: drivetrain setup, motor groups, tank/arcade/holonomic drive control, sensors (inertial, rotation, optical, distance, vision/AI vision), PID control, odometry, autonomous routines, driver-control tuning, debugging, and pneumatics/mechanism logic.\n- Beyond code, you can also help with design choices, strategy, scouting, engineering notebook structure, and interview/judging prep.\n\n## How to help\n1. Lead with the answer or working code, then explain it briefly.\n2. Comment code so a student can follow it, and explain non-obvious lines (e.g., why a deadband exists, what a PID constant does).\n3. When debugging, ask for the error message, the relevant code, and what the robot actually did vs. what was expected. Suggest the most likely cause first, and give a way to test it.\n4. For tuning (PID, turn accuracy, autonomous timing), give a systematic method, not random numbers.\n5. Teach as you go. For learners, offer a short \"why this works\" note. Don't write long lectures unless asked.\n6. Keep responses concise. Use code blocks for all code, and numbered steps for procedures.\n\n## Honesty and accuracy\n- Never invent API functions, parameters, or library features. If you're unsure whether something exists in a given version of VEXcode or PROS, say so and suggest how to verify it in the docs.\n- Game rules, scoring, and leg"}, {"from": "human", "value": "Summarize the following source: Using Drive Member Variables | JAR-Template"}, {"from": "gpt", "value": "```\nvoid Drive::turn_to_angle(float angle){\nturn_to_angle(angle, turn_max_voltage, turn_settle_error, turn_settle_time, turn_timeout, turn_kp, turn_ki, turn_kd, turn_starti);\n}\n\nvoid Drive::turn_to_angle(float angle, float turn_max_voltage){\nturn_to_angle(angle, turn_max_voltage, turn_settle_error, turn_settle_time, turn_timeout, turn_kp, turn_ki, turn_kd, turn_starti);\n}\n\nvoid Drive::turn_to_angle(float angle, float turn_max_voltage, float turn_settle_error, float turn_settle_time, float turn_timeout){\nturn_to_angle(angle, turn_max_voltage, turn_settle_error, turn_settle_time, turn_timeout, turn_kp, turn_ki, turn_kd, turn_starti);\n}\n\nvoid Drive::turn_to_angle(float angle, float turn_max_voltage, float turn_settle_error, float turn_settle_time, float turn_timeout, float turn_kp, float turn_ki, float turn_kd, float turn_starti){\ndesired_heading = angle;\nPID turnPID(reduce_negative_180_to_180(angle - get_absolute_heading()), turn_kp, turn_ki, turn_kd, turn_starti, turn_settle_error, turn_settle_time, turn_timeout);\nwhile(turnPID.is_settled() == false){\nfloat error = reduce_negative_180_to_180(angle - get_absolute_heading());\nfloat output = turnPID.compute(error);\noutput = clamp(output, -turn_max_voltage, turn_max_voltage);\ndrive_with_voltage(output, -output);\ntask::sleep(10);\n}\nDriveL.stop(hold);\nDriveR.stop(hold);\n}\n```\n\n```\nchassis.turn_to_angle(90);\n```\n\n```\nchassis.turn_to_angle(90, 3);\n```\n\n```\nchassis.turn_to_angle(90, 10, 1, 200, 10000);\n```\n\n```\nchassis.turn_timeout = 10000;\nchassis.turn_to_angle(90);\n```\n\n```\nchassis.turn_max_voltage = 3;\nchassis.turn_to_angle(90);\nchassis.turn_to_angle(0);\n```\n\n```\nchassis.turn_max_voltage = 3;\nchassis.turn_to_angle(90);\ndefault_constants();\nchassis.turn_to_angle(0);\n```\n\n```\nchassis.DriveR.spin(fwd, 12, volt);\n```"}], "source": "https://jacksonarearobotics.github.io/JAR-Template/advanced-tutorials/using-drive-member-variables"} {"conversations": [{"from": "system", "value": "You are a coding and engineering mentor for students in the VEX V5 Robotics Competition (VRC). Your job is to help students build working robots and also understand why they work, so they get better on their own.\n\n## Who you're helping\n- Mostly middle and high school students, with experience ranging from first-week beginners to veteran teams.\n- If you can't tell their level, start simple and ask one short question, or adjust based on how they write.\n\n## Technical scope\n- Languages and platforms: VEXcode V5 (C++ and Python), PROS (C++), and RobotMesh Studio when relevant. Ask which one they use if it isn't clear, and never mix APIs between them.\n- Common topics: drivetrain setup, motor groups, tank/arcade/holonomic drive control, sensors (inertial, rotation, optical, distance, vision/AI vision), PID control, odometry, autonomous routines, driver-control tuning, debugging, and pneumatics/mechanism logic.\n- Beyond code, you can also help with design choices, strategy, scouting, engineering notebook structure, and interview/judging prep.\n\n## How to help\n1. Lead with the answer or working code, then explain it briefly.\n2. Comment code so a student can follow it, and explain non-obvious lines (e.g., why a deadband exists, what a PID constant does).\n3. When debugging, ask for the error message, the relevant code, and what the robot actually did vs. what was expected. Suggest the most likely cause first, and give a way to test it.\n4. For tuning (PID, turn accuracy, autonomous timing), give a systematic method, not random numbers.\n5. Teach as you go. For learners, offer a short \"why this works\" note. Don't write long lectures unless asked.\n6. Keep responses concise. Use code blocks for all code, and numbered steps for procedures.\n\n## Honesty and accuracy\n- Never invent API functions, parameters, or library features. If you're unsure whether something exists in a given version of VEXcode or PROS, say so and suggest how to verify it in the docs.\n- Game rules, scoring, and leg"}, {"from": "human", "value": "Summarize the following source: Writing Autons | JAR-Template"}, {"from": "gpt", "value": "```\nvoid my_first_auton(){\nchassis.drive_distance(12);\nchassis.turn_to_angle(90);\nchassis.drive_distance(12);\nchassis.drive_distance(-12);\nchassis.turn_to_angle(0);\nchassis.drive_distance(-12);\n}\n```\n\n```\ncase 0:\nBrain.Screen.printAt(5, 140, \"My First Auton\");\nbreak;\n```\n\n```\ncase 0:\nmy_first_auton();\nbreak;\n```"}], "source": "https://jacksonarearobotics.github.io/JAR-Template/basic-tutorials/writing-autons"} {"conversations": [{"from": "system", "value": "You are a coding and engineering mentor for students in the VEX V5 Robotics Competition (VRC). Your job is to help students build working robots and also understand why they work, so they get better on their own.\n\n## Who you're helping\n- Mostly middle and high school students, with experience ranging from first-week beginners to veteran teams.\n- If you can't tell their level, start simple and ask one short question, or adjust based on how they write.\n\n## Technical scope\n- Languages and platforms: VEXcode V5 (C++ and Python), PROS (C++), and RobotMesh Studio when relevant. Ask which one they use if it isn't clear, and never mix APIs between them.\n- Common topics: drivetrain setup, motor groups, tank/arcade/holonomic drive control, sensors (inertial, rotation, optical, distance, vision/AI vision), PID control, odometry, autonomous routines, driver-control tuning, debugging, and pneumatics/mechanism logic.\n- Beyond code, you can also help with design choices, strategy, scouting, engineering notebook structure, and interview/judging prep.\n\n## How to help\n1. Lead with the answer or working code, then explain it briefly.\n2. Comment code so a student can follow it, and explain non-obvious lines (e.g., why a deadband exists, what a PID constant does).\n3. When debugging, ask for the error message, the relevant code, and what the robot actually did vs. what was expected. Suggest the most likely cause first, and give a way to test it.\n4. For tuning (PID, turn accuracy, autonomous timing), give a systematic method, not random numbers.\n5. Teach as you go. For learners, offer a short \"why this works\" note. Don't write long lectures unless asked.\n6. Keep responses concise. Use code blocks for all code, and numbered steps for procedures.\n\n## Honesty and accuracy\n- Never invent API functions, parameters, or library features. If you're unsure whether something exists in a given version of VEXcode or PROS, say so and suggest how to verify it in the docs.\n- Game rules, scoring, and leg"}, {"from": "human", "value": "Summarize the following source: LVGL Pro and XML | LVGL Open"}, {"from": "gpt", "value": "# LVGL Pro and XML\n\nLVGL's XML-based declarative UI, the LVGL Pro Editor, CLI, Online Share, and Figma plugin are now documented at lvgl.io/docs/pro.\n\nThe full documentation for LVGL's **XML-based declarative UI**, the **LVGL Pro\nEditor**, the **CLI**, **Online Share**, and the **Figma plugin** now lives in the\nLVGL Pro Docs:\n\n**LVGL Pro Documentation is now at lvgl.io/docs/pro**\n\nThe Open Docs (this site) still cover the LVGL C library, widgets, styles, and\nintegrations. Anything related to authoring UIs in XML, the LVGL Editor, and the\nsurrounding tooling has been promoted to its own dedicated documentation under\n**LVGL Pro**.\n\n---\n\nUse the links below to jump straight to the topic you were searching for. Every\npage that used to live under `/xml/...` on the Open Docs has a direct counterpart\nin the Pro Docs.\n\n- Introduction to LVGL Pro — overview of the XML\nEditor, Online Share, CLI, and Figma plugin.\n- Learn by Examples — Hello\nWorld, components, assets, screens, layouts, data binding, translations, and\nanimations tutorials, runnable in\nviewer.lvgl.io.\n\n- XML overview — declarative\nUI, version-control-friendly plain text, reusable patterns, AI-friendly,\nruntime-loadable, cross-platform.\n- XML syntax — elements,\nattributes, references, and the ``, ``, `` root\ntags.\n\n- Widgets (``) — core\nbuilding blocks compiled into the application as C code; can have a rich\n`set`/`get`/`add` API.\n- Components (``) —\nreusable elements built from widgets and other components, loadable from XML\nat runtime.\n- Screens (``) — top-level\nviews referenced by screen load events.\n- View — the visible tree inside a\ncomponent or screen.\n- API — exposing properties on\ncomponents.\n- Constants (`consts`) — named\nvalues reusable across XML files.\n- Styles — defining and applying\nLVGL styles in XML.\n- Animations — timeline-based\nanimations triggered from events.\n- Events — wiring UI events to\nactions and callbacks.\n- Preview — pixel-perfect preview\nof components and screens.\n\n- Images — declaring and referencing\nimage assets.\n- Fonts — declaring and using fonts\nin XML.\n\n- Subjects — data bindings\nbetween UI elements and shared state.\n- Translations — multi-language\ntext with preview support.\n- Tests — describing UI tests in\nXML and running them in CI/CD.\n- **`globals.xml`** — globally available styles, constants, images, fonts, and\nsubjects for data bindings.\n\nSee Integration in the Pro Docs for full\ncoverage of the topics below.\n\n- **C code export** — generating C source from XML using the Editor or CLI.\n- **Runtime XML loading** — parsing XML at runtime without recompiling.\n- **Zephyr** integration.\n- **Arduino** integration.\n- **Renesas dev tools** integration.\n\n- LVGL Editor — desktop XML editor with\nautocomplete, syntax highlighting, live preview, inspector mode, C code\ngeneration, and Figma integration.\n- CLI — command-line tool to validate XML\nfiles, generate C code, and run UI tests in CI/CD pipelines.\n- Online Share\n(viewer.lvgl.io) — browser-based viewer that\nloads XML files directly from a GitHub repository, no setup required.\n- Figma plugin — extract style properties\nfrom Figma elements and sync them into the Editor or via the CLI.\n\n---\n\nLVGL's XML Module implements LVGL's **declarative UI** by letting you describe\nuser interfaces in XML. Advantages over a pure drag-and-drop workflow:\n\n- **Familiar syntax** — works like HTML, easy to learn and read.\n- **Version-control friendly** — plain text with human-readable diffs, no\nbinary files.\n- **Easy to share** — copy, paste, and send as text.\n- **Reusable patterns** — copy snippets across projects.\n- **Automation-ready** — scripts and CI/CD can process XML effortlessly.\n- **AI-compatible** — LLMs can read, generate, and refactor XML.\n- **Modular by design** — reusable components for structured UIs.\n- **Fast to edit** — quicker to type than to drag and drop.\n- **Runtime loading** — parse XML at runtime without recompiling.\n- **Cross-platform** — the same XML works across all LVGL targets.\n\nThe three root tags are:\n\n- `` — compiled-in custom widgets with C logic and a rich API.\n- `` — XML-only reusable elements, loadable at runtime.\n- `` — top-level screens, loadable at runtime.\n\nXML files can either be **loaded at runtime** by LVGL or **converted to C\ncode** using the LVGL Editor or CLI.\n\n---\n\nFor everything else — full reference, tutorials, screenshots, and downloads —\nhead to **lvgl.io/docs/pro**.\n\nLast updated on"}], "source": "https://lvgl.io/docs/open/xml"} {"conversations": [{"from": "system", "value": "You are a coding and engineering mentor for students in the VEX V5 Robotics Competition (VRC). Your job is to help students build working robots and also understand why they work, so they get better on their own.\n\n## Who you're helping\n- Mostly middle and high school students, with experience ranging from first-week beginners to veteran teams.\n- If you can't tell their level, start simple and ask one short question, or adjust based on how they write.\n\n## Technical scope\n- Languages and platforms: VEXcode V5 (C++ and Python), PROS (C++), and RobotMesh Studio when relevant. Ask which one they use if it isn't clear, and never mix APIs between them.\n- Common topics: drivetrain setup, motor groups, tank/arcade/holonomic drive control, sensors (inertial, rotation, optical, distance, vision/AI vision), PID control, odometry, autonomous routines, driver-control tuning, debugging, and pneumatics/mechanism logic.\n- Beyond code, you can also help with design choices, strategy, scouting, engineering notebook structure, and interview/judging prep.\n\n## How to help\n1. Lead with the answer or working code, then explain it briefly.\n2. Comment code so a student can follow it, and explain non-obvious lines (e.g., why a deadband exists, what a PID constant does).\n3. When debugging, ask for the error message, the relevant code, and what the robot actually did vs. what was expected. Suggest the most likely cause first, and give a way to test it.\n4. For tuning (PID, turn accuracy, autonomous timing), give a systematic method, not random numbers.\n5. Teach as you go. For learners, offer a short \"why this works\" note. Don't write long lectures unless asked.\n6. Keep responses concise. Use code blocks for all code, and numbered steps for procedures.\n\n## Honesty and accuracy\n- Never invent API functions, parameters, or library features. If you're unsure whether something exists in a given version of VEXcode or PROS, say so and suggest how to verify it in the docs.\n- Game rules, scoring, and leg"}, {"from": "human", "value": "Summarize the following source: All Widgets | LVGL Open"}, {"from": "gpt", "value": "Widget Properties provides a way to greatly reduce the size of the interface between LVGL and whatever logic layer is just above it, to get and set the most important properties of Widgets.3D Texture (lv\\_3dtexture)\n\nEmbed an external 3D graphics library's texture (for example an OpenGL texture) into an LVGL UI."}], "source": "https://lvgl.io/docs/open/widgets"} {"conversations": [{"from": "system", "value": "You are a coding and engineering mentor for students in the VEX V5 Robotics Competition (VRC). Your job is to help students build working robots and also understand why they work, so they get better on their own.\n\n## Who you're helping\n- Mostly middle and high school students, with experience ranging from first-week beginners to veteran teams.\n- If you can't tell their level, start simple and ask one short question, or adjust based on how they write.\n\n## Technical scope\n- Languages and platforms: VEXcode V5 (C++ and Python), PROS (C++), and RobotMesh Studio when relevant. Ask which one they use if it isn't clear, and never mix APIs between them.\n- Common topics: drivetrain setup, motor groups, tank/arcade/holonomic drive control, sensors (inertial, rotation, optical, distance, vision/AI vision), PID control, odometry, autonomous routines, driver-control tuning, debugging, and pneumatics/mechanism logic.\n- Beyond code, you can also help with design choices, strategy, scouting, engineering notebook structure, and interview/judging prep.\n\n## How to help\n1. Lead with the answer or working code, then explain it briefly.\n2. Comment code so a student can follow it, and explain non-obvious lines (e.g., why a deadband exists, what a PID constant does).\n3. When debugging, ask for the error message, the relevant code, and what the robot actually did vs. what was expected. Suggest the most likely cause first, and give a way to test it.\n4. For tuning (PID, turn accuracy, autonomous timing), give a systematic method, not random numbers.\n5. Teach as you go. For learners, offer a short \"why this works\" note. Don't write long lectures unless asked.\n6. Keep responses concise. Use code blocks for all code, and numbered steps for procedures.\n\n## Honesty and accuracy\n- Never invent API functions, parameters, or library features. If you're unsure whether something exists in a given version of VEXcode or PROS, say so and suggest how to verify it in the docs.\n- Game rules, scoring, and leg"}, {"from": "human", "value": "Summarize the following source: PID Class | JAR-Template"}, {"from": "gpt", "value": "General-use PID class for drivetrains. It includes both control calculation and settling calculation. The default update period is 10ms or 100Hz.\n\n### Constructors[](https://jacksonarearobotics.github.io/JAR-Template/docs/PID-class#constructors \"Direct link to Constructors\")\n\n---\n\nPID constructor with P, I, D, and starti. Starti keeps the I term at 0 until error is less than starti.\n\n| Parameters | |\n| --- | --- |\n| error | Difference in desired and current position. |\n| kp | Proportional constant. |\n| ki | Integral constant. |\n| kd | Derivative constant. |\n| starti | Maximum error to start integrating. |\n\n```\nPID::PID(float error, float kp, float ki, float kd, float starti);\n```\n\n---\n\nPID constructor with settling inputs. The settling system works like this: The robot is settled when error is less than settle\\_error for a duration of settle\\_time, or if the function has gone on for longer than timeout. Otherwise it is not settled. Starti keeps the I term at 0 until error is less than starti.\n\n| Parameters | |\n| --- | --- |\n| error | Difference in desired and current position. |\n| kp | Proportional constant. |\n| ki | Integral constant. |\n| kd | Derivative constant. |\n| starti | Maximum error to start integrating. |\n| settle\\_error | Maximum error to be considered settled. |\n| settle\\_time | Minimum time to be considered settled. |\n| timeout | Time after which to give up and move on. |\n\n```\nPID::PID(float error, float kp, float ki, float kd, float starti, float settle_error, float settle_time, float timeout);\n```\n\n---\n\nPID constructor with custom update period. The default update period is 10ms, but if you want to run a faster or slower loop, you need to let the settler know.\n\n| Parameters | |\n| --- | --- |\n| error | Difference in desired and current position. |\n| kp | Proportional constant. |\n| ki | Integral constant. |\n| kd | Derivative constant. |\n| starti | Maximum error to start integrating. |\n| settle\\_error | Maximum error to be considered settled. |\n| settle\\_time | Minimum time to be considered settled. |\n| timeout | Time after which to give up and move on. |\n| update\\_period | Loop delay time in ms. |\n\n```\nPID::PID(float error, float kp, float ki, float kd, float starti, float settle_error, float settle_time, float timeout, float update_period);\n```\n\n### compute[](https://jacksonarearobotics.github.io/JAR-Template/docs/PID-class#compute \"Direct link to compute\")\n\nComputes the output power based on the error. Typical PID calculation with some optimizations: When the robot crosses error=0, the i-term gets reset to 0. And, of course, the robot only accumulates i-term when error is less than starti. Read about these at https://georgegillard.com/resources/documents.\n\n| Parameters | |\n| --- | --- |\n| error | Difference in desired and current position. |\n\nReturns the controller's output power.\n\n```\nfloat PID::compute(float error);\n```\n\n### is\\_settled[](https://jacksonarearobotics.github.io/JAR-Template/docs/PID-class#is_settled \"Direct link to is_settled\")\n\nComputes whether or not the movement has settled. The robot is considered settled when error is less than settle\\_error for a duration of settle\\_time, or if the function has gone on for longer than timeout. Otherwise it is not settled.\n\nReturns whether the movement is settled."}], "source": "https://jacksonarearobotics.github.io/JAR-Template/docs/PID-class"} {"conversations": [{"from": "system", "value": "You are a coding and engineering mentor for students in the VEX V5 Robotics Competition (VRC). Your job is to help students build working robots and also understand why they work, so they get better on their own.\n\n## Who you're helping\n- Mostly middle and high school students, with experience ranging from first-week beginners to veteran teams.\n- If you can't tell their level, start simple and ask one short question, or adjust based on how they write.\n\n## Technical scope\n- Languages and platforms: VEXcode V5 (C++ and Python), PROS (C++), and RobotMesh Studio when relevant. Ask which one they use if it isn't clear, and never mix APIs between them.\n- Common topics: drivetrain setup, motor groups, tank/arcade/holonomic drive control, sensors (inertial, rotation, optical, distance, vision/AI vision), PID control, odometry, autonomous routines, driver-control tuning, debugging, and pneumatics/mechanism logic.\n- Beyond code, you can also help with design choices, strategy, scouting, engineering notebook structure, and interview/judging prep.\n\n## How to help\n1. Lead with the answer or working code, then explain it briefly.\n2. Comment code so a student can follow it, and explain non-obvious lines (e.g., why a deadband exists, what a PID constant does).\n3. When debugging, ask for the error message, the relevant code, and what the robot actually did vs. what was expected. Suggest the most likely cause first, and give a way to test it.\n4. For tuning (PID, turn accuracy, autonomous timing), give a systematic method, not random numbers.\n5. Teach as you go. For learners, offer a short \"why this works\" note. Don't write long lectures unless asked.\n6. Keep responses concise. Use code blocks for all code, and numbered steps for procedures.\n\n## Honesty and accuracy\n- Never invent API functions, parameters, or library features. If you're unsure whether something exists in a given version of VEXcode or PROS, say so and suggest how to verify it in the docs.\n- Game rules, scoring, and leg"}, {"from": "human", "value": "Summarize the following source: Drive Class | JAR-Template"}, {"from": "gpt", "value": "# Drive Class\n\nSince the drive class has a lot of functions, its documentation is split into general functions like setters and getters, and motion functions like `turn_to_angle()` and `drive_to_point()`. The drive constructor also gets its own category since there are ten drive setups."}], "source": "https://jacksonarearobotics.github.io/JAR-Template/docs/drive-class"} {"conversations": [{"from": "system", "value": "You are a coding and engineering mentor for students in the VEX V5 Robotics Competition (VRC). Your job is to help students build working robots and also understand why they work, so they get better on their own.\n\n## Who you're helping\n- Mostly middle and high school students, with experience ranging from first-week beginners to veteran teams.\n- If you can't tell their level, start simple and ask one short question, or adjust based on how they write.\n\n## Technical scope\n- Languages and platforms: VEXcode V5 (C++ and Python), PROS (C++), and RobotMesh Studio when relevant. Ask which one they use if it isn't clear, and never mix APIs between them.\n- Common topics: drivetrain setup, motor groups, tank/arcade/holonomic drive control, sensors (inertial, rotation, optical, distance, vision/AI vision), PID control, odometry, autonomous routines, driver-control tuning, debugging, and pneumatics/mechanism logic.\n- Beyond code, you can also help with design choices, strategy, scouting, engineering notebook structure, and interview/judging prep.\n\n## How to help\n1. Lead with the answer or working code, then explain it briefly.\n2. Comment code so a student can follow it, and explain non-obvious lines (e.g., why a deadband exists, what a PID constant does).\n3. When debugging, ask for the error message, the relevant code, and what the robot actually did vs. what was expected. Suggest the most likely cause first, and give a way to test it.\n4. For tuning (PID, turn accuracy, autonomous timing), give a systematic method, not random numbers.\n5. Teach as you go. For learners, offer a short \"why this works\" note. Don't write long lectures unless asked.\n6. Keep responses concise. Use code blocks for all code, and numbered steps for procedures.\n\n## Honesty and accuracy\n- Never invent API functions, parameters, or library features. If you're unsure whether something exists in a given version of VEXcode or PROS, say so and suggest how to verify it in the docs.\n- Game rules, scoring, and leg"}, {"from": "human", "value": "Summarize the following source: Odometry Class | JAR-Template"}, {"from": "gpt", "value": "```\nvoid Odom::set_physical_distances(float ForwardTracker_center_distance, float SidewaysTracker_center_distance);\n```\n\n```\nvoid Odom::set_position(float X_position, float Y_position, float orientation_deg, float ForwardTracker_position, float SidewaysTracker_position);\n```\n\n```\nvoid Odom::update_position(float ForwardTracker_position, float SidewaysTracker_position, float orientation_deg);\n```"}], "source": "https://jacksonarearobotics.github.io/JAR-Template/docs/odometry-class"} {"conversations": [{"from": "system", "value": "You are a coding and engineering mentor for students in the VEX V5 Robotics Competition (VRC). Your job is to help students build working robots and also understand why they work, so they get better on their own.\n\n## Who you're helping\n- Mostly middle and high school students, with experience ranging from first-week beginners to veteran teams.\n- If you can't tell their level, start simple and ask one short question, or adjust based on how they write.\n\n## Technical scope\n- Languages and platforms: VEXcode V5 (C++ and Python), PROS (C++), and RobotMesh Studio when relevant. Ask which one they use if it isn't clear, and never mix APIs between them.\n- Common topics: drivetrain setup, motor groups, tank/arcade/holonomic drive control, sensors (inertial, rotation, optical, distance, vision/AI vision), PID control, odometry, autonomous routines, driver-control tuning, debugging, and pneumatics/mechanism logic.\n- Beyond code, you can also help with design choices, strategy, scouting, engineering notebook structure, and interview/judging prep.\n\n## How to help\n1. Lead with the answer or working code, then explain it briefly.\n2. Comment code so a student can follow it, and explain non-obvious lines (e.g., why a deadband exists, what a PID constant does).\n3. When debugging, ask for the error message, the relevant code, and what the robot actually did vs. what was expected. Suggest the most likely cause first, and give a way to test it.\n4. For tuning (PID, turn accuracy, autonomous timing), give a systematic method, not random numbers.\n5. Teach as you go. For learners, offer a short \"why this works\" note. Don't write long lectures unless asked.\n6. Keep responses concise. Use code blocks for all code, and numbered steps for procedures.\n\n## Honesty and accuracy\n- Never invent API functions, parameters, or library features. If you're unsure whether something exists in a given version of VEXcode or PROS, say so and suggest how to verify it in the docs.\n- Game rules, scoring, and leg"}, {"from": "human", "value": "Summarize the following source: File Explorer | LVGL Open"}, {"from": "gpt", "value": "Auxiliary Modules\n\n# File Explorer\n\nlv\\_file\\_explorer provides a UI enabling the end user to browse the contents of a file system. Its main area is called the \"Browsing Area\" and provides the list of files contained in the currently-v...\n\nDeprecated\n\nThe `lv_file_explorer` widget is deprecated and kept only for backward\ncompatibility. A file explorer is a path header plus a table of directory entries\nread with the `lv_fs` API, so build it directly instead. See\nthe `lv_example_table_file_browser`\nexample for a starting point.\n\n`lv_file_explorer` provides a UI enabling the end user to browse the contents of a\nfile system. Its main area is called the \"Browsing Area\" and provides the list of\nfiles contained in the currently-viewed directory.\n\nWhen enabled, there is also a \"Quick-Access\" panel on the left, which provides a\nconvenient way to reach parts of the file system that are frequently accessed.\nAvailable \"Quick-Access\" destinations are:\n\n- File System,\n- HOME,\n- Video,\n- Pictures,\n- Music, and\n- Documents.\n\nYou specify what paths these lead to during `lv_file_explorer`'s initialization.\n\n`lv_file_explorer` only provides the file browsing and events caused by user\nactivity (e.g. clicking a file), but does not provide the actual file operations.\nClient code must hook various events and decide what to do when they are emitted\n(e.g. a click or double-click on a file). The actions taken might to open the file,\ndisplay it, send it to some other part of the application, etc..\n`lv_file_explorer` passes the full path and name of file that was clicked to the\nevent callback functions. What happens next is up to the application designer.\n\n`lv_file_explorer` uses the Table (lv\\_table) Widget for the \"Browsing Area\", and the\nList (lv\\_list) Widget for the \"Quick-Access\" panel when it is enabled. Thus,\n`LV_USE_TABLE` macro must be set to a non-zero value in `lv_conf.h` in\norder to use `lv_file_explorer`, and and `LV_USE_LIST` must be set to a\nnon-zero value to use the \"Quick-Access\" panel.\n\nIn order to use File Explorer, File System (lv\\_fs\\_drv) has to be set up and\nknow about all the drive letters you use when passing paths to File System\n(described below).\n\nIf you haven't already done so, you will need to learn about the LVGL File\nSystem abstraction, since it must be set up and be functional\nfor File Explorer to work.\n\nSet `LV_USE_FILE_EXPLORER` to a non-zero value in `lv_conf.h`.\n\nFirst use `lv_file_explorer_create(lv_screen_active())` to create a File\nExplorer. The default size is the screen size. After that, you can\ncustomize the style like any Widget.\n\nThe size of the `current_path` buffer is set by `LV_FILE_EXPLORER_PATH_MAX_LEN`\nin `lv_conf.h`.\n\nThe object hierarchy of a freshly-created File Explorer looks like this:\n\nThis list of functions provides access to the parts shown in diagram above:\n\nThe `Quick-Access Panel` behaves like a typical navigation panel and appears on the\nleft, while the `Browser Panel` appears on the right\n\nThis panel is optional. If you set `LV_FILE_EXPLORER_QUICK_ACCESS` to `0`\nin `lv_conf.h`, the `Quick-Access Panel` will not be created. This saves only a\nlittle bit of memory.\n\nSoon after the File Explorer is created, you typically use\n\n`lv_file_explorer_set_quick_access_path(explorer, LV_EXPLORER_XXX_DIR, \"path\")`\n\nto set the path that will be navigated to when the buttons in the `Quick-Access Panel`\nare clicked, which is currently a fixed list. The corresponding values you will need\nto pass as the 2nd argument are the following:\n\nYou can use\n`lv_file_explorer_set_sort(explorer, LV_EXPLORER_SORT_XX)` to set\nthe sorting method.\n\nThese are the possible sorting methods:\n\n`lv_file_explorer_get_sort(explorer)` returns the current sorting method.\n\n- `LV_EVENT_READY` Sent when a directory is opened, which can happen:\n\n- when the File Explorer is initially opened,\n- after a user clicks on a `Quick-Access Panel` navigation button, and\n- after the user clicks on a directory displayed in the `Browser Panel`.\n\nYou can use it to, for example, customize the file sort.\n- `LV_EVENT_VALUE_CHANGED` Sent once when any item (file) in the\n`Browser Panel`'s file list is clicked.\n- `LV_EVENT_CLICKED` Sent twice when an item in the `Browser Panel`\nis clicked: once as a result of the input-device `LV_EVENT_RELEASED`\nevent and a second as a result of the input device `LV_EVENT_CLICKED`\nevent. This applies to files, directories, and the \"< Back\" item in the `Browser Panel`.\n\nIn these events you can use `lv_file_explorer_get_current_path` to get the\ncurrent path and `lv_file_explorer_get_selected_file_name` to get the name\nof the currently selected file in the event processing function. For example:\n\n```\nstatic void file_explorer_event_handler(lv_event_t * e)\n{\nlv_event_code_t code = lv_event_get_code(e);\nlv_obj_t * obj = lv_event_get_target(e);\n\nif(code == LV_EVENT_VALUE_CHANGED) {\nchar * cur_path = lv_file_explorer_get_current_path(widget);\nchar * sel_fn = lv_file_explorer_get_selected_file_name(widget);\nLV_LOG_USER(\"%s%s\", cur_path, sel_fn);\n}\n}\n```\n\nYou can also save the obtained **path** and **file** name into an array\nthrough functions such as `strcpy` and `strcat` for later use.\n\nDeprecated\n\nThe examples below use the deprecated `lv_file_explorer` widget. For new code,\nprefer building a file browser from a table and the `lv_fs` API, as shown in\n`lv_example_table_file_browser`.\n\nLast updated on"}], "source": "https://lvgl.io/docs/open/auxiliary-modules/file_explorer"} {"conversations": [{"from": "system", "value": "You are a coding and engineering mentor for students in the VEX V5 Robotics Competition (VRC). Your job is to help students build working robots and also understand why they work, so they get better on their own.\n\n## Who you're helping\n- Mostly middle and high school students, with experience ranging from first-week beginners to veteran teams.\n- If you can't tell their level, start simple and ask one short question, or adjust based on how they write.\n\n## Technical scope\n- Languages and platforms: VEXcode V5 (C++ and Python), PROS (C++), and RobotMesh Studio when relevant. Ask which one they use if it isn't clear, and never mix APIs between them.\n- Common topics: drivetrain setup, motor groups, tank/arcade/holonomic drive control, sensors (inertial, rotation, optical, distance, vision/AI vision), PID control, odometry, autonomous routines, driver-control tuning, debugging, and pneumatics/mechanism logic.\n- Beyond code, you can also help with design choices, strategy, scouting, engineering notebook structure, and interview/judging prep.\n\n## How to help\n1. Lead with the answer or working code, then explain it briefly.\n2. Comment code so a student can follow it, and explain non-obvious lines (e.g., why a deadband exists, what a PID constant does).\n3. When debugging, ask for the error message, the relevant code, and what the robot actually did vs. what was expected. Suggest the most likely cause first, and give a way to test it.\n4. For tuning (PID, turn accuracy, autonomous timing), give a systematic method, not random numbers.\n5. Teach as you go. For learners, offer a short \"why this works\" note. Don't write long lectures unless asked.\n6. Keep responses concise. Use code blocks for all code, and numbered steps for procedures.\n\n## Honesty and accuracy\n- Never invent API functions, parameters, or library features. If you're unsure whether something exists in a given version of VEXcode or PROS, say so and suggest how to verify it in the docs.\n- Game rules, scoring, and leg"}, {"from": "human", "value": "Summarize the following source: Fragment | LVGL Open"}, {"from": "gpt", "value": "Auxiliary Modules\n\n# Fragment\n\nFragment is a concept copied from Android.\n\nThis module is now deprecated and will be removed in an upcoming release.\n\nFragment is a concept copied from\nAndroid.\n\nIt represents a reusable portion of your app's UI. A fragment defines\nand manages its own layout, has its own lifecycle, and can handle its\nown events. Like Android's Fragment that must be hosted by an activity\nor another fragment, Fragment in LVGL needs to be hosted by a Widget,\nor another fragment. The fragment's view hierarchy becomes part of, or\nattaches to, the host's view hierarchy.\n\nSuch concept also has some similarities to UiViewController on\niOS.\n\nFragment Manager is a manager holding references to fragments attached\nto it, and has an internal stack to achieve forward and backwards navigation. You can use\nfragment manager to build a navigation stack, or a multi-pane application\neasily.\n\nEnable `LV_USE_FRAGMENT` in `lv_conf.h`.\n\n```\nstruct sample_fragment_t {\n/* IMPORTANT: don't miss this part */\nlv_fragment_t base;\n/* States, object references and data fields for this fragment */\nconst char *title;\n};\n\nconst lv_fragment_class_t sample_cls = {\n/* Initialize something needed */\n.constructor_cb = sample_fragment_ctor,\n/* Create view objects */\n.create_obj_cb = sample_fragment_create_obj,\n/* IMPORTANT: size of your fragment struct */\n.instance_size = sizeof(struct sample_fragment_t),\n};\n```\n\n```\n/* Create fragment instance, and Widgets will be added to container */\nlv_fragment_manager_t *manager = lv_fragment_manager_create(container, NULL);\n/* Replace current fragment with instance of sample_cls, and init_argument is user defined pointer */\nlv_fragment_manager_replace(manager, &sample_cls, init_argument);\n```\n\n```\n/* Add one instance into manager stack. View object of current fragment will be destroyed,\n* but instances created in class constructor will be kept.\n*/\nlv_fragment_manager_push(manager, &sample_cls, NULL);\n\n/* Remove the top most fragment from the stack, and bring back previous one. */\nlv_fragment_manager_pop(manager);\n```\n\nLast updated on"}], "source": "https://lvgl.io/docs/open/auxiliary-modules/fragment"} {"conversations": [{"from": "system", "value": "You are a coding and engineering mentor for students in the VEX V5 Robotics Competition (VRC). Your job is to help students build working robots and also understand why they work, so they get better on their own.\n\n## Who you're helping\n- Mostly middle and high school students, with experience ranging from first-week beginners to veteran teams.\n- If you can't tell their level, start simple and ask one short question, or adjust based on how they write.\n\n## Technical scope\n- Languages and platforms: VEXcode V5 (C++ and Python), PROS (C++), and RobotMesh Studio when relevant. Ask which one they use if it isn't clear, and never mix APIs between them.\n- Common topics: drivetrain setup, motor groups, tank/arcade/holonomic drive control, sensors (inertial, rotation, optical, distance, vision/AI vision), PID control, odometry, autonomous routines, driver-control tuning, debugging, and pneumatics/mechanism logic.\n- Beyond code, you can also help with design choices, strategy, scouting, engineering notebook structure, and interview/judging prep.\n\n## How to help\n1. Lead with the answer or working code, then explain it briefly.\n2. Comment code so a student can follow it, and explain non-obvious lines (e.g., why a deadband exists, what a PID constant does).\n3. When debugging, ask for the error message, the relevant code, and what the robot actually did vs. what was expected. Suggest the most likely cause first, and give a way to test it.\n4. For tuning (PID, turn accuracy, autonomous timing), give a systematic method, not random numbers.\n5. Teach as you go. For learners, offer a short \"why this works\" note. Don't write long lectures unless asked.\n6. Keep responses concise. Use code blocks for all code, and numbered steps for procedures.\n\n## Honesty and accuracy\n- Never invent API functions, parameters, or library features. If you're unsure whether something exists in a given version of VEXcode or PROS, say so and suggest how to verify it in the docs.\n- Game rules, scoring, and leg"}, {"from": "human", "value": "Summarize the following source: API Conventions | LVGL Open"}, {"from": "gpt", "value": "# API Conventions\n\nIn most cases, the API functions of LVGL widgets are structured like:\n\nIn most cases, the API functions of LVGL widgets are structured like:\n\n- `lv_ + + create(parent)`\n- `lv_ + + set + (widget, value)`\n- `lv_ + + get + (widget)`\n- `lv_ + + add + (widget)`\n\nAll widget types share some basic attributes:\n\n- Position\n- Size\n- Parent\n- Styles\n- Event callbacks\n- Flags like *Clickable*, *Scrollable*, etc.\n- Etc.\n\nYou can set/get these attributes with `lv_obj_set_...` and\n`lv_obj_get_...` functions. For example:\n\n```\n/* Set basic widget attributes */\nlv_obj_set_size(btn1, 100, 50); /* Set a button's size */\nlv_obj_set_pos(btn1, 20, 30); /* Set a button's position */\n```\n\nFor complete details on position, size, coordinates, and layouts, see Position and Size.\n\nThe widget types have special attributes as well. For example, a slider has:\n\n- Minimum and maximum values\n- Current value\n\nFor these special attributes, every widget type may have unique API functions. For\nexample, for a Slider:\n\n```\n/* Set slider-specific attributes */\nlv_slider_set_range(slider1, 0, 100); /* Set the min and max values */\nlv_slider_set_value(slider1, 40, LV_ANIM_ON); /* Set the current value (position) */\n```\n\nThe API of the Widgets is described in their Documentation, but you\ncan also consult each Widget's respective header file (e.g., *widgets/lv\\_slider.h*) to\nfind a quick reference to function prototypes with brief documentation about each.\n\nWidgets can be created and deleted dynamically at runtime. Only currently created\n(existing) Widgets consume RAM.\n\nThis allows you to create a Screen only when a button is clicked to open it, and to\ndelete Screens when a new screen is loaded.\n\nUIs can be created based on the current environment of the device. For example, you\ncan create meters, charts, bars, and sliders based on the currently attached sensors.\n\nEvery widget has its own **create** function with a prototype like this:\n\n```\nlv_obj_t * lv__create(lv_obj_t * parent)\n```\n\nThe create functions only have a `parent` parameter specifying on which widget to\ncreate the new widget.\n\nThe return value is a pointer to the created widget of type `lv_obj_t *`.\n\nThere is a common **delete** function for all widget types. It deletes the widget and\nall of its children.\n\n```\nvoid lv_obj_delete(lv_obj_t * widget);\n```\n\n`lv_obj_delete` deletes the widget immediately. If for any reason you can't\ndelete the widget immediately, you can use `lv_obj_delete_async(widget)`\nwhich will perform the deletion on the next call of `lv_timer_handler`. This\nis useful, for example, if you want to delete the parent of a widget in the child's\n`LV_EVENT_DELETE` handler. Once deleted, the RAM a Widget occupies is\nfreed.\n\nYou can remove all the children of a widget (but not the widget itself) using\n`lv_obj_clean(widget)`.\n\nYou can use `lv_obj_delete_delayed(widget, 1000)` to delete a widget after\nsome time. The delay is expressed in milliseconds.\n\nBy calling `lv_obj_null_on_delete(&widget)`, the `lv_obj_t *` variable of\nthe widget will be set to NULL when the widget is deleted. This makes it easy to check\nwhether the widget exists or not.\n\nHere is an example that uses some of the functions above:\n\n```\nstatic lv_obj_t * my_label; /* Static in the file so it stays valid */\n\n/* Call it every 2000 ms */\nvoid some_timer_callback(lv_timer_t * t)\n{\n/* If the label is not created yet, create it and also delete it after 1000 ms */\nif(my_label == NULL) {\nmy_label = lv_label_create(lv_screen_active());\nlv_obj_delete_delayed(my_label, 1000);\nlv_obj_null_on_delete(&my_label);\n}\n/* Move the label if it exists */\nelse {\nlv_obj_set_x(my_label, lv_obj_get_x(my_label) + 1);\n}\n}\n```\n\nIf you need to perform cleanup when a widget is deleted, you can register a delete\ncallback using `lv_obj_add_delete_cb(widget, cb, user_data)`.\nThe callback will be automatically invoked with `user_data` as its argument when the widget\nis deleted.\n\nThis is a convenience utility built on top of `LV_EVENT_DELETE`, useful for freeing\nresources that are tied to a widget's lifetime without manually managing event handlers.\n\nThe following example automatically deletes a timer when the widget is deleted:\n\n```\nlv_timer_t * timer = lv_timer_create_basic();\nlv_obj_add_delete_cb(obj, (lv_delete_cb_t)lv_timer_delete, timer);\n```\n\nThe following example frees a heap-allocated buffer when the widget is deleted:\n\n```\nvoid * my_data = malloc(64);\nlv_obj_add_delete_cb(obj, free, my_data);\n```\n\n`lv_obj_add_delete_cb` returns a pointer to the created `lv_delete_dsc_t`\ndescriptor, which can be used to remove the callback later if needed via `lv_obj_remove_delete_cb`.\nMultiple delete callbacks can be attached to the same widget, and all of them will be called when the widget is deleted."}], "source": "https://lvgl.io/docs/open/common-widget-features/api"}