Lab 0

purpose | preparation | procedure

In this lab you will find a partner, sign out a Pololu 3$\pi$ robot and familiarize yourself with its programming tools.

In-lab presentation

The slides that Ms Hogan, the lab instructor, delivered in the lab are visible in the frame to the right. If they are difficult to see, however, you can also download the slides.

Purpose and Outcomes

In the lab, you will receive a 3$\pi$ robot and learn how to use the software tools required to load software onto it.

Preparation

Before coming to the lab, you must:

Purchase a “Physics-style” lab book from the bookstore, i.e., one that includes axes for graphing:

lab book with graph axis

You will need one lab book between two partners.

Create a LabNet account through the self-serve account generation tool.

LabNet account generation tool

Procedure

Follow the instructions below, noting your actions and observations in your log book.

Sign out your robot

There will be one robot for each pair of lab partners. You will need to sign this out from the ECE lab technologists (Glenn & Greg, who you should meet in the lab). You must return your robot before the end of the term.

Set up your robot

Ensure your 3$\pi$ has fresh batteries installed correctly.

Plug your 3$\pi$ into its programmer:

foo

Plug the programmer into a USB port on your computer.

Set up Eclipse

The very first time that you program a 3$\pi$ robot on your account, you must install some settings that tell Eclipse how to interact with the robot. This is only required the first time you do this: in future labs, you will not need to replicate this step.

Download ENGI1020 Settings.epf (right-click, “Save link as…”):

Saving ENGI 1020 Settings file

Open Eclipse

Find Eclipse in the Applications menu under Development:

Opening Eclipse with the launcher

Accept the default workspace location:

Eclipse workspace settings

Import ENGI 1020 settings into Eclipse

In the File menu, select Import > General > Preferences:

Selecting "Import" from the "File" menu Importing preferences

Click Browse and find ENGI1020 Settings.epf:

Choosing the settings to import

Ensure that Import All is checked and click Finish:

Importing all ENGI 1020 preferences

Once again, this step of importing settings only needs to be done the first time you program a 3$\pi$ robot on your account.

Import the lab template

Download lab0.zip (right-click, “Save link as…”):

Saving the lab 0 project zip file

In the File menu, select Import > General > Existing Projects into Workspace.

Selecting "Import" from the "File" menu Importing an existing project

Click Select archive file and Browse to lab0.zip:

Importing lab0.zip

Click OK, then Finish.

Modify the C++ source code

Double-click lab0.cpp to open this C++ source file:

Opening lab0.cpp

In lab0.cpp:

  1. fix the block comment at the top of the file to identify yourselves and
  2. press Ctrl+S (or File > Save) to save the changes you’ve made.

That’s all you need to do to modify the C++ source code that your robot’s software will be built from! Of course, the rest of the course will be about learning what changes to make to code…

Compile and run the program

Open Eclipse’s C++ “perspective”:

Opening the C/C++ perspective

Eclipse can be used to work with software in many languages besides C++. When we choose the C++ “perspective”, it makes C++-relevant tools available. For instance, it includes a button to compile our software (Eclipse/C++ "build" button) and another one to download a compiled program onto a connected robot (AVR-Eclipse "download" button).

Compile the program: Eclipse/C++ "build" button

Ensure that the Problems tab at the bottom of the screen is empty: An empty "problems" pane

Download your program to the 3$\pi$: AVR-Eclipse "download" button

It should start to execute immediately, showing a message on the LCD display.

A program executing on a 3$\pi$ robot

Try playing with the program… what does it do?

Write a conclusion

Summarize the lab: what was the final outcome? What did you learn?