Robotics Lab 01 Intro Brought to you by your Spring 2019 Robotics Practicum Class: Rishabh Choudhary, Jacob Cook, Cameron Higgins, Laura Stegner, Nick Trevethan
Your Robot: Zumo 32U4 from Pololu
What can it do? -
Proximity Sensor Line Sensor Buttons Buzzer LEDs LCD Accelerometer/compass/gyro Encoders
How do I make it work? -
Runs on an 8-bit microcontroller (MCU) Programmed in C++ using Arduino IDE and Arduino support libraries Arduino requires two functions: -
setup() Runs one time when the Zumo turns on loop() Runs after setup is complete, Loops until board is turned off
But if it’s C, where did main() go? -
Behind the scenes, to ease the programming process for newcomers
What do I put in setup() and loop() ? -
setup() -
-
Runs one time when the Zumo turns on
loop() -
Runs after setup is complete Loops until board is turned off
Where do I put my custom functions? -
Arduino vs typical C/C++ application - setup() and loop() called from main() - User functions can be placed ANYWHERE - Before setup - Between setup and loop - After loop
Great, I have code.. Now what? -
Connect your Arduino to your computer via USB cable that is provided with your robot The drivers should automatically install on your computer Go to (Tools->Port) and select the COM port the Zumo is connected to (This solves most issues with uploading)
-
Compile your sketch using the compile button
-
Upload your program to the board using the upload button
What else should I know before I start?
Reset: - Code runs from top On/Off: - On to power everything - Off+No USB: no power - Off+USB: power everything except motors
Okay, so what are we actually doing? -
Fight club!
-
No, not really
-
Well, no, not yet…
-
But next time?
-
Sure, sure...
-
But wait, yes really?
Okay, so what are we actually doing? -
Getting started: -
Setup the Arduino IDE to program the Zumo 32U4 Build basic functions to demonstrate maneuverability Explore and implement sensor-actuator use and integration
How can I get started? -
-
Download Arduino IDE Install Zumo 32U4 support - Library - Board See pre-lab for detailed installation instructions
What do I need to do? -
-
-
Phase 1: Get to know the arduino environment and the Zumo robot - Test uploading code - Intro to hardware debugging - Run curated example code Phase 2: Become comfortable working with Arduino Classes and functions - Use provided code snippets to solve a given task - Build a function toolbox based on the code you create - Used in the next phase - Used in the next lab Phase 3: Use your tool box to complete 2 open-ended challenges - Implement a complete solution to a simple robotics problem - Use previously developed functions and debugging skills to solve
Robot Shuffleboard Demo
●
Detect proximity of surface
●
Conditionally move robot closer and closer to a surface
●
Stop robot just before reaching the surface
Robot Orienteering Demo ● ● ●
Move robot forward Detect waypoints Change heading based on lab instructions 3
2 1
Start
PUT ORIENTEERING DEMO VIDEO HERE
What if something goes wrong? -
-
Time to debug! Start by testing smaller chunks of code - This will ensure individual components are working Confirm that your hardware is functioning as you expect - Use Serial Plotter - Use Serial Monitor - Use Device Manager Be cautious about copy/paste code directly into Arduino IDE. It doesn’t understand things like opening vs closing parenthesis***
I can’t seem to upload code anymore.. -
Try these fixes: - Kill all Arduino tasks AND any Java tasks in the Task Manager - Restart Arduino IDE + Disconnect/reconnect Zumo bot - Open Device Manager in the Control Panel and “Scan for Hardware Changes”
How do I use the serial monitor/plotter? ●
Arduino uses the Serial class to talk to a PC ○ ○
●
Opening the Serial Monitor ○ ○ ○
●
Magnifying glass in the top right corner of the IDE Tools->Serial Monitor Ctrl+Shift+M
Opening the Serial Plotter ○ ○
●
Text is read via the Serial Monitor Comma/Space separated variables are plotted via the Serial Plotter
Tools->Serial Plotter Ctrl+Shift+L
Resolving Issues ○ ○
Make sure the correct COM port is selected Can find your robot’s port under Windows Device Manager -> Ports COM&LPT