Programming Your Robot
Robots built using the SR kit are programmed with Python 3.11 which is made possible with a custom-built Python library, sr.robot3
, which is pre-installed on your robot.
This library deals with talking to the boards and doing all the complicated bits so you can focus on the fun bits.
The Robot API page has the details about this library. The other pages in this section contain all of the information you need to know to successfully code for your robot.
Learning python
Your robot is programmed in Python, so to make your robot do things you will need at least a basic understanding of Python.
There are a number of tutorials out there which might help you to learn to program in Python:
-
Our tutorial, called Python: A whirlwind tour. This was written especially for Student Robotics competitors, and explains the basics while trying not to overwhelm you.
-
The Official Tutorial – The tutorial provided by the people who make Python. Most of the useful stuff starts at chapter 3, but you should at least skim the stuff before it; there is a lot there and it may be a little overwhelming.
-
A number of beginners tutorials are linked to from the python wiki. One of these that we would suggest is the Wikibooks Tutorial.
-
The Official Python Docs contains every piece of information about the core language that you would need. The format isn’t that digestible, use it as a reference and use the search to find a specific section that you need.
Writing code
In order to develop the code for your robot, you will write it on your computer and then transfer it to your robot. Unlike other code you may be used to writing, you won’t be able to run your robot code from your computer — it needs to be run on your robot.
A good code editor can provide you with features such as auto completion and syntax highlighting which will help you more easily write code. For suggestions of suitable editors, and how to set them up see the Code Editors section.
Other than an editor to write the code, you don’t need anything else to get started.