{"id":13695718,"url":"https://github.com/robotpy/pyrobottraining","last_synced_at":"2026-02-27T23:15:15.787Z","repository":{"id":141823245,"uuid":"47526354","full_name":"robotpy/pyrobottraining","owner":"robotpy","description":"Teaches students Robot programming in python by having them create code that passes the unit tests","archived":false,"fork":false,"pushed_at":"2015-12-30T03:52:41.000Z","size":7,"stargazers_count":7,"open_issues_count":1,"forks_count":10,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-13T20:01:01.817Z","etag":null,"topics":["frc-robot","python","robotpy"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/robotpy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-12-07T03:13:27.000Z","updated_at":"2022-09-21T17:42:53.000Z","dependencies_parsed_at":"2023-03-16T14:30:37.519Z","dependency_job_id":null,"html_url":"https://github.com/robotpy/pyrobottraining","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/robotpy/pyrobottraining","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robotpy%2Fpyrobottraining","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robotpy%2Fpyrobottraining/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robotpy%2Fpyrobottraining/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robotpy%2Fpyrobottraining/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/robotpy","download_url":"https://codeload.github.com/robotpy/pyrobottraining/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robotpy%2Fpyrobottraining/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29918976,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-27T19:37:42.220Z","status":"ssl_error","status_checked_at":"2026-02-27T19:37:41.463Z","response_time":57,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["frc-robot","python","robotpy"],"created_at":"2024-08-02T18:00:32.729Z","updated_at":"2026-02-27T23:15:15.771Z","avatar_url":"https://github.com/robotpy.png","language":"Python","readme":"pyrobottraining\n===============\n\nThis is a repository that can be used as a tool to teach you about programming\nan FRC robot using python and the RobotPy WPILib libraries.\n\nNote: If you aren't very familiar with python programming, you may want to\ncomplete  [pybasictraining](https://github.com/frc1418/pybasictraining) first,\nwhich will teach you the basics of programming in python.\n\nPreparation\n===========\n\nInstall the requirements\n------------------------\n\nOne of the really useful things about python is that you can write code that\nbehaves the same regardless of which platform you're running it on. As such,\nthe challenges should function the same regardless of whether you're using\nWindows or OSX or Linux. However, each platform will require slightly different\nsteps to install the necessary requirements.\n\n### OSX/Linux\n\nYou need to have the following things installed:\n\n* [Python 3.5 or greater](https://www.python.org/downloads/release/python-350/)\n  (this requires admin access)\n* The `pyfrc` python module and its requirements\n  * If you have admin access, install via `sudo pip3 install pyfrc`\n  * If you don't, you can install via `pip3 install --user pyfrc`\n\n### Windows\n\nYou need to have the following things installed:\n\n* [Python 3.5 or greater](https://www.python.org/downloads/release/python-350/)\n  (this requires admin access)\n* The `pyfrc` python module and its requirements\n  * At a command prompt, `py -3 -m pip install pyfrc`\n\nGet the code\n------------\n\nYou need to clone this git repository somewhere on your computer. You can use\neclipse to do this, or open up a terminal and run the following:\n\n    git clone https://github.com/robotpy/pyrobottraining.git\n\nAbout the challenges\n--------------------\n\nIn [the challenges](#the-challenges) section, each bullet point is a challenge\nyou must complete. The name of the challenge is listed first, followed by the\ndescription of the challenge.\n\nAll of the challenges will involve adding code to robot.py, which is a file\nthat could potentially be used to control a real FRC robot. You can also run\nyour code using the pyfrc robot simulator.\n\nPlease keep in mind that there are generally many different ways you can get\nthe challenge tests to pass, but typically each test is a simple step that\nbuilds upon the knowledge/things done in previous tests. You are encouraged\nto complete the tests in order.\n\n\nTesting to see if you beat the challenges\n-----------------------------------------\n\nThe challenges currently need to be run in the terminal/command line. This means\nyou need to open up a terminal or cmd and change directories to wherever you\nchecked out the code.\n\nThere are two ways to run the challenges. If you think your code can beat ALL\nof the challenges, then you can run the tests the same way that you will run \ntests when you write real robot code (because this IS real robot code):\n\n    OSX/Linux: ./robot.py test\n    Windows:   py robot.py test\n\nHowever, running all the challenges can be a bit confusing and give you a lot\nof errors that you don't care about when concentrating on beating the current\nchallenge. To run a single challenge, do this instead:\n\n    OSX/Linux: ./run_single.sh CHALLENGE\n    Windows    run_single.bat CHALLENGE\n  \nSo for example, to run challenge `v1` on OSX or Linux, you would do this:\n\n    ./run_single.sh v1\n\nWhereas on Windows you would do this:\n\n    run_single.bat v1\n\nShould be simple enough!\n\nDocumentation\n-------------\n\nBefore you start creating code for the challenges, you may find it useful to\nread through the following resources:\n\n* [Anatomy of a Robot](http://robotpy.readthedocs.org/en/latest/guide/anatomy.html) -\n  this is a python-focused guide for writing FRC Robot code, and tells you about\n  each piece and how they fit together.\n* [Python WPILib Documentation](http://robotpy.readthedocs.org/en/latest/wpilib.html) -\n  contains information about using all the various pieces of WPILib\n\nChallenges\n==========\n\nbasics\n------\n\nAt all times your robot code must pass all basic pyfrc tests, which ensure that\nyour robot can pass through all modes without crashing. Additionally, you must\ndocument all methods and classes with docstrings.\n\nThe basic tests will only run when running all other tests, and not when running\nsingle tests.\n\ninitialization\n--------------\n\nWhen initializing motors and sensors in your robot code, you should do it in\nthe `robotInit` method. These challenges will ask you to create a `robotInit`\nmethod, and create various objects in it. You may find it convenient to add\nadditional initialization code to `robotInit` for other challenges.\n\n* i1 - Create a `robotInit` method in the `MyRobot` class\n* i2 - Create a Talon motor controller object that uses PWM channel 1 (`motor1`)\n* i3 - Create a Talon motor controller object that uses PWM channel 2 (`motor2`)\n* i4 - Create a Victor motor controller object that uses PWM channel 3 (`motor3`)\n* i5 - Create a Victor motor controller object that uses PWM channel 4 (`motor4`)\n* i6 - Create a digital input object on port 1 (`dio1`)\n* i7 - Create an analog input object on port 5  (`analog5`)\n* i8 - Create a joystick object on port 0, and assign it to an instance variable\n  named `stick`\n  \nMotor control\n-------------\n\nThese challenges will require you to create code that executes when the robot\nis actually running -- in the `teleopPeriodic` method.\n\n* m1 - Define a `teleopPeriodic` method\n* m2 - During teleop, set the value of `motor1` to 1.0. When not in teleop, set \n  to 0\n* m3 - During teleop, set the value of `motor2` to the value of the joystick's\n  X axis. When not in teleop, set to 0\n* m4 - During teleop, if `dio1` is on, then set the value of `motor3` to the\n  value of the joystick's Y axis. If it is off, then set the motor to 0.\n\nSimple state machines\n---------------------\n\n* s1 - If the robot's battery voltage drops below 9 volts, set motors 1-3 to\n  0 until the voltage rises above 10 volts or the robot is disabled (you must\n  have completed m1-m4)\n* s2 - During teleop, set motor4 to 0. If the joystick trigger is pressed and\n  released, set motor4 to the value of the joystick's Z axis until the joystick\n  trigger is pressed and released again. If the robot enters disabled\n  mode, when the robot enters teleop it should not turn motor4 back on until\n  the trigger has been pressed and released again\n\nAutonomous mode\n---------------\n\nTODO\n\n\n","funding_links":[],"categories":["Required for robot programmers","Repositories"],"sub_categories":["Python"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobotpy%2Fpyrobottraining","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frobotpy%2Fpyrobottraining","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobotpy%2Fpyrobottraining/lists"}