Programming Throwdown - Robotics
Episode Date: July 22, 2016This show is an intro to robotics. Blog post: http://www.programmingthrowdown.com/2016/07/episode-56-robotics.html ★ Support this podcast on Patreon ★ ...
Transcript
Discussion (0)
programming throwdown episode 56 robotics take it away jason hey everybody so uh I have a new microphone super excited about that
You sound amazing
Thank you
There was a Reddit thread
It said what programming podcast
do you like on Learn Programming
I think subreddit
and a bunch of people said Programming Throwdown
which is awesome, thank you guys so much
and of course
you know, we had to look at all the comments.
And like any like anyone, your brain goes like straight to the negative comments and you kind of read those.
And a bunch of people said, oh, Patrick sounds pretty good. But Jason sounds like he got his microphone in a garage sale, which I did.
So I actually did literally had my microphone from a thrift shop.
So I bought a new microphone.
I followed Patrick's advice and got the same microphone as he did.
And I'm really excited, really happy to have some new equipment.
I even got a pop filter.
So look out.
Oh, wait.
Now you've surpassed me.
Oh, I thought you had a pop filter.
No.
Okay.
Look out.
Now it's like, what's that called?
Yeah, keep up with the Joneses.
The next thing we need to do is get those anechoic panels that we wrap around when we record
so we don't get echoes and like room noise.
And then we'll be professionals.
Yeah, yeah, totally.
That's the next step.
Is that those like corrugated gray foam things?
They have like little pyramids on them?
Yeah, right, right.
Yeah.
I think they're called anechoic.
Hey, sounds good to me.
Sounds awesome.
So on to news.
So yeah, this is pretty cool.
I would have put it as my tool of the show, but I haven't used it yet.
It's still also a bit early, but I think it's a great idea.
It's called MARP, Markdown Precision Writer. And the idea is it's this desktop app you download,
and then you start writing Markdown, and it converts your Markdown into a PowerPoint
presentation. And the reason why that is really cool is the PowerPoint presentation can be
packaged as like a website. And in the markdown, you can have HTML. So in other words, like you
could have a presentation where in the presentation are some charts that are dynamically generated.
Like the presentation could make a web request to, you know, your server and pull back some charts.
I mean, in a way that's kind of bad because the data could change and not represent what you wanted.
But I mean, that's maybe not the best example, but you could have a link to Google Maps and you actually have the Google Maps, you know, iframe and it's interactive.
And so it's pretty cool.
You know, I'm gonna try it out. I've always been looking for a better, you
know, presentation software. It's kind of more lightweight and things like that.
I'm that guy who just has all my presentations are just white background
black text. So yeah, I'm gonna try this out and if it's good I might
double dip and make it my tool of the show in the future.
That's cheating.
That's what we do.
We cheat.
Also, I would hope there's a compiling step or whatever where it generates the PowerPoint
and then it kind of freezes your data at that step.
No?
Oh, well, I think, I mean, you could definitely do that.
What you would do in that case is, like, you would have, like, you would probably just take a screenshot of your data.
You know what I mean?
Or something like that.
But it can generate this kind of website or it can export to PDF, which is about as good as you can get.
I mean, exporting to, like, PowerPoint would be really hard.
So I don't expect that's going to happen anytime soon.
But a PDF is pretty good.
Okay.
Well, go try it out and report back.
That's right.
The next story I have was making its rounds.
The Apollo guidance computer source code was posted to GitHub.
Apparently, this has actually been out in the public several times before.
I've never seen it before but this is some of the code written to control um the apollo mission
for the guidance system and it was written in a custom assembly that they made but the most
interesting things i guess are noticed the comments in the code that people wrote and
probably assumed would not be
written or at least would not be written what is that uh 50 years later yeah 51 years later so
things like temporary I hope I hope I hope like I hope that someone deletes this code one day
yeah no and there's just you know other kind of silly comments and quotes. And I guess things at the time maybe even weren't that significant.
But later, reading back, it's kind of interesting to see what people chose.
I guess if you were an author, people would look at this and say, what did they mean here?
This is an allegory for what?
But it was probably the person just being goofy when they wrote it.
Yeah, totally. it's interesting i'm sorry what is the weirdest piece of code you've ever seen or
like funniest or i mean we've both worked at big companies which have giant code bases and
sometimes you're just diving through the code you see something completely bizarre
i mean i think the only one and i i've probably talked about it before, is the first time I came across it, some bit of code that had a big comment and said, voodoo black magic starts here.
Do not alter unless you want everything to crash.
That's awesome.
But other than that, I haven't know why, but return one here.
And the next line was return zero.
What?
Yeah.
I fussed at someone the other day.
I read a comment.
No, no, it was like a log statement.
And I was like, oh, this is not correct.
You know, your code's not doing the right thing. But in my mind, I like had saw the And I was like, oh, this is not correct. Your code's not doing the right thing.
But in my mind, I saw the log comment was wrong
and I never bothered to actually read
what the code was doing.
I just assumed the code was wrong as well.
But actually the code was correct
and they just like copy and paste,
errored the log comment.
And I was like, oops, should have read the code.
But it was fair, I guess, from my standpoint
that if you had the like why would
i keep reading if the comments aren't right yeah actually there's something that uh someone said to
me um that's really profound is is uh unless you're working on a project by yourself um any code you
write will be witnessed by at least twice as many people.
In other words, you're going to read it again one day,
and someone else was going to read it again one day, at least.
And so write code as if you expect it to be read many times. And I thought that was kind of like a profound statement.
A lot of people still don't follow that, though.
Yeah, no, I mean, we're all guilty of it at different times
so my news article is the microsoft r client um i haven't tried this it looks pretty cool
um basically uh it's a it's an r front end and uh it works with big data so um there's
uh various kind of like r operators that you can run on the data to do transformations, do dot product, do things like that.
But if you use this R library, let me see if I can find the name of the library.
But yeah, if you use this one library, then it'll actually run on the cloud.
So you could do a dot product of a billion-sized vector with another billion-sized vector,
and it'll just distribute everything.
Revo ScaleR?
That's what it is, yep.
The ScaleR technology and proprietary functions.
So the deal is the R client is open source.
The base R distribution client is open source. The base, like, you know, R distribution is obviously open source.
But then if you call any of these scalar functions that are owned by Microsoft, those are closed source.
So if there's a bug in one of those, you know, you have to go chase down someone at Microsoft.
But, yeah yeah it seems
pretty cool i mean there's a lot of people who use r a lot of statisticians and uh um the idea
that you know they could just kind of take what they've done and move it over to to big data is
kind of a cool idea i mean obviously you can't do the same things as you can do like you don't have
the full power that you do in r because um you don't have the same kind of data locality.
So if you're going to break the data up into chunks, each chunk can only see the data that it's assigned to, that is assigned to it.
So you can't do everything, but you can do a lot of things.
And yeah, I thought this was pretty cool.
I'm definitely going to be checking it out this week.
Pokemon Go. do a lot of things and uh yeah i thought this was pretty cool i'm definitely going to be checking it out this week pokemon go oh my gosh i'm sorry i just don't even like so i'll tell you my experience with it i uh i downloaded it um i fought the the you know test enemy i think i picked squirtle and i fought squirtle i defeated him
and so i have you know the like very first introductory pokemon um and that's it so i'm
totally lacking um i definitely want to get into it but uh i haven't done it yet but it is insanely
popular so you got a little bit further right no oh no so i kept telling
myself i'm gonna download it and try it out because i have fond memories of pokemon when i
when the original red and blue came out and i was i guess i don't remember how old i must have been
at the time but a little on the older side so as like a game boy so you're probably like
nine or something but as like a first rpg it was something that was very good for me, I guess.
Japanese RPGs weren't, or at least not among people I knew,
weren't a big deal at that time.
And so I really enjoyed it.
But then it wasn't really a cultural thing at that point.
It wasn't until later that the cartoon show and stuff started to
come out but by that time it was i was a little older and it was like more something my younger
brother and his friends were into so then i still play i wanted to still play the game but uh you
know i couldn't be into it and so now that i'm an adult right like you know whatever but but as a
kid i guess i made the decision not to be
quote unquote into it but i still do remember all the pokemon and i was always better at the game
than my brother because i was older uh nice but no i keep telling myself i was gonna download it
but then i got freaked out because i read some article that was saying that it uses your google
login and it the permissions it grants actually gives it access to like everything in your google
account not just like read email or read your email contacts or your email address but like And the permissions it grants actually gives it access to like everything in your Google account.
Not just like read email or read your email contacts or your email address, but like actually read all of your email.
And they're saying it's most likely that they're not using it.
But, you know, it could be a problem.
Yeah, they actually just pushed, they posted a news story saying that they fixed that.
Okay, so I will download it.
Yeah, I guess there's an issue where, like, once you ask for something, you can't ask for less.
Because that's kind of, like, giving the illusion that you weren't collecting it when you were.
But given that this is already more popular than Twitter, I think, like, Google made an exception.
And, like, Google like google engineers like worked something
out with them um but yeah that's so it's kind of gets to the article the article um is just
i just cannot believe how popular and it only came out what a week ago i think yeah and it's
just insanely popular like it's already more popular on twitter uh nintendo stock went up seven billion
dollars or something it's just insane um and uh the article specifically talks about the augmented
reality portion of it um so you didn't get to fight the first monster right no okay so so or
i guess the first pokemon but it it does this thing where it...
I don't even know how it works
because they don't have 3D vision or anything.
It must be based on passive movement.
They try to do some kind of stereo vision thing.
Isn't that structure from motion?
Yeah, yeah, that's right.
So it figures out...
Again, in our case, we were at an ice cream shop and uh my wife and i
were trying it out and um like squirtle like was just sitting on one of the benches in the ice
cream shop and actually recognized like in 3d sort of what that represented and he was just chilling
there and we just flicked a pokemon ball on them and caught them and it's just amazing
so yeah i definitely uh so so so the article talks about how amazing hug vintage reality is and how
it's the future and everything i believe it i think it's i think it's interesting that from
what i understand it's pretty similar technology wise to ingress the niantic Labs game but obviously this has far and away eclipsed anything
that Ingress
ever was
as far as the amount of people
the cultural awareness of it
yeah it started as
an April Fool's joke in Google Maps
the article
talks about this
and I don't even remember
exactly what the April Fool's...
I mean, I remember seeing it at the time.
There's some April Fool's joke that juxtaposed maps with Pokemon.
I don't know if it replaced all the buildings or gyms.
I don't know.
But it was insanely popular.
And then they realized that there's this huge you know a pokemon fan base that they could tap
into i will be downloading it i will be playing it i will probably show my kids how awesome it is
and they will think i'm an amazing person for being able to capture pokemon if we if you don't
see us if we don't have an episode next month you'll know why we're running around trying to
catch pokemon i saw articles devoted to selecting an external battery for your iphone because it drains so much
battery oh no i guess the gps i have no idea but it was just funny that everyone's trying to cash
in on the you know click baiting by putting pokemon go in your headline that's awesome um yeah so yeah next episode we will definitely we'll
definitely talk about it more as we would have hopefully played it by then book of the show
book this show my book of the show is the u.s puzzle championship 2016 which just happened
um you can go to this url if you uh if you click on the show notes and you can
download the puzzles uh for free uh the the contest is over so you can't you can't uh uh you can't
compete this year but uh um i did compete uh 2006 through 2010 and i wasn't like particularly
you know that good i think it was in like top 100 one year
but like I didn't get to go to the world championship or anything crazy like that
but it's super fun you don't have to be a programmer although you can actually use the
computer to kind of cheat in the actual contest they give you two and a half hours. And so you kind of have to sort of solve these logic puzzles by hand.
Because, I mean, I guess you could cheat.
You could write a bunch of scaffolding code in such a way where you could quickly churn out a program.
But as far as I know, nobody actually does that.
And if you did that and it went to the World Championship, they don't let you use a computer.
So that would be kind of weird but uh but you can actually use a computer to solve the puzzles
like brute force it or whatever it's kind of a fun exercise um you can also solve it yourself
by using various kinds like regression uh reductionist methods and things like that and
logic so what is an example question or what are the kinds of questions that they ask like sudoku puzzles
like uh no it's well yeah kind of so so you could think of it as you could think of sudoku as like
a logic puzzle um and so this is just sort of like an umbrella of which sudoku you know could
be one of the questions right sure um so they're basically variants on that theme so there's
there's some where uh you
have a bunch of different weights and you have a bunch of different scales and you have to make
all the scales balance uh but use all the weights for example right they're all they're all variations
of mp hard problems but but they're not like find an algorithm and then run it it's just like solve
an instance of the puzzle exactly okay so they give
you some rule set in an instance of a puzzle and then you're supposed to solve that instance of the
puzzle yeah exactly okay but they're not um they're not puzzles you would have seen before
right that's right um but yeah it's it's uh the thing about it is like you can't brute force it so you often have to find like
some tricks that like radically reduce the search space and uh and so if you have those tricks then
you could write the program pretty quickly but if you have the trick you don't need the program
um unless you have to solve like a thousand of these right um so that's really what it's all
about is like trying to understand the patterns
and try to understand like specifically like what things cannot happen so that you don't have to
think about those things and then once you've got it narrowed down then you just try all the
possibilities it's a lot of fun i mean i did it for a long time uh i wish i could say i was good
at it um i'm definitely better than like an average person but i'm not anywhere near as good as like these like world champions who are just crazy um that was a humble crazy in
a good way but but uh uh yes yeah but yeah it's true but anyway so so this is really fun you guys
should definitely try it out um they uh they also have solutions um so you can make sure
you're on the right track and things like that
so definitely check it out
sounds like homework
yeah that's
I'm trying to figure
out like
I think the reason why
it's fun is it's like Sudoku
if you like Sudoku
and you know you're tired of doing kind
of the same puzzle just with different numbers then this you this will blow your mind but i feel
like a lot of the appeal of sudoku sudoku i don't know how to say it is figuring out those tricks
and then getting to apply them over and over and for me you know it eventually becomes boring
um but you can kind of have your personal pattern or tricks,
or you may even know tricks, but choose not to use them
just because you like doing it more casually.
I feel like it would be difficult.
I'll try it out and see.
I feel like learning a rule set for a single question and answer
is less interesting to me.
Yeah, I think it's,
I feel like there's two types of kind of
satisfaction and i don't this is getting to like psychology or whatever but there's there's people
who like get satisfaction from novelty it's like oh i saw this thing i didn't see before like oh i
went to manchu pichu and i'm just happy because i did it and then there's people who are like
i played this guitar song like more accurately than I did last time and that makes me happy
right and so the people who do sudoku every week are in category two and this is like category one
so it's like a different kind of satisfaction yeah I think I'm more in well I just said category
two but I think I'm more category one i typically do like find
enjoyment for the first little bit of something so i guess that contradicts my statement yeah
well i should try this i'll report back all right so you're gonna tell us about
mark and i'm gonna tell us about this that's right we homework. Someone will remind us. My book of the show is Son of the Black Sword, which is a different series that he writes that last time.
So anyways, I'm obviously having some sort of thing with this author.
And I listened to this book.
He's not sponsoring the podcast at all.
No, I'm just kidding.
Yes, if you would like to contact us and send us money.
So I listened to Sun of the Black Sword on my commute.
I really enjoyed it.
It's a fantasy book.
And sometimes traditional fantasy books get a little bit weird the first one because they're kind of doing a lot of world building.
But I felt this book struck a really good balance of world building
and also having an interesting story that had some progression from start to end.
Obviously, it didn't tie everything up because it's a series uh and it actually didn't have as much of an end as many books do but it
did have a you know a clear trajectory and i felt like there was on its own you could just read this
story oh no i'm trying to say you could read the story and be happy with where it is and not have to read
the next one but it it kind of i don't want to spoil anything but that's not completely true
so anyways check it out if you're interested in fantasy um the concepts i felt in it were
pretty original to me sometimes i say that like oh this fantasy book had this idea that i thought
was really cool i was i never thought about it that way before.
And someone tells me,
oh no, that's actually from some older book.
And this author just kind of is rehashing it.
So I won't say that this is original,
but to me, some of the ideas that were in this book
were kind of novel and I found them interesting.
So that's Son of the Black Sword by Larry Correa.
And we'll have the link in the show notes.
Or we are sponsored by Audible.
And if you go to audibletrial.com slash programming throwdown,
you can get a free one-month subscription to Audible,
which means you can download any books you could download.
Center of the Black Sword or there's many, many books on there.
We've a whole host of books that we've recommended,
or I guess mostly I've recommended.
Jason's book isn't on Audible, U.S. although i did uh i am halfway through red shirt oh yes about the
star trek thing yeah that that is an awesome book oh you're enjoying it good yeah it's very fun
good yep um yeah it's actually the i'm glad you didn't spoil it when you gave your review because
um don't spoil it now yeah yeah i know but i was totally not
expecting um you know what happened and uh it was it was really you know really awesome i mean it's
like it i'm really into it now okay yeah it's really hard to do these because i feel a lot of
a book should be a surprise and i actually tried to read as little as possible about the books
just enough to kind
of know i'd be interested in before listening or reading them uh and so i so i always feel awkward
giving the review because i don't want to say too much like i didn't say anything specific about son
of the black sword you have no idea what it's about other than there's probably a black sword
and somebody who's a son um but yeah i just don't want to give any of the surprise away. Cause that's like a lot of the awesomeness of reading a book.
Yeah, totally.
So we're also, um, on Patreon.
Um, so you can go to patreon.com slash programming throw down, and we'll have a link to that
in the show notes as well.
Um, and, uh, and that's where, uh, you know, if you, uh, feel inclined to like give a donation
each episode, uh, we also post, um, we also post MP3s on Patreon.
They have a pretty high bandwidth connection and all of that.
So, yeah, Patreon and Audible.
Check it out.
Yeah.
And thank you to all of you who have been doing both of those things.
We really appreciate it.
Yeah, absolutely.
Time for tool of the show.
My tool of the show, given the whole theme of sort of robotics and kind
of more this is a little bit of a stretch but it was a good idea yeah my tool to show is uh my i'm
not gonna say this right evoluent evoluent vertical mouse and so i've had actually this
um since actually since since you and i met i've had one of these mice for work.
I don't have one at home because this would be useless for gaming.
But if you sit at a computer doing programming for a living or just for a lot of hours, this mouse is awesome.
It's a vertical mouse, and so it's very hard to describe.
No, I don't think it is it's if
you put your hand straight out normally you hold the mouse with your palm towards the desk instead
you hold it with your palm facing your keyboard if you're right-handed or left-handed with your
palm facing your keyboard and then you make like a pincher motion with your thumb yeah like imagine
if you're gonna shake someone's hand oh there you. That's kind of like what your hand is going to look like or feel like all day.
And it's really, you know, it's one of these things like you might say, well, who cares, right?
But I actually noticed when I switched to regular mouse after about a month,
I kind of feel like the tension in the shoulder and things like that.
And so this is, I think the, and I'm not like a...
Ergonomics.
Ergonomics, you know, expert, I think.
But what they say is, I guess, when you tilt your hand, you know, palm down,
you cross the two bones in your forearm.
And that causes stress, especially if you do it for many hours.
So yeah, the Evoluent vertical mouse, it doesn't
have to be that one. That just happens to be the one I've always used. I'm sure any vertical mouse
would be great. But yeah, check it out. There's a whole host of ergonomic solutions. Weirdly,
I did have one of these mice and it was still bothering me a little. And so the thing that
worked for me was even just using a normal mouse, but using it with my left hand, even though I'm right-handed.
Oh, I have a friend who, a coworker who sits next to me who does that.
He has, he actually alternates.
I do somewhat as well.
Yeah.
I do have two mice plugged into my computer actually,
but I find for some weird reason,
I guess because I do a lot of other tasks with my right arm,
that using my left arm for my mouse works really well for me but then
people fuss at me because most people who use their mice with their left hand swap the buttons
so you oh i'm gonna get this wrong normally to right click it's the you know right button but
you make it the outside index your index finger should be the main click right but i don't i leave
it that is too confusing to me oh so i use i leave
it in the normal orientation so i use my uh middle finger to do the main clicking oh wow
it's so yeah i'm gonna be really uh adept at uh navigating traffic
like your middle finger is just ready to go i didn't even know what you were saying
i was trying to figure out the right way to say all right moving on that was not the right way
to say that moving on awkward joke um my tool of the show is a 3d printer trying to be in theme as
well if you get into hobby robotics you'll definitely uh want to have a 3d printer or
it won't hurt to have one
um and i got one we talked about 3d printers a couple times on the show yeah and i don't know
if i've talked about mine but um i did end up building one from a kit it's kind of a low cost
one a version of one of the rep wraps uh rep wrap prussia i3 or prusa i3 i don't actually know how to say that um and it's a it's a variant of that
i'm enjoying it it showed me a lot about that kind of stuff i've had a good time i printed a lot of
things some functional some playful and then kind of painted them if you have little kids it's kind
of cool because they think anything you print they think they call it the robot so like daddy i want
to go downstairs and watch the robot uh and they just watch it kind of like zig and zag around um but then you do kind of get into these stages or i
have a couple times where it requires a lot of or because mine's a low-end one i guess or budget one
but i think the high-end ones do need this occasionally too needs like a lot of tuning
to keep it in it in a good state and so sometimes it gets like out of calibration
or whatever and you spend several like sessions where you kind of just want to go down and print
something but it's not working and you're trying to like fix it so you spend a fair amount of time
doing that gotcha do you have one that you recommend because i've always wanted one um i
mean so the one i have has a specific set of problems that i felt were
okay within my wheelhouse for me to save some money um so mine is the folger tech 2020 i3
which means that uses aluminum extrusion 20 millimeters by 20 millimeters and it's the
prussia i3 variant so it's relatively cheap um but the quality control isn't great and the instructions although
adequate you need to have be used to building kits of things specifically hardware things before or
you'll probably be very confused so like how to get it into kind of orthogonal conditions where
all of the various pieces are aligned properly takes a fair bit of kind of
knowing how that should work to know what to loosen and what to tighten and adjust
and i can't even build ikea furniture oh yeah then you do not want this one um so then there
are ones that are you know moving up the price scale but like a lot of people recommend the
lulzbot taz um i've not used i think they're at taz6 now but that one seems
pretty good you know you can look there's a lot of communities on reddit um the reprap community
is is pretty big and there's some a lot of clones from china and elsewhere that are varying levels
of sophistication and goodness or badness and it all depends on what you want to do with it
and how hands-off or tinkering you want to be with it.
Gotcha.
But in my mind, half the fun is printing the upgrades for the machine.
Like I've upgraded a lot of things on my machine. And I derive enjoyment from that.
Oh, I see.
Like what's an example of an upgrade you'd print?
Sure.
So, oh, this is going to get really detailed and hard to explain in words but the there's the in this
style the bed moves forward and backwards but not left or right or up and down so the okay piece of
glass or pcb you know that you're printing on moves only forward and backwards then there's
a set of screws that hang down from the top of the machine that uh the actual print head rides on and moves up and down
and then another motor to move it left and right so that assembly can slide up and down on these
screws but the screws they ship with it are just like cheap same thing you would use for like low
end bolts they're not actually what you would typically use for a control system like that a high quality screw and so i switched out those
screws to the more high quality screws they're called lead screws um so that as it moves up
it does it more precisely which means the prints are more even in each layer and so you get a little
less noise you didn't 3d print the screw so no so you buy the screw but then how the screw
connects to the side holder parts i don't have a technical description but like that needs to be
re-3d printed because it's it uses a different nut than the original one and so you 3d print that
i 3d printed like little feet that go under the bottom so that when it vibrates, it doesn't vibrate the table.
So it's quieter.
This sounds so fun.
3D printed like little holders to like, you know, route the cables.
Yeah, just like all sorts of little things.
Yeah, I mean, I've had so many like things I've wanted to 3D print.
But I don't I actually I have access to a 3D printer now. But but for a i actually uh i have access to a 3d printer now
but uh but for a while i didn't have access to a 3d printer and even like uh you know the uh thomas
the train like wooden train tracks yeah like i if i had a 3d printer i mean oh my gosh like it would
be so epic yeah so i did print like there's a set of low polygon count uh pokemon models that my
kids love so i've printed them
i don't even know how many now like little bulbasaur and squirtles and charmanders uh so
they love those and theme with the pokemon go um and like i printed a lightsaber so like the
lightsaber hilt or whatever and a bunch of pieces that was pretty cool so i've printed a lot of
things that kind of just work pretty seamlessly and then i'm trying to get into kind of designing my own parts for various ideas that i have so that's that goes a little slower though very cool
all right talking about robotics robotics so this will be a little different in the structure of how
we talk about it because i didn't we could talk about the history of robotics but i don't know
yeah i mean that's it's probably enormous and not that relevant.
So the reason why I find robotics interesting
and the little bit of work I've done with it from the hobbyist and not,
is that it's a lot of systems that need to work together to kind of have a robot.
And so we're going to kind of go through each of the,
or some of the various subsystems that make up a robot, because a robot is different than just an application where it's a binary running on a computer.
It is often many different applications.
They need to do a huge spectrum of different areas of expertise because they all are needed for having a successful robot.
So the first one that I guess everyone kind of thinks about, and I'm not going to talk about since this is programming throwdown, we're going to talk about this as it applies to software. So we're not going to talk about things like mechanical design of the robot, but that is also a very interesting topic.
So the first one is the things that move or control or interact with the world and the controls for them.
So these are, you know, you could think of um what moves the robot so most robots we
think of move around the world in some way so maybe it's wheels that are attached to motors
and those motors spin the wheels and move the robot forward or you have you know a robot arm
and it has actuators little motors at each each joint um it could be i'm trying to think of other things uh treads for a tank style robot
there's all sorts of different things about how do you move a robot um and then there's things
about manipulating the world like i have a little claw and i want to grasp the world or i want to
i'm trying to think like things
where you want to interact with something physically
in your world versus just moving through it.
And a lot of these have that in common.
They're combined with what we're going to talk about next sensors,
but you have some sort of motor
or a electromechanical muscle of some sort that's moving
and you need to control that.
And so there's software that needs to be written to say,
if I want to move precisely from uh you know one millimeter forward how do we do that and there's
kind of two approaches there and there's a lot of software around this but one is open loop that's
the easiest so that is i know that if i have a stepper motor which each time i kind of move the
stepper motor forward it moves a set number of degrees.
So like 1.7 degrees forward.
This is like, I guess, if you had a tire.
Yeah.
And you know that if you rotate the tire 360 degrees,
you know the radius of the tire,
you can kind of guess pretty accurately how far you're going to go.
So that's a great example.
So if you're going to like roll forward on a tire,
you wouldn't necessarily do that closed loop because there's a big problem which is as you roll forward the tire probably slips a little and so at the end you don't exactly
know how far forward you went so even if you have an encoder on the wheel to see physically how much
did the wheel move you aren't able to measure like via the wheel itself you
aren't able to measure if it slipped at all okay and so that that would be kind of something you
would do open loop most often you would just kind of drive it and you would rely on some other
sensor to tell you how far you went but then you have closed loop so closed loop is like a servo
so if you've ever used a servo of any sort before, you kind of tell it to go to a specific
angle.
So like I want to go to angle 90 and I want to go to angle 95.
And it has circuitry inside of it that tries to keep it at that angle.
So even if you go push on it, it'll try to go back to the set position.
But there's software in a lot of these systems that does that.
It's called
closed loop and this is where you get into stuff if you've ever heard um pid which is like
proportional integral differential or derivative control so this is a way of keeping something at
a set level and this gets into control theory and in closed loop you're sending out a control signal
for something to happen and then you're measuring what happens
back and you could have all sorts of problems where you don't want to but you're trying to go
for a certain position and you overshoot it and then you need to move back and there's all sorts
of math around how do you try to prevent overshoot how do you try to prevent that like over time it
stays very close to it?
Does this involve calculating the gradient or something
and moving step, like adaptive gradient or something?
Yeah, so there's different ways.
So there's, like I said, the PID loop.
Other things you'll hear about sort of in this arena
are like Kalman filters start to come in can come into this this isn't
meant we all probably later go into more topics this is kind of giving you google words that you
can go search or maybe context if you've heard some of these words before but this would be you
know closed loop is trying to say how do i have a desired outcome and then how do i make sure i
achieve that outcome in a good manner gotcha that makes
sense so closed loop has to be something kind of simple like like uh turning a rudder on a
on a boat or yeah holding a rudder at a specific position on the boat yeah or holding a robot arm
at a specific level or even things like you know we were talking about before like a 3d printer
so my 3d printer has like the nozzle that heats up the plastic. You want to hold it at a very specific temperature,
but that's not as simple as just setting an amount of current to flow through. Because as the room
temperature changes, as plastic flows out, like cold plastic comes in and then hot plastic goes
out, the temperature moves around a lot. And ideally you would like it to be very stable at
a very specific temperature. And so there's a control loop where somebody in software is measuring from a thermometer
the temperature of the piece of metal that is the nozzle and controlling the heater that heats up
that piece of metal and so there's actually a control loop running there to try to keep at a
very stable temperature okay that makes sense so do sense. So it sounds like with closed loop,
you just like someone else has kind of done it for you.
But with open loop, the kind of onus is on you.
Like maybe you have a camera or something
and you're the one who has to say,
I'm really close to the wall right now
or something like that.
Yeah, so I mean, open loop.
So these are just, it's kind of separate from actuators.
How do you control something? How do you move? and then these are various ways when you move things kind of how
are they moved whether you do them in open loop or in a closed loop um so so for things like sensors
there's a whole a whole bunch of questions so you could use a sensor to try to you'll hear people
say close the loop so i moved you know i told my robot wheels to
move forward and we talked before about structure from motion like i look at the camera and tried
to guess how far forward did i move to quote unquote close the loop so that even though i
didn't measure anything about the motor i looked at the world around me and say the world shifted
forward a foot therefore like i know what i just did to
the motor if i do that again i will most likely move forward one foot again oh is that where the
phrase close the loop came from uh i they're related they're related i don't know which one
came first that's interesting well it's interesting i never thought about you know every time i've
said close the loop it's like you know talking to somebody or something yeah so when you close the loop with
a human you did something and then something happened and closing the loop means like getting
feedback back so you know what to change next time yeah that makes sense yeah it makes sense
so the camera the camera gives you the feedback, yep. That potentially could give you the feedback
that then turns into more actions for the wheels.
It then changes the camera.
And so now you have a closed loop.
Yep.
And so there's things like, you know,
for sensors themselves, we'll talk about in a second.
But like, often you'll have a camera
and you want to point the camera at a specific direction.
But if you think about, oh, like, you know, quadcopters are really popular now,
these helicopters with four blades, but they kind of move and bounce around in the air.
It would be ideal for some of them if you held the camera pointing at a very specific thing.
And so how do you do that?
You have a set of motors that are able to move the camera,
but they need to monitor what the quadcopter is doing and kind of cancel that motion out and so that's a closed
loop system that gimbal system for trying to control that camera and that is so that the
sensor the camera itself gets a good image and so then there's a lot of work associated with
sensors themselves how so we talked about a lot of
things there for sensors but someone still has to write the code to talk to these pieces of hardware
and like read ultimately they're probably producing some electrical signal or the hardware itself is
producing bytes that need to be read but you need to interact with those pieces of hardware
and make it into something that the rest of the system understands. So for a camera, that would be reading out a single frame off the camera.
For an accelerometer, it would be configuring the range of sensitivity for the accelerometer
and then reading out the current acceleration that you're experiencing.
So there's a lot of work around how do you do that for the sensors?
How do you read it in? How do you read it in?
How do you put it in a format that makes sense for the rest of your system?
And then how do you do it at like a set interval quickly enough so that you're not –
sometimes I read it a little early and sometimes I read it a little late
because that can cause problems with some of the stuff we'll talk later.
But a lot of things in a robotic system are assumed to be running at a very specific rate.
So this is similar to like in
a video game you want it to run at whatever 60 frames per second and so you want everything to
kind of always be at that and if it if you had 60 frames in a second but you had all 60 right at the
beginning of the second it would look very weird so you actually want 60 evenly spaced frames
and so that's called the jitter how much time the time between frames
how often it does and so when you're reading sensors you're trying to kind of reduce jitter
make sure that the you're reading it at the set rate there's a lot of work about that as well
gotcha that makes sense um yeah a big part of robotics too is is planning and automity. So one is autonomy.
So one is teleoperators.
This would be like, I guess, using a joystick
and just when you
press a trigger down, the helicopter
blades turn faster or something like that.
There's also just purely autonomous
where you give it
kind of very high level instructions
and someone's built all sorts of layers of, I guess, machine learning and different kind of planning systems.
So, in other words, like the very top layer could say, you know, fly to this spot on a map and then fly back and land. And so at that level, if you're doing any sort of machine learning there,
you're probably not doing any machine learning there.
It's probably a human putting in certain commands based on sort of changes
that they want to make in the world or things that they want to see in the world.
So that's sort of like human-level decision-making.
Then when you go back, when you kind of go see in the world. So that's sort of like human level decision making. Then when you go back,
when you kind of go down in the stack,
it would be things like,
there's usually some kind of a state machine
where it says, okay, am I landing?
Am I taking off?
Am I flying to a destination?
Am I trying to take a picture or something?
I'm thinking of drones here, right? and at the bottom level are things like are kind of like a system for each of those states
like um you know the drone is taking off here's sort of a bunch of logic to kind of handle the
takeoff scenario and did it for all the other kind of scenarios. Yeah, I think each of the different,
if you think about subsystems in, for instance,
like, you know, a quadcopter,
you have something that's trying to
keep the helicopter afloat, like don't crash.
But then you have something else trying to say,
you know, move forward.
So there's an interaction between like go forward
and do it stably. Like you don't want it, you know, kind forward. So there's an interaction between like, go forward and do it stably. Like
you don't want it, you know, kind of going crazy. You want it to go forward smoothly and deal with
any kind of disturbances along that. And then as you said, there's something more, which is like,
I'm trying to get from point A to point B. And so like, what's the best path to get there um another part of it is like supervised learning and so what
this is is um like what's a good example um this isn't i should have done this as a tool of the
show i've been doing the udacity uh machine learning class with sebastian run the self-driving
car one yeah uh yes And he talks in there.
So I definitely recommend that.
I've never really sat down and did a massively online class,
but I finally did, and I did it with this one.
And I cheated.
I didn't really do the homework.
I just went watching all the videos.
How are you going to do the puzzle contest
if you can't even do the Udacity homework?
But I've been watching, and I found it really a good, well-put-together series.
And so if you're interested in robotics, I would definitely recommend it.
And so the example they use there in supervised learning is that when you're driving an autonomous car,
you want, for instance, to decide if the terrain you're currently driving on necessitates that you drive fast or slow.
And so over time, they collected a bunch of data when they were driving a car and looked at things like the accelerometer for how bumpy the road was.
And I forget they used something else as an example.
Oh, the current gradient, like whether it was flat or steep or very steep.
And so they recorded these various things while they were
driving and produced a data set where they the label was either they were driving fast or driving
slow and so supervised learning would be saying giving that to a computer and then saying hey
next time i give you a current bumpiness and gradient i want you to tell me if i should drive fast or slow
but i give it a bunch of examples of what i did to supervise it and how to make that prediction
right and actually they did the same thing for alpha go the world champion go player um
they actually you know because if you imagine like in go there could be actually many different ways
to play really good go and trying to find all of them or trying to find one of them could be could
be really really hard so what they did is they said let's take all of the games played by all
of the world champions and in the beginning when they're when they just start
learning instead of trying to play have the computer play go against itself and get better
that way which is what they do later but in the beginning they just say look computer this was a
game played by two experts um the next time you see games like this i want you to play as good as
these experts do so like in other words take these, this bank of games played by these experts and try to generalize it. And so this changes the
objective function from, you know, play the best possible game ago to just do what these experts
do, which is much, much easier. And then that was sort of a scaffold. Once they they have that then the system is kind of already
tuned to a certain spot of the search space um so in other words like to to illustrate like
if all the experts in go for some reason always place the first stone on the bottom left for some
reason like it's just a thing then you can learn all sorts of cool strategies where you don't do
that but it's not going to help, especially if you're going second.
So you might as well learn what the experts do and then optimize after that.
And so the self-driving car is the same way.
You can't just train a model and then have a self-driving car go on version zero of the model
and just drive off a cliff.
It would be a disaster.
So instead, you build this supervised model and then you can even while you're driving you know
see oh what would the model do and if and if you're going 45 and the model says i would go 130
130 miles an hour then you know something's like really busted yeah and and i think interesting
you talked about like levels you know know, first it's kind of
remote control, then you kind of move up. And if you think about like autonomous cars as an example,
even though the end result, you want a fully autonomous car where you just say, I want to go
to the grocery store and it just takes you there. You kind of, as you're building up that system,
you take it through various levels where initially you just want to test that
you can kind of tell the car what to do and it does it.
Then eventually you're kind of monitoring what it does,
like allow it to do some stuff.
So that would be like cruise control,
like set the car on cruise control and it knows to just try to keep that
speed.
Then,
you know,
you're giving it a task,
go the speed and stay in a lane.
Then you're going it a task. Go the speed and stay in a lane. Then you're going like, okay, now I want you to figure out how to change lanes on your own.
And then a step past that, it's like, I don't care how you do it.
You pick the roads.
You pick the lanes.
You pick the speed.
I just want to go from here to here.
And you kind of take it up through that level of sophistication.
Right.
Yep.
And that's something that we still
haven't done with a lot of systems like we don't have a lot of fully autonomous systems even things
like the drones you hear about being used for war aren't autonomous and it's scary what will happen
when they finally do go fully autonomous but you don't tell them protect this area or you know go
take this action they have some combination of humans telling them
you know fly this way and like you know get home right but like they aren't sitting in an area
looking for something to do we don't have robots that yet or at least not commonplace where a robot
kind of replaces a mall cop and there's just a robot you know sitting in the mall watching for
bad behavior and then like setting off a siren if it sees someone doing something bad um yeah
exactly i mean there's this saying uh uh there's this sort of like thought experiment you know if
if if a robot if you have a robot made and the kids are like really hungry, what's the stop the robot made from like microwaving the cat?
It's like, it's like you need like all of those kind of really higher level things that involve
sort of the fact that like, you know, different, different, like the fact that like, you know,
ants like have a different like level of feelings as as as a as a cat and so you could step
on an ant you can't step on a cat like these these things or you can't kill a cat i guess
these things are are like incredibly entrenched in like our psychology and like very difficult
and we haven't even like begun to to to sort of like crack these problems.
So yeah, as Patrick said,
because you're so much about,
oh, you know, Skynet is coming, things like that.
And it's not, like we're so far away from that.
And so that's where the machine learning,
I think comes in is we talked first about controls
and motors, and then we talked about sensors.
I mean, these things are highly deterministic
and highly straightforward part of robotics. And once you have them working, you can kind of have
a remote controlled robot, I guess. But the machine learning comes in when you start trying to say
things which are a little more non deterministic, there are many ways to accomplish it. And what
Jason's indicating is exactly right. Just because we have something which can do a relatively mundane
task doesn't mean we're suddenly close to something that knows how to do all tasks.
Yeah, exactly.
Or even something that is self-aware, like that knows that it's doing a task and sort of what that means.
So then another something to consider with robotics is often you may have many processors for a large robot in the system, all responsible for doing different things.
Like one's responsible for collecting all the camera data.
One's responsible for collecting the sensor data.
Another is responsible for route planning.
And so all of these systems have to communicate with each other.
And there needs to be, often they may not even be the same kinds of processors.
Like some may be very small, low-cost processors. some may be very small low-cost processors some may be high-end fancy very good processors and you need a common way
for them to interact and communicate with each other so that's something that as a robotist
you have to work on and debug and then also sometimes you need a communication off of the
robot so how do you keep a log of what's happening you call that telemetry what if you want to talk
to another robot and the two robots should coordinate to do a task now you need a distributed
algorithm for deciding like what to do with multiple robots and this is where you get things
like swarm uh robots and swarm intelligence and that's another interesting exploration area of
robotics yeah i've seen a lot of uh there was there was this paper that came out a long time ago.
It's called Boyd's.
And the whole idea was they studied a bunch of different bird.
This person was fascinated with how birds fly in like a V or different shapes.
They're very geometric.
And how difficult that must be from within the frame of reference of one of the birds to sort of understand how to orient itself
and what it found is if you have a few simple rules um you can actually get that kind of that
flocking kind of effect i mean the rules are very simple like uh you know get a
little bit away from the birds next to me but not too much away it was kind of like a like a force
based like a graph uh force-based system and uh so so i think that uh that's a big part of it is
understanding like when you have many different robots um sort of how does that
complex adaptive system work and there's a lot of really interesting research there yeah so like
emergent behavior and yeah right yeah there's that's a huge area of research and you know a
very interesting thing to look at and understand yep another part of this is hci human uh human computer interaction and i think it's also called
human machine interaction and this is just uh about sort of how you uh interact with with the
machines around you it's very the name is very straightforward but you know for example um you
know the touch screen uh is kind of one of these things that's gone in and out of vogue. I mean, I remember
when there were touchscreen laptops, and then people realized, or, you know, a lot of people
realized it doesn't really make sense. And then there was the Newton, where it was a phone-like,
you know, form factor, but it had a stylus. And now we have the iPhone style, right?
And so these are all just advances in HCI, and they can cause radically different user behavior.
If I have to pull out a stylus, then that adds friction to the experience. I might not do
something quick like send a text message or check my email or something.
And so it's just hugely important.
And it's kind of like that kind of gets right on the border of robotics because it involves a sensor and it involves kind of the outside world.
Yeah, and I think the difference with robots than just like how do humans interact with machines is
also robots move about in our world it sounds a little weird i guess but and humans perceive them
out in the environment and so you need to understand what are you trying how do you want
people to behave around the robot do you want them to ignore it do you want them to you know
be friends with it?
These are questions that are still very large open research projects.
But things like the self-driving car, what happens when you get into it?
And when you're sitting in it, how does it make you feel?
That sounds really weird, but ultimately, if you don't feel safe because of the way it's driving,
even if the way it's driving is
better than the way humans drive you're probably gonna be really freaked out so even if elon musk
tells you everything's gonna be okay yeah so maybe they need like a little elon musk head to come up
and say welcome to our car right but these are all things you have to think through if you have
a machine out in the world and then there was that movie about it but i don't remember where the assistant
on your phone and people kind of develop a bond with it and call it by name and instead of saying
it they say he or she is it i robot is that right no everybody's a different one okay i know what
movie you're talking about but i also forgot i didn't watch it but but yeah basically this is
a real thing that if people project emotions onto these or will, what are you wanting to evoke?
And so this is things like when you call into a phone line for customer service, right, that they call that a robot.
I didn't actually think about it until just now, but like, I guess a phone answering robot.
But they want you to efficiently get to where you are.
And but they need you to behave in a where you are um and but they need you to
behave in a certain way to kind of get that so they have to interact with you very specifically
and it's the same thing goes for robots that how should you put little eyes on the robot or not
what like people will react differently depending on what you do. So actually, I saw something pretty awesome in the city,
in San Francisco, downtown San Francisco.
I saw on a light pole this poster that said,
you know, gone missing.
And it was like they had taken the template of,
I guess if you lose your dog,
most people just go into Google and type like,
I lost my dog. And there's some Google Doc template
because they all seem to look the same.
And it has little things where you could tear off the bottom and call the number.
But it was a person's Roomba.
Like, I guess the battery ran out in their fence and the Roomba just went out of the
backyard and went down the street or something.
And it was like, lost Roomba.
Like, if you find him, please cuddle him.
Wait, that sounds like it's just a joke.
I don't know. there was some well we'll
see we'll see i think that i think it was written in a funny way but i think the person legit lost
the room okay yeah i do know a lot of people call the roomba like him or her like or at least they
have name a name for the roomba so interesting so then I was just uh
to close out going to talk about various things where people hear about robotics we already talked
about self-driving cars drones um you know these are things but also there's first robotics so
that I think they have various degrees for middle school and high school students
and these are remote controlled robots because at that level i think there's some
opportunity for them to perform some autonomous tasks but um they're also remote controlled
because autonomy this is very hard uh and then robot wars which i've been watching which is like
i guess entertainment tv and there are some of the systems we talk about like control systems and
stuff but there isn't much sophistication in the terms of autonomy although a couple of the teams do talk about things that
they've tried to make automatic um but there are also oh what is the name the robot cup is it where
oh robocop yeah where robots play like a version of soccer right and they try to do it autonomously
for people who don't know the robocop the goal of the robo cup is to have a fully autonomous um robot team that can play the world
cup winners in 2050 and uh it's pretty audacious goal um but yeah i mean they have they they tackle
like every level of the problem has a competition like there's a competition for who can build the best like humanoid player who can build the best like one foot tall player
so on so like there's a whole competition for who can build the best ai and like a pure
virtual sandbox uh yeah robo robo cup is amazing and it's an interesting problem which is if the
goal is simply to beat the world cup team do you have like you still
obviously probably have to obey the world cup rules so you can only have like 11 players but
do they have to be shaped like humans i you know i don't i don't know like some of the rules in
soccer probably only make sense for humans yeah they're shaped like ankle destroying tiny robots
but even if you don't something ridiculous like that like it just
might be like very short stout barrels right like maybe that turns out to be particularly optimal
but then now like the rules about using your hands or not like don't make a lot of sense i
think the implication is to do it with humanoids but it's actually a broader problem for just all
of robotics if you're designing a car assembling, it's all about function and very little about form.
But if you're building something that's out there with people, you know, form starts to matter a lot more.
Yeah, right.
It's actually like super interesting to read articles and other sources on sort of things which have taken like inspiration from the human form for no reason.
The example they gave, which I don't know if I really agree with.
They said like the driver in a car sits on one side of the car.
And I guess they were arguing it would be better to have the driver sit in the middle.
And have two people on either side.
Like have the car be a little bit wider.
Like I don't know, I i thought this kind of weird but but their whole thing was like oh the a human being is asymmetric
on the inside because of your heart and other things right and and symmetric on the outside
what yeah they were trying to draw an analogy between the asymmetry of the inside of a human
and the first designs of the car and uh i don't know if okay yeah that seemed pretty
out there but but they had a number of other examples too but i think it's kind of interesting
and i think over time people learn in the case of something that's purely functional like a robot
you know a car building robot or something people eventually get over sort of their own human bias
and learn like oh you actually don't need something
that has an arm like a human or a human looking hand or but if you're going to have a robot made
in your house it needs to open doors and cabinets and obviously those things are meant for human
hands to grasp that's true and so then you're kind of forcing the robot to have certain features
which even if you don't otherwise intend it needs to be sort of human-like height to be able to reach for
instance tall cabinets have sort of human-like grippers so that it can manipulate things designed
for humans to open or you're forced to like retrofit everything in your house for like it
wouldn't be good for both humans and robots it would be good for either humans or robots unless
the robots also look like humans or the humans look like the robots.
Yeah.
Or maybe like the drawer is like a hybrid where it has a little hole that the robot can,
you know,
like stick something in the hole so that they have leverage.
I don't know.
But then it's then the adoption problem is hard.
Yeah.
I do think I'm surprised that by now there aren't self-cleaning toilets where like
the toilet has just something in it that just you know like goes around the bowl and like cleans it
just seems like it would be something that would break a lot though and really like a toilet is a
very simple piece of equipment like if you complicate it with adding like a self-cleaning function i don't know i don't know i mean we're off of a software topic yeah i mean i don't know what
the control system would be for determining when to clean a toilet yeah i actually do i just don't
want to think about it well it's kind of like a roomba where if you clean like the roomba is not
the best at the best vacuum like it's not better than a human at vacuuming accurately,
but it just runs so many times that eventually it works.
Okay.
Well, that's all I've got for robotics for now.
Cool, yeah.
If you've done any cool robotics work, let us know.
Post on Facebook. cool robotics work um let us know post on on facebook um facebook seems to be taking over
um in terms of number of people um i'm obviously going to keep posting the show on on all of them
facebook twitter g plus uh and now linkedin a few people asked me to post on linkedin so i've done
that um but uh but yeah if you if you uh if you have a
toilet cleaning robot that you want to show everyone
post it on Facebook
and we can talk about it
alright
well until next time
catch you guys later Programming Throwdown is distributed under a Creative Commons Attribution Sharealike 2.0 license.
You're free to share, copy, distribute, transmit the work, to remix, adapt the work,
but you must provide attribution to Patrick and I and sharealike in kind.