Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
109 lines (69 sloc) 4.11 KB

Setting up the PyCharm IDE

This tutorial will guide you through setting up the PyCharm editor with support for our robot software. This means that the editor can do a better job of checking your code and suggesting as you type, saving you wasting time transferring your code to your robot only to find that a variable name has been mispelt, or something equally menial!

First, open up PyCharm from the Start Menu:

Searching for and selecting PyCharm in the Start Menu.

Searching for and selecting PyCharm in the Start Menu.

It may ask you to read and accept their terms and conditions before you can proceed:

The terms and conditions dialogue box.

The terms and conditions dialogue box.

Firstly, we will need to create a new project.

The welcome dialogue, with the Create New Project button.

The welcome dialogue, with the Create New Project button.

Next, you will need to configure the environment for your project. This ensures that we are using a compatible version of Python (3.6 or later), and that Pycharm is aware of the other code running on, and controlling your robot.

At the top of the dialogue box, choose an appropriate location to save your code.

Hint

If you are using a university computer, files that are placed in your H:/ drive will be synchronised and backed up across any other university computer.

Select New Environment using Virtualenv, and Python 3.6 for the base interpreter.

Warning

The location of Python 3.6 may vary by computer. Ask a volunteer for help if you are stuck.

Project configuration dialogue

Project configuration dialogue

Once PyCharm has finished loading, we need to create a new main.py.

Right-click on your project name, select New -> Python File.

Create a new Python file

Create a new Python file

You will need to name your file main.py or your robot will not recognise it.

Naming your file

Naming your file

In order to get suggestions as you type your code, you'll need to install the same Python package that is used on your robot, which is called sbot. You can do this by opening PyCharm's settings, navigating to the "Project Interpreter" tab, and pressing the Install button:

Opening PyCharm's settings from the File menu.

Opening PyCharm's settings from the File menu.

The Project Interpreter tab in PyCharm's settings.

The Project Interpreter tab in PyCharm's settings.

This button opens the package installation window.

This button opens the package installation window.

Enter "sbot" into the search bar and ensure it is selected in the pane on the left, then press "Install Package". This will take some time, so wait for the green success message.

Installing sbot

Installing sbot

Installation success

Installation success

You are now ready to program your robot. Pycharm will give you auto-suggestions and let you know if your code is mis-spelt or has other common errors.

Code auto-suggestions

Code auto-suggestions

You can’t perform that action at this time.