Skip to content

Python

We’re considering adding functionality to program our robot with Python. This is a guide to help get you started with Python.

Setup

Python Installation

  • Go to this link: https://www.python.org/downloads/windows/ and download the 64 bit windows installer.
  • Open the downloaded file
  • Hit “Install Now”, and check the “Use admin privileges when installing py.exe” button.
  • Hit close when finished

FRC Game Tools installation

PyCharm IDE Installation

  • Go to this link: https://www.jetbrains.com/pycharm/download/?section=windows and scroll down to “PyCharm Community Edition”. Then, hit the “Download” button. This should be a free IDE so if it says to put your payment info in then you hit the wrong button.
  • Once it downloads, open the downloaded file.
  • Allow admin access, then once the PyCharm setup window appears hit “next”
  • Then hit “next” again.
  • Check the Desktop Shortcut, Context Menu, and Create Associations checks, and Update PATH variable
  • Hit “next”
  • Finally, hit install.
  • Hit “Reboot now” and “Finish”

RobotPy Installation

  • Open the computer’s search bar and type “cmd”.
  • Once it pops up (as “command prompt”), hit “run as administrator.”
  • Type the following command: py -3 -m pip install robotpy
  • Next, type: py -3 -m pip install --upgrade robotpy
  • Close out of the command prompt.

Setting up a project

  • Open command prompt again NOT as administrator. You will be creating a folder for your project.

To do this, type the following command, replacing ExampleName with anything: mkdir ExampleName

  • Type the following command with the same name that you just created: cd ExampleName
  • Now, we will be copying the files that we just downloaded. Make sure that you still have the Path copied from step B. Now, type the following command but make sure to remove the parentheses from the copied string: xcopy EXAMPLEPATH
  • Now, the files that are copied are easier than remembering commands. To create the empty project type “createproject” then hit enter.
  • Type “sync” and hit enter. When the new window pops up, hit enter again.
  • Open your file explorer and navigate to the folder that you created in step E.
  • Right click “pyproject.toml” and select “open with” then chose another app. From there, hit “notepad”.
  • The file that pops up will look daunting. DO NOT MODIFY anything but a single hashtag. Remove the hashtag next to “all”
  • Go back to your cmd. From there, type “sync” and hit enter. Hit enter when the new window pops up.

You are now done! You are all set to begin coding the robot.