.. | ||
README.md |
1 - Getting Started
There won't be any code here, this README is just here to tell you a little about Python, what to install, and to pre-emptively answer some of the questions I expect you might have.
A little about Python
Python is an exceptionally popular high-level programming language that is used in a variety of applications today from enterprise applications, to mobile apps, to industrial automation and machine learning.
Python as a language allows for many "forms" of programming. But the "form" that we will deal with the most is the Object Oriented form. Object Oriented Programming (or OOP) is a concept where you create templates of real world objects (called classes) and use those classes to create representations of the real world objects in software.
Python is a relatively easy language to learn for beginners, it handles memory management, variable type management (determining what a variable "is", is it a number, text, an object, etc.), and has an overall easy to learn syntax (the words and characters you use to write code).
Python is not without it's caveats. For those programmers coming from other languages like C/C++ and Java, or for new programmers, it can be difficult to get used to Python's touchy-ness about making sure there is enough whitespace and indentation. We'll see what I'm talking about when we look at actual code, once you get used to it it's not that bad.
One other major caveat to Python is it's not the fastest language in the world. Similar to Java, Python code runs in a sort of Virtual Machine. You can think of it as running a computer on top of a computer. The Virtual Machine "understands" the compiled form of Python, and translates that to what your physical computer can understand. This makes Python able to run basically anywhere given there's a Virtual Machine written for the hardware you're using, with the caveat that running the Virtual Machine introduces some overhead, wasting resources compared to languages like C/C++. I suspect that the vast majority of FRC Teams won't run into any issues with this. Modern Python is much faster than it used to be, but it's good to note for the future should you attempt to try anything crazy on your own time.
Installing what you need
There are a few things you need to get started, I would check these off in order, as some of the later elements require certain things to be installed before you can move forward.
- An Integrated Development Environment (IDE)
- I recommend VSCode, because if you decide to switch to Java or C++ later, that's what you'll use, but PyCharm would also be a decent choice
- A Supported OS
- I have tested Windows 10 and Ubuntu 18.04 LTS with success
- Python 3.7 x64
- It must be 3.7! Don't install the latest version, without going into great detail, there are certain things that need to be installed, and if you're using a newer version than 3.7, Python will automatically try to recompile certain things and you'll run into a ton of errors that aren't easy to solve.
- The Most Recent Version of PIP
- PIP is how you install Python modules, once Python is installed, you should make sure you have the most recent version of PIP
- On Windows, open command prompt and type the following command
python -m pip install --upgrade pip
- The Most Revent Version of RobotPy
- RobotPy is the existing modules that contain the things we need to write robot code
- On Windows, open command prompt and type the following command
pip install robotpy\[all\]