Tuesday, June 9, 2015

Transcript - Hands-On Robotics

Class: Informatics, Computing, and the Future
Instructor: Dan Berleant
Transcriber: Brooke Yu
Date: Thursday, April 11, 2013

Professor:  Okay, so we'll talk about those in a minute.  First I just want to go over where we are in the course.  We're getting to the end of the semester, so today we're going to start on our robotics unit.  That's what those things are. 

Many people signed up for presentations, so we're down to 15 minutes per presentation. 

Can we interrupt you?  For the VMware, we have mark here

If any of you are getting knocked off and have to log back in, if I could get a screenshot of the error, send it to me. 

We really wanted to fix it tomorrow. 

Send it to mhpace@ualr.edu

I'll put it on the board. 

It's mhpace@ualr.edu. 

Female Student:  It has been kicking me off today, but no error message. 

Yeah, some people get it and I need to see the message. 

Thank you! 

Professor:  They're not going to be logging in to use these things.  They'll be using the local machine. 

Male Student:  I'll just keep VMware open. 

Alright, thank you! 

Male Student:  I noticed earlier too it seemed like other computers doing it.  It's not just VMware. 

Okay, thank you. 

Professor:  Okay, so sign up for presentations if you haven't yet.  If you have, your name should be here.  What else?  There's a homework due next Tuesday, then there will be one more homework, and a last homework which is a test, but it counts like a homework. 

The test is really for our accreditation for the course.  So take it seriously, and that will be the last assignment for the course.  Then we have presentations. 

So we're sort of in the home stretch.  Any questions about the project or anything?  Test?  Anything?  No?  We won't meet for the final unless you have to make up assignments. 

Okay, so let's talk about robots. 

I'm going to show you stuff, but instead of me for just standing up here, I'd like everyone to get their own robot.  So just come up and get one.  You can pick it up by the handle, or just grab it.  They're all charged.  I've been charging them all morning. 

Male Student:  It can't talk, can it? 

Professor:  Haha, no.  Well, one year I found a sudent who found a speech interface for it.  Anyway, these this looks sort of like a rhumba.  And it's made by the same company.  So I like to say it's similar, but it doesn't have a vacuum.  It just rolls around.   And you can program this one. 

So let's look at the parts.  First, it has a handle so you can pick it up.  It has an omnidirectional IR receiver.  What is omnidirectional?  All directions.  What does IR stand for?  Infrared.  Does anyone know what that means? 

You know, there's the colors.   Like the rainbow goes from red up to blue in a layer.  This is the frequency of the light- how fast the light waves are going.  Past blue, what's that? 

Male Student:  Yellow? 

Professor:  Yellow, I think is here

Male Student:  Orange? 

Professor:  Right between yellow and red. 

Male Student:  White? 

Professor:  That's the combination of all colors. 

Professor:  Do you ever hear the term black light?  That's the same as ultra violet.   It really is light, but you can't see it. 

So what's under ultraviolet?  Violet, which is purple light.  You have blue color receptors in your eyes, but no violet color receptors.  It looks that way because it starts activating the red receptors.  It activates both blue and red receptors at the same time.  Ultra means beyond, so infra means below, so infrared means below red

So these robots, if you look at this thing on the front, it has a clear plastic layer undue rathe disk.  That clear plastic is a way that this thing receives and transmits infrared light. 
It communicates by infrared light. 

And notice it's clear plastic all around- well, thats' because it's omnidirectional.  It doesn't transmit, it just receives.  That why it has a periscope in the front so it can communicate with things like the charging base. 

If you'll notice the charging base has a similar circular clear plastic thing.  This is a transmitter.   The robot can sense it and the robot and come and dock and get charged. 

In fact, I'll show you.  

Plug it in. 

You might want to stand up, or come around here and see how it works

Might as well, otherwise I'll just have to tell you. 

Male Student:  These are the same ones we used in the ethics class. 

Professor:  Yeah.  Alright.  It's trying to dock, and this thing is emitting infrared light and it's trying to adjust its path so it can dock.  Now it's charging.  You can see the charging light is on and it's able to dock because of that omnidirectional IR receiver. 

Alright.  So it also has a cargo bay.  Why do you want a cargo bay?  People do all kinds of research with these robots and people have done things like build structures into the bay that have a hand or something that can grab a beer out of the fridge.  Plus it's not a vacuum cleaner, so they have extra space

Inside it has a cargo bay connector.  See that?  It's so you can connect this to a computer that sends arbitrary C code to control what the robot does.  If you don't want a wire connected to it, you can set up a radio transmitter.  So you can use this to do arbitrary complex programs like taking the beer out of the fridge

