Loading...
Loading...
Loading...
Loading...
Loading...
I can connect to my Raspberry Pi via SSH.
I can deploy an app to a Raspberry Pi.
You will submit a link to your GitHub repo.
You will demonstrate your capacity to control your robot.
You will be asked regular comprehension questions about Raspberry Pis.
During our school's open house days, I setup a few GoPiGo robots that respond when visitors hold their hand in front of the sensors. We'll make our own version of this function. It's fun and an easy way for us to start responding to data from the ultrasonic sensor.
Power-up your robot and connect over SSH
Go to your project folder: cd PnR-Final
Launch Python: python
Import our file: import student
Instantiate our Piggy: p = student.Piggy()
Experiment with the sensor with p.dist()
Let's look at our menu and create a new option for open house. We'll keep checking dist()
and perform some sort of action when it returns a number too close
Before you start on your project to experiment with and grow your own navigational algorithm, let's go over a few helpful tricks.
Let's imagine a list of about twenty distance measurements:
[200, 210, 204, 3, 2, 7, 197, 221, 211, 1, 5, 5, 3, 205, 202]
How many obstacles do you think were found in this set of distance measurements?
Our GoPiGo's keep a list of 180 measurements, self.scan
, that corresponds to the servo's angle when taking measurements. Here's the starting code to count obstacles directly in front of the robot:
Let's try this out and see if it's accurate. Can you improve its accuracy?
Next, let's try to modify the method to get a 360 degree view of all the obstacles around our robot.
We've already experimented with self.wide_scan()
. We use that method to fill the self.scan
list with data. For example, self.scan[60]
is the distance found at the servo's 60 degree angle.
What's the distance at the midpoint of your robot?
We've also used the self.is_clear()
option to tell whether or not the space right in front of the robot is clear. Create a loop that keeps turning the robot until it's clear.
I can compose a higher-ordered algorithm.
I can update code on my Raspberry Pi.
I can make short, descriptive commit messages.
Your GitHub repo will be regularly reviewed.
You will demonstrate your capacity to control your robot.
You will be asked regular comprehension questions about Python and deployment.
Use the git: clone command and paste your GitHub url. You should now see your code on your editor. Explore student.py
and teacher.py
.
Remove the Piggy
folder if it's already there: rm -rf Piggy
Now we'll clone your project on the robot too with git clone https://github.com/YOURUSERNAME/Piggy
Change to your project folder: cd Piggy
Run the app: python3 student.py
You you make changes to your app and want to update the code on your robot, we first need to send the code from our computers to GitHub.
Now we'll remote control our robots using SSH. We'll use Linux commands to pull the updated code down from GitHub.
Make sure you're in the right folder: cd Piggy
Pull your updated code: git pull origin master
Run your app: python3 student.py
If it doesn't run, study the error.
We'll need to configure your class variables.
Sometimes one motor will perform faster than the other, giving the robot a noticeable veer. We can try to correct for this drift by adjusting the motor power.
Check out what commands are available from the API that's provided for you. These are the commands you're inheriting.
Your dance
method should read as close to regular English as possible. The nitty-gritty commands are all kept in the particular methods being called in your dance
algorithm. So your dance
method should just call a handful of moves. Within those moves, you'll use the specific motor commands below and get into the nitty-gritty of robot control.
deg_fwd(angle)
- how many degrees do you want your wheels to rotate? You need to pass the angle
turn_to_deg(angle)
- rotates to the given angle as calculated by the piggy's gyroscope
turn_by_deg(angle)
- turns relative to it's current heading. Positive values rotate right and negative rotate left
fwd
- powers on your robot to drive forward. You'll need to use self.stop()
to power off the motors
right
- by default, self.right()
will give the left motor 90% power and the right 0% which rotates right. You can use kwargs to adjust the power such as self.right(primary=90, counter=-90)
, which will spin the robot in place
left
- same as right but reversed.
back
- same as fwd but in reverse.
servo
- moves the servo (plugged into servo1) to the given value (use 1000 - 2000)
stop
- sets motor power to zero
read_distance
- returns the distance from the distance sensor (plugged into I2C port) in millimeters
get_heading
- returns the gyroscope's value
We're going to take a tour of Python. You are expected to know generally what these things are, you're not yet expected to know how to use them. So no freaking out. We'll play around with some fun projects after a quick look around.
I can make a hello world app in Python.
I can differentiate between compile-time, run-time, and logic errors.
I can describe the basic constructs of programming languages such as variables, conditionals, loops, and flow control.
You will be answering comprehension questions about the layers supporting software execution.
You will be creating and submitting your first Python app using trinket.io
Let's go to trinket.io and build some simple stuff, starting with print("Hello, world")
We'll go over each of these concepts in greater detail. For now, let's skim over all the big topics.
The first thing we'll tinker with is declaring variables and storing information. Variables in Python are dynamically typed, meaning you can store one type of information in a variable and then switch it without any fuss. Other languages are more strict and don't allow such shenanigans.
We use math symbols for most common operations. But Python has some cool operators. Read!
Now we're switching from declarations and operations to control flow. Now we can direct the computer's train of thought (aka its thread).
This is how we repeat commands and iterate through a list or collection of items. Imagine you're using your hand to flip through posters at Walmart. Your hand selects each poster as it traverses the collection. That makes your hand the iterator as it is connecting with each object in the collection during the loop.
A function is a set of commands you can call. When activating this "magic spell" you can pass it parameters or ingredients.
This concept is pretty advanced. It's here as a reference point because exposure to these ideas is good (so long as you know that it's not something you need to master quite yet).
A class is how you can create your own objects. You can make an class serve as a single worker like a static library of mathematical operations or you can design your own object, like a Spaceship that can be spawned or instantiated into a game many times. It'll have its own instance variables like health and shield properties.
I can explain why I can't directly edit the HTML of my WordPress website.
I can learn-by-doing WordPress.
You will be evaluated using a Trello rubric as explained in the video below.
We expect a lot from websites. We should be able to login, reset passwords, easily manage colors, change themes and a lot more. Until now, we've just built a static HTML page. It's fun to build but most of our clients will need more from their company's site. So we'll turn to the most popular framework.
Rendering is how references to data like usernames and profile images get loaded in and all the code turns into something cool
WordPress is extensible. That's good. It means you can add your own upgrades to it called plugins. These expansion packs can add all sorts of features. But they can also add bugs and holes in your security. So shop wisely. Check that the plugin is upgraded often and be sure to run your website's upgrades.
Students sometimes struggle making the transition from static HTML pages to WordPress. You want to just pull up the HTML code and make the changes you want to make. It's not so simple with WordPress. Give it time and study how WordPress works.
Every theme uses its own set of plugins and settings. They'll vary a lot. Themes also come with demo content. These example pages can be really handy. Instead of starting a page from scratch, edit and rearrange the example pages instead.
Make sure your theme is also receiving regular updates. The WordPress framework is growing. If your theme isn't growing with it, you'll be doing a full redesign sooner than you may like.
Your theme will likely require some plugins to be installed. As soon as you activate the plugin, you'll be given instructions to follow. Before you do these steps, you should check the recommended instructions from the theme's documentation.
Inside the .zip file downloaded from ThemeForest.net will be an HTML file explaining how your theme works. Make sure you can access this. It'll be something you need to check back on frequently.
Every premium theme I've ever used comes with demo content, though the process to load such varies often. Your theme's documentation will explain the steps required to load your theme's example pages. It's much easier to edit existing pages than starting from scratch.
Talk with your team. How many pages does your site need? Some sites we've seen are all on one page. Do you want to build a one-pager? If not, what pages will you have and how will they be labeled?
Look at your pages on the backend of WordPress. Your demo content should have created example pages for you to use. Duplicate some of those if you need. Rename the title and the slug to fit your purposes.
We'll use allthefreestock.com to build some initial free images. First save these to your team's Google Drive folder. Then check all the images' filesizes. You want to make sure each image is under 2 MB. Once they're resized, upload them to your WordPress's media.
Create a page called Branding. This is a guide for your client. It'll show your client's color palette, font selections, logos, and other design elements that you plan to reuse and would like to have easy access to. This branding page should not be linked anywhere on your site. Your client would have to enter the address in manually. You'll keep updating this page as you go.
Plugins can open serious gaps in your site's security. We only add highly ranked, recently updated plugins. We also make sure that the plugins are kept updated.
Look through each and every one of the options that your theme provides. Most themes in WordPress keep their settings on a separate page. Some, however, put some or all of their option menus in the Customize view.
Install, activate and configure a WordPress plugin that allows you to access Google Fonts. We could manually control these options through CSS, including the connection to Google fonts. However, that's harder for our client to maintain.
Visit the and fork it
Open and press CTRL + SHIFT + P
Use SSH (on Mac) or (on Windows) to connect to your robot
If the servo wasn't mounted perfectly, the midpoint won't be 1500
. But that's rarely the case. We should adjust this to fit your particular robot.
WordPress has gone through many phases where new features were a strong focus. Stuff like Twitter feeds, small login windows, and other utilities are often called widgets. I remember when new plugins were blowing up because they let people add widgets easily on regular pages, not just the Sidebar where you might to be found. Don't stress about it. Find some YouTube tutorials. Google it and read around. Ask questions. We'll figure this out.
Buying a premium theme is worth it. You give your client a license for the layout being used, you get (very basic) technical support, and the plugins, options and tools that come with the theme are typically of better quality. But as we browse for themes on , we'll have to be looking not just for a visual elements that will be helpful for our client but also for features we'll need.
Bootstrap is optional but preferred. Visual Composer or another design framework has always been a must. By the time you're reading this, the new WordPress editors may have developed enough that there are more reusable elements to use with these editors. For now, I'd only buy a theme with Visual Composer/ (or something very similar and well-reviewed).
There's a critical plugin every WordPress should have called Akismet. You'll need to activate the plugin and configure it with a free account for your client.
Here's a great .
I can connect to my Raspberry Pi via SSH.
I can deploy an app to a Raspberry Pi.
You will submit a link to your GitHub repo.
You will demonstrate your capacity to control your robot.
You will be asked regular comprehension questions about Raspberry Pis.
This is a PCB with all the basic components found in a personal computer (PC)
I'll help you remote control (SSH) your robot.
sudo apt-get update
sudo apt-get upgrade
Ready to shut down? sudo shutdown now
Now that we've left the fun environment of Trinket.io, let's first build a practice project.
Now let's go to VS Code and clone your forked repo.
The URL we need is: https://github.com/YOUR-USERNAME/TurtleChase
Now let's add some new features together:
Add a button to change each player's color
Prevent players from traveling off the screen
Detect collision of players
Wire up some other SuperTurtle methods...?
Now let's commit and push our code.