Wednesday, October 05, 2016

Keynote: Jim Weirich - Why aren't you using Ruby? (RubyConf Uruguay 2013)

good morning again ok let's get this started excited to be here
all right very good I'll before i start my talk I want to start off with some
ok so i want to show you guys the latest toy that we have back in the office
so if you see right here this is a flying drone this remote-controlled this
is a this is actually Karen's drone was flying
I'm filming this from my drone so we have two drones actually flying in the
office right there
there's Karen right there at the edge we're trying to do the thing where we
were practicing flying so she's going to fly around the room and i'm going to fly
so my camera points at her all the time lost in the lights there we go
coming out there I tell you this is great fun and I it's it's really weird
to see people walking through our hallways at the office and looking up
and seeing what's going on with us but so far everybody has been very positive
no ones are trying to get us kicked out because we're flying drones but this is
this is this is awesome stuff and you just have great fun
I'm not going to make you watch the entire video I'm going to skip ahead
here and I'll show you what happens when your drone runs out of batteries
so there in about right here maybe
ok so i'm i'm filming and going around all of a sudden I get a little bit
wobbly with my grown in there we go okay
lesson watch the battery meter when you're flying
ok so that's the fun part we'll have more fun too but I thought we just kind
of start off with that
hi I'm Jim America I'm with me oh and i'm here to talk about fine
you should be using Ruby now I think so i'm gonna i'm gonna try to convince you
that ruby is a cool language to use and that you should be using it then
and if you're not already how many ppl her here using Ruby already
ok qui tam how many people here are curious about Ruby and aren't using it
yet ok quite a number of you you are the guys I want to talk to i want to tell
you about Ruby and get you excited about maybe using it now there's a downside to
doing talks like this and I think us as programmers fall into this trap a lot
there's features vs benefits and when I talk about features if I talk about Ruby
I'd love to tell you about the blocks and Ruby how we can use anonymous blocks
do all kinds of wonderful things I can talk about the strong
oo messaging in Ruby and how great that is i can tell you that ruby is a dynamic
language i can tell you about the testing culture that comes along with
community of Ruby but these are all features of the language what you really
want to hear what are the benefits to you for using Ruby
so I'm not going to talk a lot about the features Ruby
instead i'm going to tell some stories
so maybe a better name for this talk instead of why aren't you using ruby is
why i use Ruby
so we're going to go for me i'm going to tell you five stories about some ruby
code that I've written in the past that I get excited about and i really love
and the first story is about me switching to ruby in the first place
people recognize how many people recognize this code
what language pearl
gasps pearl so i was i was using perl at the time this would have been a year two
thousand probably in the spring
I've been using perl for about three years to do a lot of scripting I was a
C++ programmer at the time just learning java
during this time . i use perl to write a lot of the scripts that I used to manage
my process to generate header files to find things in files to sort things out
just all the tools that every programmer uses to get things done
I was riding my stuff and pearl of pearl is a wonderful language to get things
done quickly and I really really loved it for that but there's a big downside
to using perl i found that as my programs grew larger and larger the Perl
code became harder and harder to manage as long as you need a list of items and
that's awesome works great as soon as you need a list of a list things get a
little strange and pearl in fact i would like to point out that in the perl
tutorial page there's a separate document just talking about how to write
a list of a list and it is called pearl
LOL not saying anything but ok so i was using Pro I was really really really
looking for something better so I survey the landscape and in the year 2000 it
wasn't much else out there
I stumble along this other language called python good
python looks like it's exactly what I need its object oriented which is
something i really really like if you ever try to do object orientation and
Oh heaven help you
it was a scripting language and is freely available to all the criteria i
need so i grabbed python i started using it
the media downside i found is that where I could write stop very very very
quickly and pearl to do it in Python required me to go back to the
documentation and read how do i read a file how do I do this
how do i do that and every single thing I needed to do I had to look up and
learn and so the learning curve moving from perl python was rather steep for me
in fact it was steep enough i tried three separate times to learn python and
gave up two times the third time I was determined
i am going to learn this language or else so i sat down i started doing stuff
with that i was reading the documentation and I was I was really
getting you know in the Python and I was really going to learn it and then I was
reading a mailing list are
I think it was the extreme programming mailing list so because XP was really
big in the year 2000 that was kind of when it was kicking off
i was reading that mailing list and there was a email on that list from this
Dave Thomas who wrote the pickaxe book but at the time the only book he had
written was the pragmatic programmer which I had just finished reading if you
read this book
awesome book if you have not read this book yet please go out and pick it up it
is full of really great pragmatic advice for developers really highly recommend
that so I said oh look here's an email from dave thomas and i really respect
him because of the book he wrote here and the email he said hey guys i
discovered this little language called Ruby
it's kind of cool you might like it that's all he said
I thought well if Dave Thomas likes Ruby
I'm going to check it out so i downloaded Ruby
I booted it up put it up i started it up and I start taking a look at it and in
two days
I totally switch from Pearl to Ruby after two days i wrote no more new code
and pearl
after that . I that switch over was so easy for me every time I got to a place
where i said i need to do something i would think about well let's see Pearl
doesn't like this if I would take that and do it in
oo ay I wouldn't do it like this and bam it worked
so Ruby really matched that match my expectations of the language
it was an awesome experience I love Ruby ever since that so i've been using Ruby
13 years getting really close to 13 years now so awesome awesome awesome
language so let's summarize this story
uh ruby has what we call the principle of least surprised things in there if
you know the language and kind of those no verse going
this thing's in it tend to be unsurprising you think
how would I do this and doggone it
it seems to work it has great data abstraction where pearl had trouble
managing lists of lists Ruby could easily handle list of anything and it
was just objects and everything was uniformly access through through message
passing it was strongly strongly 00
in fact it's probably the most oo language out there in the same class as
small talk
so a really strong mobility and easy to learn
I found it quite easy to pick up and go with it I teach rails programming now
two people new to rails and most of the people in the class are also new to Ruby
which teach them rails and ruby in a three day course and they come out of
that with a pretty good foundation on how to do programming in rails even
though that might be the first time they've seen ruby ruby is not a hard
language to pick up
so second story
this is a true story
the other one was true too but I just want to emphasize that this one in
particular is true
the names have been changed to protect the innocent guilty
those involved I was working in a large financial company at the time and this
is soon after I've discovered Ruby and I i was using Ruby a lot again for my
tooling for the stuff I do every day
I wrote Ruby scripts to analyze the data base i wrote a movie script to go into
the database and pull out data and show it to me in a form so i could easily
figure out what was going on in the database
I wrote a movie script to talk to their event manager so I could receive events
and publish events on the event manager
so everything in the environment that we work with I had Ruby scripts to
communicate with that and make it easier as my job as a programmer to do work in
that environment
now this particular part of the company dealt with incoming mail
if you send any kind of mail to this big not multinational financial corporation
it all came through this one room in Hebron Kentucky and they would open up
the mail and they would scan it into a scanner and digitize it
net scanner that data would go into a program that would read it and it would
generate an event for every item that was scanned that event was published and
picked up by the next program in the pipeline
so at this point it's been scared it's a form it's got image data attached to
this event actually the image restored the database but a reference to the
image was put into the event then would run through a bar code reader that would
look at the image and look for barcodes and find data encoded on the forum in
bar codes and add that to the event and publish it again with this new event
then went to the checkbox analyzer and it would look for checkboxes on the
forum and see if this checkbox is checked for this check box was not
checked and then it would add information about checkboxes to the
event and it would publish it again and then they would go on to the pipeline
there are stages in this pipeline
that looked for character information did handwriting analysis and there was
manual verification steps and things but it kept publishing these events on the
pipeline till eventually got to the point where it says okay we've collected
all the data for this form
I'm going to publish this data out to the pension division or to the stock
options division or to some other division it was a whole workflow type of
well for many years how they handled facts data was they would get a fax they
would print out the facts and they would scan it and that actually work and
surprisingly but it seemed to be rather inefficient and scanning us
you know the facts is already scanned and scanning that is just leads to all
kinds of dirty images so they thought they could get better results by feeding
the scan and fax data directly into the feed
so the fact state would come into its own process it would publish an event
and then it would enter the pipeline just like anything else so paper email
our paper mail with scan and fax data was scanned and sent in as well so
that's the way that worked
I was sitting at my desk one day working hard on you know kind of heads down on
working with whatever I needed to work on this was the days before pair
programming got popular so I have my own cubicle right there and I was kind has
done and I noticed that people were kind of wandering around outside my cubicle
kind of running back and forth in and the noise levels seem to be a bit little
bit louder and I wondered
something's going on today and I don't know what that might be
but I'm working here and finally my manager comes into my cubicle with
another developer he says up
Jim you know you know Ruby don't you
I said oh yeah because I've been kind of evangelizing Ruby to the rest of the
group i was the main user but there are several other people who saw some of the
advantage of Ruby and we're using it as well and they said well this is what
the part of our process that takes in facts and publishes the event somehow
was dropping events
I no longer recall the exact
technical reason for this failure maybe the disk was full or maybe there's an
exception being thrown I don't remember but these faxes are being dropped
now you know if I lose a fax you know how do i use facts in order to our
restaurant if I lose my fax
I don't get my meal that day um that's not the case with this company
those orders coming in might be changes to pension plans are changes to stocks
are you buy the stock sell that stock and if they don't take action on that
order within a certain number of hours they are liable for the difference in
price from the point that these the fax was sent to the point they actually made
the trade
this is potentially millions of dollars of data that was falling out of the fax
machine and onto the floor
this was an emergency so they said Jim you know Ruby can you help us out turns
out that the facts program I wrote a pretty complete log of everything it did
and the log was still being written it was saying Oh exception thrown we're not
delivering the message but every single fact element was was recorded in the log
along with the database idea of the image associated with that facts
so what I had to do was write a ruby script that would read the log would
reconstruct the event based upon details in the log
pull the database ID out and put it in an event and republish that event into
the system so offended essentially i was writing a vacuum sweeper that would
sweep up all the broken fax is laying on the floor and put them in
so this is how I saved the company millions of dollars using Ruby Ruby hero
I asked for a fraction of that million to be included in my bonus and they just
laughed I don't I don't get that and actually truthfully it was a team effort
I was doing the log recovery someone else is doing some event stuff there
about five or six people all working on this problem the long recovery piece was
just a small portion of that but together by using ruin it and they knew
that Ruby could handle the job they knew they could not write this stuff in Java
quick enough
you know in the half hour that we needed to get this done so here Ruby handles an
emergency it's really rapid to get a quick solution up
it took me about half an hour to figure out how to parse the log file and
generate those events and we say blocks and lots of money with that
all right
next story
I love this picture this is actually at the Breedlove guitar factory in bend
oregon and the gal here is actually working on the fretboard of a guitar
she's playing in the grooves and putting in the frets for a guitar that will be
made there
I have a Breedlove guitar so when I took tour of the factory i just took all
kinds of pictures i love i love this stuff before I want to concentrate on is
that we as developers love to make things love to build things i was
working on a project with a friend of mine we were preparing and we were
working on getting a build script up and running and working and we were doing
and we were it was for java but we were old hat developers back in those days we
this thing was kind of newfangled for us so we were still using make at the time
and we were trying to do make trying to get make to do something that was just a
little bit too dynamic for make we were shelling out to walk and scripting stuff
and doing all kinds of weird things
I think I look like this by the time i was done i turned around to ryan i said
wouldn't it be great if make were written in Ruby and ryan says chip
that's an awesome idea I have no idea what you mean
so I turned around on the whiteboard I scribbled on the whiteboard something
that looked approximately like this I said Ryan you would you would have a
task command and this task man takes up a name of some kind of task to perform
and then you just give it a block of stuff you wish to execute when this task
is performed and somehow you would manage dependencies and do that and and
you would just use this like you use make but it'd be all right and Ruby be
totally dynamic this problem we're trying to solve would be trivial to do
in Ruby and since that's brilliant
and we talked about it for another five minutes but then we realized you know we
really really wanted to do this
what we have to do well we'd have to reproduce the entire functionality of
make in Ruby just so we can get it a little bit more dynamic and we laughed
at the idea
that's silly no one would ever ever want to do that
only an idiot
so Ryan went back to his desk and he left me sitting there thinking and I
began to think well god
how hard could it really be
I mean if i did a really trivial implementation of make in Ruby fought
what I have to do here imagine you have this setup
let's set up a sample they make like problem you have a task called make mac
and cheese in order to make mac and cheese
you need to boil water you need to buy cheese and you need to buy the pasta for
the macaroni before you could buy either posture macaroni you have to go to the
store and these tasks have to all be performed in the proper order as you
don't want to start boiling the water before you go to the store that would be
so you need to have some kind of dependency structure between these tasks
and you be but need to be able to say hey go and do this
so you might create a structure that looks like this
declare a task give it a list of dependencies and these dependencies are
exactly the dependencies
I've run out here with the Green Arrow's make mac and cheese bar water by pasta
by cheese go to store five different tasks with all their dependencies
declared and if you're familiar with rape
this is very very very similar to what break
looks like today just a few syntactical differences just to make it easy
that's what we're going to do now is we're going to write rate
you think I'm joking
so here there is our task while I have it all ready to go
so there's a lot of tasks
let's open up the micro rakefile and you can see it's empty and what I want to be
able to do is be able say Ruby micro rake and give it the mac are no excuse
me make mac and cheese command and run that and will run all the task now you
see it does nothing here because our microwave file is empty so let's see
what we need to write to make this to work
um I'm going to start with the last thing we do and work backwards in the
file so we need to be able to grab this command name right here this make mac
and cheese from the command line and try to invoke the task fix that
so I'm going to say RV each do for each argument in our argument list
we need to find the task so let's assume we have a global half called tasks we
look up the task in there we invoke the task then we end
so there that's that's the end of our program
so what becomes before that what we need a i said i had a global task hash here
let's create that and let's define a task method that takes a name
a thank you yet
we just got to turn off Wi-Fi here
that is way too tempting for people takes the name it takes dependencies and
it takes a block and in there we are going to create a task object new and
passed the name
the dependencies and the block into that that will create a task object now I
need to save it somewhere so let's take our tasks hash and save it by its name
just like that
what what
I wrote you twice
oh thank you
this is why we pair this is like super pairing or something
ok so let's create our cast thing here and I need to construct it takes the
name the dependencies and the action block and just stores them off
I'm going to want to have a method called execute execute is very simple it
just takes the action and calls it as action is just a block and spend it's
anonymous function just going to call it like that
and now i need to write and vote votes a little more tricky i see at task should
never execute twice
so if it's already run lets you know you invoke its already run
we're done we have to we can return immediately so we return if already
there we go already run
um so if we get this far that means it hasn't run yet we have to make sure all
our dependencies are invoked so depths each new depth and i would like to say
depth invoke but that's not quite right because death is the dependencies are
names so i have to look them up first so i have to look them up in the tasks half
like that fortunately I have that available and after all my dependencies
are invoked i can go ahead and just execute our current task and mark it as
already run
we're almost done the only thing we need to do is right here we just groups need
to require the tasks file like that
28 lines of code let's see how close I got a harder heights
i sat down at my desk and I thought about this i said this is easy actually
I need a list of dependencies I need to iterate through them i need to evoke the
recursively and that's really all there is
so I took about half an hour I did this in about three minutes took me about
half an hour the first time i did this and i sat down i emailed it to Ryan and
I ran over to ryan's desk so check your email check your email check your email
and he pulled it up and there was an innocent i think it was i think i had
about 50 lines in my first implementation and there was 50 lines
all of you know the basic core logic of rake right there and and ryan gloat over
we were all in service cool and then I go but yeah but it's not really make
because make will check timestamps on the files and only rebuild files if
they're out of date with respect to their dependencies and this was more
like a man it just does tasks regularly
I thought at that file that file testing thing that'd be hard no one would ever
do that
I went back to my desk and about 20 minutes later I subclass task as a final
task at a manatee check in there to see if it's out of date was response with
respect to its dependencies and I had a file task of thinking they're so within
and under an hour's worth of coding I had the first version of rake out there
running now of course there's a lot more Drake today there's file this there's
there's all the shell commands at work there's a lot of little things that help
you get a break like stuff done but this is the core and this is it
that's all in twenty eight lines of code right there
a friend of mine who was a started using Ruby because of my great enthusiasm for
it he said yeah Jim I was i tried to solve a problem in Ruby the other day
and I just started writing code and I was done before I realized it
that's kind of how it works ruby is so good at expressing what you as a
programmer want to express it really matches the way I think very closely
ok lips get all i got was the code in there too so funny lines of code
about half an hour efforts you got the basic core engine in there and what we
didn't do is file task
this was awesome this just goes to show that ruby was really good at expressing
a capturing ideas very quickly
next story we have to speed up just a little bit
the beautiful testing are as i like to call this section designed by conference
I was at the ruby hoedown in 2009 you guys know what a hoedown is you have
bowed down to here in every way as kind of a southern thing in America right
it's kind of a party to dance it's a kind of up you know
good time Party well the Ruby hoedown
that's where we get together and talk about Ruby and it's a it's a lightweight
conference it was free
it's close to where i live in in in ohio and so a lot of us from edge case we're
educating the time we would all pile in about two or three vehicles and we drive
down to Nashville Tennessee where the hoedown was being held and we all attend
a conference this is almost kind of like a little mini vacation for us here you
can see we're all gasp this is at one of the tables at the hotel
it looks like we're in Florida because there's palm trees this is actually
indoors in the hotel is huge huge monsters hotel
um but during the conference we SAT around tables much like this at the back
room of the conference area and we kind of talked amongst each other cuz you
know we were kind of laid-back none of us were presenting that year we were
just enjoying the conference and someone got up to give a talk on cucumber
many people use cucumber hear anybody you
I I have a love-hate relationship with cucumber but the thing I love about it
is the fact that lays out your testing as given plan and then I really really
really like that way of specifying my tasks as these are the things that are
given when I do this code then I expect this thing to happen and i would lay out
my test in this format anyways kind of informally but it was really looking for
a more formal way of specifying given when then
in my tests so I was set in the back room and I was taking all of all this I
grab that a notepad
I started writing on the notepad notice house so many ideas it's kind of start
scribbling down on a piece of paper and i said i started pushing this paper
around the table where we were all sitting
I said does this make sense to you if I if you saw test in this format would you
understand what's going on and the feedback I got was more or less positive
everybody felt that by looking at something like this you could kind of
tell what was going on even knowing nothing about the given when them
framework you can figure out what was going on so I would kinda got positive
feedback on this except for my boss
because at that time the test unit vs many test versus r-spec versus something
flame wars were still going strong and there were so many testing frameworks
for Ruby Jo really didn't think we needed yet another one and I assured him
know Joe I am NOT going to actually write this
I'm just I'm just brainstorming ideas
I lied so I wrote a library called given that was based on test unit and this is
a example from the get help page is still out there
don't go and use it I there's something better than this but this is my first
path at this and this couple things I'd like to point out about this code first
of all I added the idea of an invariant and invariant something that is always
always always true no matter what you do to this object in this case i'm saying
if you've got a static object it is always true that the stack depth is
going to be non-negative
it's always true that if the stacked up to 0 then empty will be true and if
empty is false then the stack depth will be something other than zero these
things that are always true about a staff and then I write it up the rest
the test into this I said given an empty stack and so given this method so I had
initialization our setup procedures by name you had the name that setup
procedures in the given statement and then you went through several tests so
this is actually three tests right here
an empty stack the empty stack you expect the stack to be 0 when you push
an item you expect the stacked the depth to be one of the top to be that item and
when you pop it
you should get some kind of failure error now this was ok
I kind of liked it but I was a little uncomfortable with a couple things I
didn't like I didn't like this fails with thing this was just pure ugly this
exception thing popped up by magic and I that was felt weird to me
didn't like the fact i had to say expect expect expect arm
although i was doing this in test unit i didn't have the . should that our spec
users i might have used that here but I didn't like doing that a whole lot so it
was ok but just not quite what i wanted wanted the next year i was at another
conference which was Ruby nation this takes place in the in washington DC the
capital of the u.s. there and at this conference
John lark house key was giving a talk on pure arse back at the time I was a test
unit guy i use testing it to write all my cast and I respect was ok but i
didn't use it that much but he gave this talk arse back
pure r-spec in fact if you want to go see his talk
he's slider right there at that URL um and at one point he got to this slide
right here
he says r-spec has this thing called left
if you say let this name be this block left is a lazy initializer when you call
when you reference that name the first time in a test it goes out and execute
that block and assign the value of the block is the value for that name
so here blog post gets assigned a new blog post every time it it gets
reference for the first time is referenced in a test and a if you break
this down it's essentially this code that last statement is writing a lazy
initializer method that does this when I was kinda cool and I realize also that
this really interact well with our specs block nature you have nested described
in context blocks in r-spec and this essentially turns into this where you
have a class here
the left turns into a method the example is here and so this actually inherits
from the outer examples of this version overrides that version so you can
internally override decisions you made outside and that works really really
nicely with the structure of our spec so I rewrote our spec are we
given to use our spec and it turned out to be something like this and i really
really like the way this
this reads here we'll go through this fairly quickly
so given a stack stack new given the initial contents of the sack and I
defaults to being empty the initial content and then we load up the stack
with the initial content here in this given so here these Gibbons are
essentially left this given here is essentially a before I kept invariant
and notice there is no longer and expect or should on that this returns either
true or false
and our suspect given is able to determine what the error is if it fails
and gives you a nice error message in a second here is an empty stack with
initial contents that stepped is this
when you push these things are true when you pop it should have failed
much like the test we saw before here's a stack with several items so we
override the initial contents to be this the original depth we record and so
after you
you know you do some pushing you do some popping and these are the things that
are true
once that's not this reads beautifully this reads like a specification this
I love this I love this is just about everyone I showed this to sit yeah this
is kind of cool they really really really like a writing their respects
the nice thing is supposed to change this to be a - so this fails if you do
that you get this kind of error message where it tells you we expected one to
equal zero and then it breaks down the these expression that failed he gives
you the stack depth is one the stack object is this the original depth - 20
the original depth itself is too so it breaks down each fabric expression and
the thing that failed and gives you all the details you need to debug like that
thing is failing so beautiful
output from a beautiful testing framework so summery sometimes ideas
mature slowly their synergy in things like the nested nature and the given run
then of our spec
and you get aggressive readable test out of this
i'm almost out of time but we're gonna go real fast flying robots is our last
this ties into the video i put at the front
so this is the ar.drone that you saw flying this is in the outdoor mode where
it doesn't have the car bumpers on it
it has cameras it has all kinds of sensors that allowed to do interesting
and the best part of it is that it talks to you over Wi-Fi and the entire API is
open and you can see exactly what's going on and there's a developer guide
in PDF in the entire API so it looks something like this
there's a command stream that goes to the drone it sends back navigation data
and video data navigation data with something like this you send that text
command so trivial to write this and Ruby
you have to send it a sequence number you send that things like take off flags
and emergency landing flags you give it information like roll and pitch and
altitude in and yah you send all that information to it you can send it
configuration players like set your lights to be this are do some particular
video targeting and here's a program written in a library called Argus it
creates a drawing object starts it takes off turns right 45 seconds turns left 45
seconds then hovers and lands
turn right
five seconds to the left 45 seconds covers and lands
here's another one
this will take off and go through a loop go left and right 2 times show you the
code here just so you believe its program hit the return is a five-second
delay i run over the other side of the office
this is me running right left right left
lay on a hover and land the first time I tried programmatic control of of moving
I said go forward one and one run right into a wall
ok maybe one is not the best let's do . - so navigation coming back from the
drone is a lot trickier work
the stuff going to the drone is just simple text commands coming back is
actually binary data it has a fixed length header that's about four
uh I think it's for 32-bit integers have come back at the header
it's got variable-length options navigation data and vision detection
data are the two options that I'm interested in particular there
variable-length they're packed and they look like this
this is actually from the structure of the C code from the API arm
that means to decode this stuff I've got to do weird things like one packet with
weird commands and the unpack command and then know exactly which array
element references that particular data and then they have to do like some
floating point decodes on the floating point data that comes back and it's just
so I want to do that so I wrote some code that looks like this
this is Ruby code that one
a lot like the C code we're just missing
we added a semicolon at the beginning of the name and we remove the the added got
out of the colon to be getting the name removed the semicolon and it is now Ruby
code so i could take the header pasted in my Ruby do minor text editing on it
and now I have something that allows me to access that data
so this line says one packet with a capital V and the name of that data
position in the array is beef be bat flying percentage of the battery
percentage left
this one says I'm packet was be decoded with the decode folk command and then
all that one theta so i can do this with all the options there
here's i'm going to skip over this is not that important but here's another
program that says when this is a call back
and this is called whatever the drone sends me a binary data package and it
says okay go through the data options for each option check to see if it is
the nav option vision detection
so the drone tells me when it sees a particular target in its camera sites
and tells me the position in the camera where that is
it's about a thousand pixels wide so for 500 were on target
if we're above 600 i want to turn right
if it's below 400 i want to turn left
so we blink the lights we take off and i'm going to
i am holding the output hall and that orange and yellow pattern is what the
camera detects
too fast
there we go ok move slow it can find it it's not real bright
okay so there we go
and there we go so it's turning and following the pattern
we're doing some more stuff with this we're not done with us what I what I
want to do is be able to have it following put a hat with that pattern on
it and walk down the hall
I just have a drone follow me wherever it goes
turns out that's a lot trickier than just having it turn and look at you
the first time I did it I had a bug in my advanced you know advance for backup
logic and it 0 definitely a target like just murdered act me
so we're going too slow on that part
alright so summery
this is real time programming I have to send that drone come in a committed
every 15 minutes seconds or so just so it doesn't lose the data stream
otherwise will shut down and cover and land
i'm using threads although I want to switch around to use celluloid an actor
pattern in the near future there is a library called are to that allows you to
talk to multiple robotic type devices one of them being the drone another
being like us
have you seen the spirit robots the wrong robot that are colored and just
roll around and control those with the art to library to check that one out
this library i'm using to control the drone itself is called Argus
yeah so again being able to write expressive code I could take that C code
put in my ruby code and exactly map to the exact data that was in a binary data
and doggone it this stuff is fun
so features and benefits you saw some of the features but the benefits of rubies
that I see it's easy to learn you can be up and running on Ruby really really
it's extremely expressive its ass what you want to say in your code
it's flexible you can write it you can handle see data structures with it you
can get to a working prototype really really fast with it
it's easy to change and doggone it I sink reviews fun
I'm out of time but I'm Jim Mora can do
thank you

No comments:

Post a Comment