Or it can be set up to water tomato plants in a lab.  You can still program it to 100 bytes.  We'll do that maybe next time. 

Cargo bay connector- charging socket.  It's right on the side.  See if you can find it. 

So I showed you how it docks.  Does everyone see it?  It has a lightning thing.  If you don't have a docking device, this charger is what gives it the juice, and you can plug it right into the thing. 

Look at the green light.  When I plug it in, it turns red and pulses.  When it's fully charged, this light will turn green again. 

You can also plug it into the charger docking station and then it'll be docked that way. 

Okay, if you look above the charging socket, there's something cayley death serial port.  Here's the charging port, and above it is the serial port.  We're going to plug this into the computer to send programming commands.  Did everyone find the serial port?  If you look at the serial port, you can see how you can only plug the cable in one kind of orientation.  It's easy to bend these pins.  It's not really made for school use, so when I give you pins, don't force them in the wrong way. 

Avoid bending pins.  But I haven't given you the cables yet, so you'll see that later. 

The trick is to align the arrows.  The cables have an arrow on them, and you want to align them so you know you won't bend them.  Does anyone have a cover over the serial port?  When they come new they're covered.  I took them off though for today. 

Okay, now I'm going to hand out some cables and you can plug the cables in.  Before I do that, I want to show you how to do it. 

Okay, so here is the robot.  And here's the serial port.  There's a cable that plugs in.  Notice that the cable has an arrow on it.  So you can twist it so that the arrow is facing the right way- it should be facing out so you can see it.  Then you know you're plugging it in the right way.   Does that make sense?  You want the arrow to be sort of facing outward from the robot and then it'll plug in properly.  Let me go ahead and pass these out. 

So take your time plugging them in.  It's really the one thing people are most likely to break on these- the cable.  So really try to be careful. 

Make sure you see the arrow before you try to plug it in. 

Alright.  Is it going okay?  Any questions? 

The next step is to plug the other end of the cable which is a rectangular shape into your computer.  The computers have right over on the left side over here is the socket for that. 

So you got a cable that's marked fragile.  But you have it all set right. 

Okay.  Everybody all set?  Any questions?  Well, let's continue our process here.  If you'll notice, it has three buttons on the robot.  One has a symbol that looks like this [On board.]  

Someone already pressed their power button. 

That's the power button.  Does anyone know why it has this symbol? 

Male Student:  Isn't it like input/output/ 

Professor:  Yeah, it's the 1 0 kind of thing.  For computers, that means on and off.  This is the standard symbol for a power switch. 

Oh, I see.  It's per IEEE standard 1621.  It'll make a beep.  Go ahead and press it.  And the light turns on.  It should be a green light. 

If it's amber, your batter is only partially charged.  If it's red it really needs charging.  If it doesn't come on, it's dead how many have green? 

Anybody have amber or anything else? 

I charged them earlier. 

Good what else?  The power button has LEDs in it.  Who knows what that stand for? 

Male Student:  Light emitting diode. 

Professor:  Right.  That's where lightbulbs are going too.  We talked about how lightbulbs will all be LED soon.  The power button has a red one and a green one in there.  If the green one is on it's charged.  If it's not charged, it lights up the red one instead.  Or if it's partially charged they both light up.  It also has some other buttons.  It has a play button. 

That's the arrow in the middle, and it has an LED associated with it. 

So you can just try... if you press it, your robot will move.  Don't press it yet.  It has an advance button.   You've seen these before. 

So there's a bunch of demos. 

We're going to go outside for this.  You have to unplug them.  Bring them out here and I'll demonstrate. 

Professor:  So how many people found out what the music playing demos were?  It has some cool motion abilities too. 

Okay.  Any questions so far?  Comments? 

Alright.  So I showed you the home base here where it can dock for recharging.  If you look under the robot by the front wheel, it has these two shiny pads.  That matches up with the contacts on the home base so it can charge.  Does everyone see those pads there?  Metal is expensive.  More expensive than plastic.  So why not change money by making those contact pads out of plastic? 

Male Student:  Doesn't conduct electricity. 

Professor:  Right.  I saw someone noticed that it wouldn't fall down the stairs.  I hope you were there to catch it.  The reason is because it has cliff sensors so it won't fall off of tables or down stairs.  If you look at it, it has rectangular holes by the pads.  Those are cliff sensors. 

So my question is- are these spring loaded feelers or are they electronic? 

Male Student:  I imagine they're electronic. 

Professor:  Okay, how could you tell? 

Male Student:  Spring? 

Professor:  Yeah, you know, like springy things that fall down to detect? 

