Archive for the ‘MathWorks’ Category

7200OTAnother trip, another book (and a bonus deal)! Remember that Maker Faire Demo and all that image processing? I relied heavily on the Image Processing Toolbox in MATLAB and I thought I would share a good resource I came across.

Visual Media Processing Using MATLAB by George Siogkas is a good introduction to the Image Processing Toolbox. It starts with a brief overview of the MATLAB UI and then digs right into opening and displaying images. The book goes a good job of presenting processing logic and then code to execute that logic. I was able to quickly follow along and execute the same commands. After Siogkas does a few commands, he looks back at the code with a really helpful section called “What just happened?”. These sections are very helpful as they provide a different look at the code you just executed. I have found myself referring to these section and the preceding examples over and over. Each chapter contains several subtopics, so having these review sections is a good way to break things up and ensure you know what you’re doing. Also these sections tend to have big, bold headings, making it easy to find glancing though the book. (Which is more common for me while working on a project.)

The book is sort of a cross between a textbook and tutorial. Each chapter ends with a review quiz, but unlike textbook, this is not designed to be a drawn out homework assignment. Also unlike a textbook, the author takes on a more tutorial tone with very well thought out examples in which he guides you though each step. Like a textbook though, each chapter ends with a listed summary of point covered. I generally find summary sections to be sort of vague, but if it helps you, it is there. (The author lists things accomplished like “How to create …”, “How to isolate and expand …”)

Overall I really liked the book. It is a great reference and a good way to get start in MATLAB. You can find it on amazon or though the publisher. Speaking of which, that bonus deal I mentioned… Packet Publishing is having a holiday sale. You can click the banner below or follow this link. The deal is $5 for any ebook or video from packet now (December 19th) though January 3rd. A few of the books I have review come from Packet, so it might be a good way to pick up some books for the new year on the cheap!

782x300_Main_banner

Advertisements

Remember that Maker Faire demo I posted about a few weeks ago? Well as promised here is Part 2! This time I dive into the new features I added for the demo. The video format is a bit strange in that it presents a PowerPoint, but that was a requirement for a class. I ended up leveraging this work for my image processing class this semester.

One of the easiest ways to make a demo interactive is to kid a child a maker and say draw. That is exactly what this demo does. As the child draws, the robot or swarm will follow the line. I do some image processing to find the line. The first step is to reduce the search area. This is a huge time saver when it comes to processing and removes many of the issues of shadows or various markers and body parts the camera may see. Then it does a search in this region of interest (ROI) and looks for where the line intersects the ROI.

I tried to keep the new feature as streamlined as possible to avoid the issues of degraded performance. Image processing can be quite processor intensive. Since the code was already doing a lot of processing to get to this point, I wanted to ensure that any further enhancements did not add lag.

There is always room for improvement and one of those areas would be actually projecting the line to calculate the intersection. This would probably help for the cases where the line does not intersect the edge of the ROI, but that is a feature for another time. Check out the video for more details. It came together really well!

1386EN

As some of my readers know, I am in Denver at SuperComputing ’13. It has been a crazy week, but traveling also affords me some time to sit back and read. On the flight over I finished reading Getting Started with Simulink by Luca Zamboni. Overall this is a very good introductory book into Simulink, but it does require some mathematical background to truly understand what the author is doing.

Like LabVIEW, Simulink is a graphical dataflow environment and requires very little text code. For many, this approach to programming can be quite easy and improve productivity; however you need to understand how datalfow works. The author begins with a simple cruise control model that leverages a PI controller (more on that later). Like many systems that interact with the physical world, it maps well to dataflow. The author does an excellent job of stepping you through construction and testing of the  model. He even mentions some good shortcuts (like how to reset the zoom, a shortcut that I learned while reading this book).

Like any good tutorial, the Getting Started with Simulink builds on previous examples. Once you complete the first example, you build a model for a car. This exposes the user to simulation, one of the key advantages of Simulink. The book builds quickly and at first it seems like Zamboni is throwing everything but the kitchen sink at you. He really does challenge you, but Zamboni is there to step you through each step of building the model. From creating subsystems for for motors to simulating drag. The model is a very complete representation of a sports car and by the end you feel very accomplished. Best of all, you have actually mastered most of the skills required for Simulink. I would say this book covered 90% or more of the blocks that I commonly use. Another key aspect of the book is that it uses an up-to-date version of MATLAB and Simulink (2013a). While the basic concepts don’t change with time, features are sometimes tweaked or new file types supported. Zamboni does a great job of pointing out many of these minor differences. He really is an expert in the software.

