Tip:
Highlight text to annotate it
X
Hello again, Rowland O' Flaherty here. Robotics Ph.D Candidate at Georgia Tech.
Up until now, if you've been following along with the hardware aspect of the
course. You have built the QuickBot and programmed
it using the MatLab simulator, Sam I Am, that JP showed you
how to use. And the knowledge you have learned from
their lectures. That Doctor Egerstedt has been showing
you. However, in doing this, the low level,
physical computing of the robot has been abstracted away from
you. What I
mean is, that you didn't have to write code
to interface with the sensors or send motor commands.
I think it's important for anybody who wants to be a proficient roboticist.
That they not only understand the theory behind the algorithms that they're using
to put on their robots, but also the low level
aspects that make the entire system work. So in the next three lectures,
I'll give an introduction to Physical Computing, using BeagleBone
Black since you've already purchased that for the QuickBot.
This will allow you to use your BeagleBone Black
for other projects and applications that go beyond this course.
So, let's get started. BeagleBone Black is a microcomputer and
you'll need either a microcomputer or a microcontroller to do
physical computing. So, the Arduino
is a microcontroller and the difference is on a micro controller, all the components
that you need to do the processing or the computing, are located on one chip.
And on the Arduino, those are located on the Atmega chip.
But the BeagleBone Black, however, has its components spread out.
So we have the microprocessor, memory, storage and we have, GPIO pins or
general purpose input output pins. And this is actually what makes the
BeagleBone Black, special from a regular computer is that programmatically,
you can control what these pins do. The processor is here on the BeagleBone
Black. And that is a one gigahertz on processor.
We also have 512 megabytes of RAM. We have two gigabytes of storage.
We an Ethernet port to connect to the internet or a network.
We have USB to connect say, a mouse or a keyboard.
We have a microHDMI, to connect the monitor.
And what this means is that you can actually use your BeagleBone Black as a
full-fledged computer. You can connect a USB mouse and keyboard
to it, a monitor, boot it up and interface
with it just like you would any other computer.
Now, it's running a full fledged operating system, a distribution of Linux.
And that might not be what you're normally used to but it's pretty
similar to your common operating system such as Windows or Mac OS X.
Also, BeagleBone Black is designed to be small and low power.
It actually fits in an Altoids container. I have one here to show you.
Just plop it in there and so you can actually use this as a case.
So what I would like to show you today is how to get started with your BeagleBone
Black. How do you actually write code for it?
So the first thing you're going to have to do is
take the USB cable that came with your BeagleBone Black.
Plug it into the board and plug it into your computer and wait about 20 or 30
seconds. This will allow the BeagleBone Black to
boot up. Then, what you'll need to do is enter this
address into any common browser. So this, what this will do, is navigate to
this page here. So, the BeagleBone Black is designed to
run a couple of servers on it. One of them is this Cloud9 IDE.
IDE stands for integrated development environment.
Usually, what you'll use an IDE for is to, program, so edit some code and debug it
in the same application and run your code. Common IDE are uh,Xcode or
Visual Studio or MatLab's actually an IDE. So Cloud9 is an IDE that runs online
and the BeagleBone Black actually runs a Cloud9 server.
So what this means is, that the code you write in this Cloud9 IDE
is actually right on the board and you can run it right from the IDE.
So, this is different from say, an Arduino, because
an Arduino you'll write code on your computer and upload
it to the board and then run it. If you have any problems, you usually put
some print out, print statements to print so you can figure out
to debug your code. Here, because it's running right on the
board, you can actually debug the same way you would if you were doing the
C, C++ or even MatLab. So let's go ahead and, let me show you how
this Cloud9 works. So, this is what you should see right when
you, enter this URL into your browser. So, let's close this.
So, in the Cloud9 IDE you have here your project files are
actually on the board, so you have folders and files that are saved on the board.
And this section is where you'll write your code.
This is your editor. Down in this section is your Console,
where you'll get your output. And then when you're ready to run your
code, you actually just press this button here.
So let me demonstrate this. Let's create a new folder say.
Right-click on Cloud9 >New Folder, lets call it Working.
And let's create a new file. We can go up here to File >New from
Template> JavaScript. So the code that runs on the BeagleBone
Black that the Cloud9 IDE uses is a type of JavaScript
called Bone scripting. And, so lets create a new BoneScript,
console.log, Hello world. [NOISE]
semi-colon there, let's go ahead and save this.
Put it in working, call it, hello world, save.
Now, let's run this code. You'll see that Hello World is outputted
right to the console here. So this is not, run on your computer.
This is actually run on the board and outputted
through its browser or through your browser to this output.
Also, there are some pre-loaded demos that come with it.
So, lets click on one of these, say blinkled.
Let me go through this code real quick, to demonstrate what
it's doing. So first we have to create a BoneScript
object, [UNKNOWN]. So that object contains all the methods
and properties you need to interface with your
BeagleBone Black. Then, we're going to set some variables
here that tell us what pins an LED might be on.
So there's an L, so there's four, actually there's quite a few LEDs on the board.
But there's I think four of them that you can control.
And those are these four right here right by the USB
connector and the one all the way next to the Ethernet is called USR 3.
So, let's set this variable to this value and we're going to
tell it, the BeagleBone Black that this is going to be an output.
We are going to first have a variable that saves the state
of the, of the LED, so we'll just set it to low.
And then we'll write that state and then we'll do
that ever second by using this command set interval, every
second or one thousand milliseconds, it's going to run this function toggle.
And in this function, it's going to toggle the state
from low to high or li, high to low. And so let's see what happens when we run
this. So now, it's running on the board.
And what you can see is that this LED, closest
to the Ethernet port is blinking at once per second.
So the blink is common first thing you do with microcontrollers or microcomputers.
So that's all we're going to cover today. And then next time, next time I am going
to show you how to actually do some digital writes and
digital reads, analog writes, analog reads with
[INAUDIBLE].