Male Student:  I see wires.  No springs. 

Professor:  Okay.  If you shake it, you don't see any springs dropping down.  So yeah, they're electronic cliff sensors. 

Turn it upside down.  We'll look at the batter.  It's similar to a batter for your computer or something.  It's called- everyone see it?  Take out the batter.  You press on the ends.  There's little finger holes and you can lift the battery out.  To put it back in, drop it into place and press on both ends and make sure you hear two clicks. 

You should hear two clicks and you're good to go. 

Okay, our next step is to send commands to the robot to make it do things go ahead and plug the cable back in, being careful that the arrow is straight out so it won't break.  Remember, the arrow faces out. 

And everyone got that connected?  If you go to your computer- you don't have to log in.  It's on the local machine.   You don't have to log in.  

So if you go to your computer, there's a program called real term.  It comes up with a black window. 

You can download real term at home.  I don't know if we have it on this machine.  Probably not. 

How many people found it?  Oh, you got it.  There are people running it.  Anyone not have it yet? 

Okay.  Are you already sending commands? 

Male Student:  I learned how to do it in ethics class. 

Professor:  Right!  Okay.  So there's a bunch of tabs.  Click the "Send" tab because we want to send commands. 

So click the send tab. 

In the window, there's a little window.... I don't have a picture.  There's a type in window for sending commands.  What does it say- it says "send numbers."  So you'll want to send two numbers.  128 space 132.  Type them, but don't click send yet.  Then power cycle your robot tget to the initial state.  Turn it off then turn it on. 

When you send the numbers, watch the power light.  It should go off. 

So give it a try.  When you send those numbers, the power LED should turn off. 

Okay.  Raise your hand if you're running into problems. 

128 132. 

On the same line. 

128 132. 

Click send. 

And it turned off. 

If you want to try again, you can

Okay, what's going on here is that these are programs in the programming language.  128 is the start command.  It tells it to get ready to accept software 132 gives you control over the robot.  If you say go forward, it'll go forward over the edge of the table.  So you have to use your power carefully. 

Okay.  Let's try something else.  Try this command here.  It's three commands with three arguments.  Try sending this command and watch what happens. 

Someone tell me what happens. 

Male Student:  The play button turns green. 

Professor:  Okay, so it should turn on the middle light and everything else should be off.  The 139 command is a light controlling command.  2 0 0 are three arguments.  Okay.  The first argument is the one that controls the light that just turned on.  If you... let's see how to say that.  If you give it an 8 instead of 2, it'll light up differently. 

Male Student:  The forward button turns on. 

Professor:  Right.  So 2 makes one button turn on.  There's one bit that stands for the 2, the third bit stands for 8.  But the cool thing- if you use 10 instead of 8, 10 is 2 + 8 and that's like sending both 2 and 8 at the same time, so it'll light up both lights.  I see some of you are ahead of me. 

That's good. 

Alright.  That's just the first argument. 

Tuns out that the first argument is for two of the lights and the second two are all for one light. 

So we've lit up the play and advance light.  Let's play with the power light, which can be red, green, and amber.  That's why you need two arguments for that one. 

It turns out that one of the arguments- there's three arguments.  Here's three arguments.  0, 0, 255.   First argument, we already played with.  The second is for power, and the third is for brightness.  So try this one- the mouse is pointing to.  This line of commands.  That will turn on the light at maximum brightness- 255 is the max brightness. 

And it'll light up with color 0.  So find out what color 0 is in the second argument. 

Male Student:  Green. 

Professor:  Okay, so everyone gets green.  So if you change it, you should be able to make it change color. 

If you want to have red and green at the same time, or something between red and green- it'll look like yellow.  So if you turn them on at the same time, you should get a yellow light.  Or something that's reddish or greenish.  [On screen.]  The question is what value between 0 and 255 gives you a pure yellow light- not orangey or greenish yellow.  Experiment with it and find the number that gives you a great yellow light. 

Raise your hand if you have questions and I'll stop by. 

Is it going okay? 

You want to use that exact line of code which I had on the board. 

This line right here. 
Type those 6 numbers in. 

Okay, now send the commands.  Did you send it?  No, no.  Click here.  Okay, now change that second 0... type 255. 

 Then another space and another 255. 

Okay, anyone get yellow yet? 



Male Student:  Is this yellow? 

Professor:  That's pretty good.  I claim that red and green make yellow.  You should see a little red and green light in the button.  When you back off, it should look yellow.  You see it? 

There's a red and green in there.  There's nothing yellow in there at all. 

Okay.  What number gives you a pretty good yellow? 

Male Student:  10

Professor:  Anyone get another number? 