Now about math and that PI controller. Well to be honest, the PI controller was just the first math-heavy aspect of the book. The model for the car does get kind of math heavy, but that is very much the nature if many models. While you don’t actually need to understand the math to follow along and complete the models, but it certainly helps. If you’re an engineer or engineering student, then chances are you know physics and calculus. For my non-engineering readers, don’t feel like this is a deal breaker. The author does explain what is going on, but probably not in the detail that you would like.

One other thing to keep in mind is that this book requires no hardware (no MINDSTORMS, no camera, no motors, nothing). So if you plan on interacting beyond simulation (given simulation is one of the big features of Simulink), you will have a bit more learning to do on your own. Personally, I think you should start in simulation, and once you master that, move to hardware.

Overall I would recommend this book to any reader. I know there are quite a few people out there that are just getting started with MATLAB and Simulink for LEGO MINDSTORMS. This is a great first step in mastering the environment. The book is available on amazon or directly from the publisher. The book also is available in ebook form for your tablet or Kindle.

1386EN I have been working a lot with MATLAB and Simulink lately. For both my academic work and fun. If you recall the MATLAB demo I took to the Orlando Mini Maker Faire, you know that Simulink is an important part of that project. Simulink works really well for LEGO MINDSTORMS as its dataflow paradigm maps nicely to robotic interactions. I have actually been working on a tutorial to get people started with LMS and Simulink (hopefully will be posted in December or January).

So why the picture of the book? Well I love having a good reference for my work and I am currently reading this book. I will be writing a review for Getting Started With Simulink by Luca Zamboni next week, but  so far it has been a really good resource. It might be worth checking out if you will be working with Simulink. The book assumes you have never used Simulink and gets you up and running, very quickly. Check back for the full review next week!

I am happy to share Part 1 of the demo I took to the Orlando Mini Maker Faire. This video covers the basics of what The MathWorks provided me. As you can tell by the video, it is somewhat dependent on lighting. But let me describe what the base demo does.

WP_20131005_001

The setup is 3 NXT robots running Simulink code that communicates with my computer. There is a camera positioned about 6 feet above the robots. Each robot has a unique pattern that can be seen by the camera. Using this pattern we can determine the position and heading of each bot.

The demo tries to get the robots to form a triangle. The position of the triangle is determined by the user. The robots will follow the triangle as the user moves it.  Check out the video above to see the tech in action! While the video was shot in my apartment, the picture, right, was from the Orlando Mini Maker Faire.

Now I love sharing cool tech with people, but I also love to put my own twist on it. What if we made the demo interactive and allowed kids to draw lines? One might think a robot or a group of robots might follow that line. One might also thing that adding more lines of different colors might allow different robots to follow different lines. Of course that is all speculation.  Maybe the photo below will be a helpful hint. 😉

Part 2...

WP_20131005_008This past weekend was the Orlando Mini Maker Faire at the Orlando Science Center. I am not sure of the final attendance numbers, but I was busy the entire time. I brought a total of 15 robots to display. Naturally I had the Shuttle and segway bots, but this event featured a new NXT project in partnership with The MathWorks, makers of MATLAB and Simulink. The video will be coming (due to poor lighting at the event, I am having to shoot the video at home) but the project features control of the NXTs from MATLAB. Navigation is done by processing the image from a camera positioned above the bots, as you can see in the first picture. I will go into more detail soon, but The MathWorks provided a good foundation for the demo and I then added a few enhancements. The code running on the NXTs was written in Simulink and the image processing and control as in MATLAB. The bots communicated with the computer via Bluetooth. I was able to demo both the example The MathWorks provide and my enhanced version, but since the lighting was spotty, I was only able to do it once. (It was very sensitive to people walking by and casting shadows from the overhead lights.)

WP_20131005_001I also brought a long a few EV3 bots. I had a couple of ‘kit’ bots that were built with the instructions (EV3RSTORM and a robotic arm), but I also decided to make my own flyer stuffing robot. I will save the details of that bot for another post as well, but it is safe to say it was a hit with every one in attendance. You can see it right on the corner of the table in the picture below.

WP_20131005_003Below are a few more pics from the display. Everyone really seemed to like the interactive display. Other members of my LUG had displays that ranged from a trick or treating street, motorized technic models, and a BrickPi. We really had a nice showing and attracted a ton of attention.

WP_20131005_002WP_20131005_005WP_20131005_007I look forward to the next event, although I might need to scale it back a bit. 15 bots was crazy! Plus, I wasnt able to bring a few of my other projects. Stay tuned for more updates. I have quite a backlog and I hope to be updating them soon!