Male Student:  13

Professor:  You'd think it would be 128 or 127.  I don't know why, but one LED gets brighter quicker, so to get a good balance, it's more like a very low number like 10 or 20. 

Okay.  Any questions? 

Alright, let's move right along. 

Another command is for the sensors.  The command 142 is for reading sensors.  142 has an argument- 1 argument, they put in the 9.  But it can have many arguments.  9 is the left cliff sensor.  If you do number 9, that's the left cliff sensor.  It'll return the result of reading that sensor in the black window when you send it. 

The cliff sensor has not been activated.  If you lift the left side of the robot and resend this command, it'll resend a 1 instead of 0 since you activated the sensor. 

Male Student:  For a while it kept saying null. 

Professor:  Maybe your hand was under the cliff sensor. 

Male Student:  Maybe.  Is everyone getting the NUL or the SOl?  Okay. 

So let's see.  Oh, maybe it's SOH, not SOL. 

If you want to see how many sensors there are, send a 6 instead of a 9.  Then you can count the returns to see how many sensors it has. 



Male Student:  Quite a few. 

Professor:  Yeah, your screen is filling up with junk- that means you're reading all the sensors. 

Any other questions about this?

Male Student:  Is it okay if I leave early?  There's an event that's happening at 5:30. 

Professor:  Okay.  For those who are had this exercise before, this is new.  So new command.  Command 158 is wait for an event and don't do anything until afterwards.  And then which event you wait for- 5 is a bump on the bumper.  There's a bunch of them.  You could do a wheel drop or whatever.  You know after this command, then you put the light changing command and it won't do it until you hit the bumper

We'll do more with that in a little bit. 

So let's talk about the music capabilities of the robot

As usual, you want to send these commands to get the start command.  Then you can load a song.  Here's a song, so comamnd 140 says load a song, then it has arugments for how the song goes

140 is load, 141 is play.  So you have to initialize with the 128 132.  So try loading, then try playing.  

Someone got it. 

Professor:  Let me tell you a little about what's going on here.  It's a complicated set of numbers to describe the song. 

140 is the command that says define a song.  You can define several songs.  Each has a name, and the number of this song is 0.  You can play song 1 or 2, but we're labeling it 0.  4 says how many notes in the song.  It has four notes.  What are the four notes?  Note 1, note 2, note 3, note 4 [On board.]  

Let's look at note 1.  The 12 is 12 64ths of a second, the 68 is the frequency.  So that's three 16ths of a second, and 68 is a standard number for describing frequency.  So remember the song went.... it was 74, so that means it was a little longer.  So you can control the frequency and you can control the length of each note and you can even control.... sorry, I made a big mistake. 

This is the note, this is the length of the note.  Frequency, length, frequency, length.  And you can even control the number notes. 

Make it a 3 and have it shorter.   Just make this work and see if you can get another song.  So this is a composing class today for a few minutes. 

Female Student:  Mine won't either.  It'll turn off every time. 

Okay. 

Alright, type in 141 on the next line.  Down a line.  Down a line.  Go down.  Move the cursor to the next. 

141 0 now try sending that second line. 

Okay.  So the 140 loads, 141 plays. 
Alright? 

Now you can mess with these numbers to change the parameters of the notes. 

So you two things you could try.  Be creative and try to come up with a cool song, add notes, find the lowest note that will play, or the highest.  Oddly enough, if you get the frequency too high, older people like me won't be able to hear it but younger people probably will.  Has anyone heard about ringtones for your cell phone that are super high frequency and teachers and adults can't hear it but you can?  If you did it in class I wouldn't be able to hear it.  We have ten minutes left.  I don't want to go onto something new. 

So come up with a better tune- more notes, higher notes, lower notes.  In about 7 minutes we'll have a concert and each person can play their tune.  We'll have a recital. 

He said you can just change the numbers around to experiemnt with the sounds. 

So our concert is schedule for about 6 or 7 minutes from now.  In the meantime, you can practice your piece. 

Professor:  So this is a pretty lousy computer language for programming, but that's how they do it.  So let's have our concert. 

Alright.  Everybody ready? 

Okay.  Hold your horses.  We'll take turns. 

Okay, you programmed a whole bunch of notes. 

Professor:  Okay.  Alright. 

Female Student:  Mine's not working.   This is all I have. 

Professor:  Okay. 

You guys. 

Okay. 


Alright, well, we're not talking about mozart here, but you can do it.  You can do some pretty cool things.  Next time we'll pick up here and go with motion stuff.  Turn off your robots and put them back on the cart.  We'll do more next time.  

No comments:

Post a Comment