Robots

July 15th, 2010

I’ve been building little robots for quite a few years now, but my main focus has always been BEAM Robotics. Things have slowly been changing over the last year though. I started out by ordering some PIC microcontrollers, and while I managed to do a FEW things, I found myself hating them after a while. The problem with the PIC is that the only easy way to program it is through windows, and everything else is just annoying. Personal opinion maybe? In my defense, the programmer I had only allowed for a serial connection.

Everything changed though, at a recent Maker Faire. I picked up one of the new Arduino boards and a Getting Started book. After I got home, I was up and running within just a few minutes. It’s pretty amazing, actually. The Arduino guys have really done a great job in making a microcontroller that you can really use.

Anyway, back to the robots. I was recently at the local CVS and noticed a tracked, amphibious, R/C car. I bought two. I don’t know about anyone else, but if I show up with a shiny new toy and tell my son that it’s mine and I’m going to take it apart, it’s a little disappointing for him. So I took it apart pretty quickly and this thing is pretty cool on the inside. Everything has a rubber seal so that water can’t get in, and I really like the way it’s constructed. That being said, I had to open up BOTH of them to switch the motor wires… the factory managed to wire them in reverse. I guess that’s what you get for $14.99!

So I removed the top, and then went to work on getting rid of the excess electrics and plastic. I decided that there wouldn’t be enough room to mount everything I’d like, so I started modifying it to allow for a better top. But what top do I use? I looked at some hardware stores for the material that would work, and I figured I’d just build something custom out of balsa, when (tada!) I found an altogether amazing alternative. I have an old tupperware bowl that was meant for organizing or somesuch. The lid didn’t attach like a normal sealed container, but rocked back and forth. So without the lid, sitting upside down, it makes a great blue translucent cover. Sweet!

Next design move: I suddenly realized that I had an old NSLU2 sitting around that I don’t use anymore. The possibility of having a robot that actually runs Linux was almost too much for me! Whoa! Unfortunately, it wasn’t as easy as that. If I’m going to have Linux on board, I also want WiFi, and Python, and… a webcam, and… anything else I can cram in there!

SO… here’s the plan: I’m going to have an Arduino running as the interface for the motors and sensors, connected to the NSLU2 through USB. The NSLU2 will have Python running, which will act as the brains of the system. I’ll have a webcam and some sensors – I’ll probably start with just infrared range finders at each corner. Python will talk with the Arduino and make decisions based on sensor data, and will send movement commands to it. I’m thinking I’ll either setup an H-Bridge for the motors, or I’ll use some old servo boards that I have laying around.

The second phase will be to build out some software to all for getting telemetry and controlling the robot when it’s not running autonomously.

So much fun, right? I’ll update as I make progress!

Crazy-Cool Barcodes

November 12th, 2009

These are the coolest barcodes ever. I wish I made a product that I could put these on.

Martian Photos

November 8th, 2009

These photos taken by the MRO are nothing short of amazing.

my first instructable

April 13th, 2009

Those that know me know that I’m a bit obsessive about creating. I love to build things, and if I go through a week without flexing my creativity, I really feel like that week was wasted. I’ve always assumed I’m a bit odd in that respect, but I’m not really sure. Given the amount of interest I’ve seen in Make: Magazine and their wonderful Maker Faire, maybe everyone out there is just a closet creator.

Anyway, because of my love of creating, my projects tend to hover somewhere between concept and almost finished. I’ll start on one, and then move to another and another before it’s done. My workbench is as you would expect… covered with gadgets at various levels of completion. With one of my latest project though, I decided to push through until I was finally finished with it. Yesterday I decided to finally just call it good (and stop tweaking it) and post it on instructables.com. So without further explanation, here you go: my first instructable.

Hopefully there will be many more to come. :)

python regex

March 25th, 2009

I don’t know why, but I never knew about the grouping that was possible in Python’s re module. I’ve been using Python this long and suddenly realize it’s there… a true facepalm moment. Anyway, how’s this for cool? -

[code]
import re
string = "S03E12 - A random filename"
print re.match(r'.*S(?P\d+).*E(?P\d+)', string).groupdict()
[/code]

Homemade steadycam

January 21st, 2009

I really like what this guy did to build a camera stabilizer out of what he had lying around. Exactly my kind of handiwork. I might try to make one myself…

stupid OS X…

November 13th, 2008

I recently started using a shiny new Macbook Pro at work, and I’ve mostly been in love with it. So much so, that I really do prefer the thing over Gentoo now. It’s just that things are so much easier. And hey, the prettiness isn’t anything to cough at.

There remains two things that annoy me to no end, though:

1) The hideous, insidious, freakious (?) lack of mouse tracking. Yes, I’ve read all of the writeups on why it can’t be done, and I’ve tried a few of the programs that claim to make it work, but none of them are really good fixes. They’re just… so so. I really wish there was some way to make it work. :cries:

2) That you can only resize a window with a tiny little handle on the bottom left corner! I came to the Mac from the wonder that is Enlightenment. I could hold alt, middle click, and resize from any region of the window. Now I KNOW this isn’t a problem with the way Darwin works. There are no logic issues. There’s nothing stopping Apple from doing it, other than a lack of time or pressure.

sigh.

One can still dream though.

Crazy idea

August 5th, 2008

Ok, this may sound like a totally stupid idea, but I was contemplating just how hot it is out here, and how much I don’t care for it. :)

It occurred to me, what if we used the temperature in the deep earth to help alleviate it? For instance, we all know about underground houses, how they sustain their temperature even when it’s extremely hot outside. I was watching a documentary the other day about an entire village in Australia that is built underground. So obviously the ground underneath us is cool – is there any way to equalize the temperature between the surface and underground?

Ok, the next part of my idea came from when I was growing up. My family was in a 2 story house, but we didn’t have air conditioning. Instead, we had this enormous ‘water cooler’ in the kitchen. It consisted of a squirrel cage fan about two feet in diameter and a radiator that the air blew through into the house. It was loud, but it did it’s job – it kept the kitchen at a manageable temp while my mom cooked. Eventually though, we were forced to get an air conditioner to take care of things. Why? Because a housing addition just down the street moved in. Their air conditioners, transferring heat to the outside, significantly raised the temp about a tenth of a mile away. It was rather surprising.

So you can probably guess where I’m going with this… Is there a way to build an enormous cooling system that uses water pumped down to a sufficient depth to cool the outdoors?

Bear with me here… We would start with a cooling tower that would hold a radiator for air transfer. It would be big enough to make a difference, but not so huge that it’s an eyesore. A ground transfer unit would be buried deep below. A pump would be used to constantly circulate water through the entire system.

The tower portion wouldn’t have fans on it, ideally, so that it was quiet. So we would rely on wind to take care of distributing the cool air. These towers would be installed throughout an area with the intent of specifically bringing down the temperature as a whole.

So I’m curious what you guys think. Silly idea, or does it have legs?

music management

March 6th, 2007

After making the switch to linux full-time, I needed an easy way to convert my old music collection to mp3s. Yes, yes… there are the DRM’d files from my purchases on iTunes, and I won’t go into converting them. Otherwise, I had some files in mp3, and quite a large amount in m4a. It’s fairly easy to do the conversion in linux, but it can get tedious if your library is huge. Here’s a little shell script I wrote to parse a given directory and convert mp4s easily. I hope it’ll be useful to someone!

You’ll need faad and lame installed, natch.


#!/bin/bash

find /media/music -name '*.m4a' -print0 | xargs -0 -I {} bash -c 'FILE=`(echo "{}" | sed -e "s/.m4a//g")`; faad "$FILE.m4a"; lame -h -b 192 "$FILE.wav" "$FILE.mp3"; rm -f "$FILE.wav"'

exit 0

the wonders of vi(m)

January 20th, 2007

Ever since I started using Linux, which at this point was about 10 years ago, I’ve used the Vi editor. It was included as the default editor for most distributions back then, and it was really all that I was accustomed to. The usually cryptic commands make it pretty difficult to pick up, and I think that difficulty is why many people dismiss it so much. If you give it a try though, you’d be surprised at what you can do with it.

An article recently at The Register gave some interesting background. Essentially, Vi was made to be usable over a 300 baud modem. At that speed, even small commands are burdensome to type, and screen painting is horrendous. So the small, one-letter commands in Vi had a specific purpose – speed and efficiency.

So that begs the question: In the age of high resolution and broadband, why would anyone in their right mind still use an editor from 1976? The answer, to be honest, isn’t an easy one. Like I said, I personally started using Vi when I didn’t know of any other choice. I learned three commands… ‘a’, ‘:q’, and ‘:wq’, and that was good enough for me. Those commands allowed me to edit any file I needed to edit on my Linux boxes, and I could do it quickly. As any Vi user will attest, once you learn the very basic commands, you find yourself using them everywhere, even when you’re not using Vi. I think it’s because they are SO easy to use, they just make sense.

At this point, I suppose I should start saying ‘Vim’, for fairness. Vim was created to give a user the power of Vi, but extend it to add many cool features. The abilities of Vim are a surprisingly long list. Most anything you can think of, Vim can manage it, and it still remains a text-based editor. A GUI exists for it, sure, but I honestly know no one who actually uses it. :)

These days, I’ve had the wonderful chance to use Vim in my every day work, and I must say, I love it. I keep 3-4 xterms open all day long, and Vim runs on all of them. Something I’ve noticed is that like Linux itself, using Vim every day allows you to learn some incredibly useful shortcuts that you may never have seen. That’s my reason for writing this article… to educate those Vi users who only know the most basic commands, and to also help cement some of the useful shortcuts in my brain.

First, my (most recent) .vimrc file:
[php]
:colors slate
:hi Normal guifg=white guibg=black
:hi Search guibg=#224488
:hi Visual guibg=#111144
:hi DiffAdd guibg=#003311
:hi DiffChange guibg=#222222
:hi DiffDelete guibg=#110000
:hi DiffText guibg=#AA1100
:set guifont=Bitstream\ Vera\ Sans\ Mono\ 7.5
:set guioptions-=m
:set guioptions-=l
:set guioptions-=L
:set guioptions-=r
:set guioptions-=R
:set guioptions-=T
:set softtabstop=2
:set tabstop=2
:set mouse=a
:set number
:set expandtab
:set shiftwidth=2
:map :noh
:map :tabnew
:imap :tabnew
:nmap :tabnew
:vmap >gv
:vmap :vmap zf :set foldcolumn=5
:nmap zo
:nmap zc
:nmap :set foldcolumn=0
:map :noh
:map :s/^/\/\//:noh
:map :s/^\/\///:noh
:map :vert diffsplit =expand(“%:h”)/.svn/text-base/=expand(“%:t”).svn-base
:map :q:diffoff
:map :syntax match Character “\|”
[/php]

So some very useful things any newbie should know…

The ‘/’ character, in command mode, starts a search. This search accepts regex, and can be global or one line. So the simplest use is to simply type ‘/something’. That command highlights every instance of the word ‘something’ in the file. While still in command mode, typing ‘n’ will go to the next search result. Quick and painless, right?

The search and replace syntax is pretty standard. The replace the abbreviation ‘NY’ with ‘New York’, simply type ‘:s/NY/New York/g’. That will replace it on the current line only. The expand it to the entire file, just add a ‘%’ in front of the s: ‘%s/NY/New York/g’. Pretty simple, eh?

Here’s something that’s cool… split screen editing of the same file. Hit ‘Ctrl-w s’ and you’ll now have two copies of the current file on the screen. Do it again, and you’ll have three. ‘Ctrl-w c’ closes the current split. If you use the ‘mouse=a’ setting, clicking will switch between the different sections. Otherwise ‘Ctrl-w uparrow/downarrow’ will do it. There’s a surprising lack of split-file editing capabilities in editors these days. Enjoy it!

Did you know about Visual mode? Hit ‘v’ in command mode and use the arrows to highlight lines. You can then use ‘d’ for delete (like the ‘cut’ command), ‘y’ to yank (like the ‘copy’ command), and ‘p’ to paste. If you have the ‘mouse=a’ setting enabled, click-drag will automatically enter Visual mode. So it’s a quick clickdrag-y-click-p to copy and paste text between two places in the file. While you’re at it, highlighting a chunk of text in Visual mode and hitting ‘<' and '>‘ will tab/untab the block. 2007-02-02 – You can also hit a number before you hit ‘<' or '>‘ to tab that number of times.

One thing I like to do is store commonly used methods in regular text files. If I need those methods, I can insert them directly into the current document with ‘:r filename’. That reads the entire file in and places it wherever your cursor was located in the file.

If you don’t like the default colors that Vim uses, you can modify them. Take a look in /usr/share/vim/vim70/colors. Those are the default color schemes that come with Vim, and you can use them with the command ‘:colors [colorfile]‘. You can also just use them as a starting point and include custom color commands in your .vimrc file.

I know there are more things that I do in Vim that I can’t think of right now, so I’ll come back and update this article now and then. I hope at least one or two of these functions were unknown when you started reading. If you’re a Vim master and you’ve read this fafr, what are your favorite features? Please leave a comment!

Added: 2007-01-22

“$” means ‘end’. It can mean the end of the line, or the end of the file. Typing “:$” goes directly to the last line. And on the subject of moving around in the file, use ‘:’ and the line number to warp directly to a specific line.

Added: 2007-02-03

So recently I’ve started using (gasp!) Gvim, the ‘GUI’ for Vim. The thing that sold me on it wasn’t so much the GUI features (I’ve disabled them all) but the font rendering features. For one, you can use true-type fonts, rather than being stuck with the one in xterm. The other thing though, is that it does AA on the fonts, which means dot values! So I’m now using Bitstream Vera Sans Mono 7.5. It doesn’t seem like much, but try that in an xterm! :)

While I’m here, I’ve started using yet another feature. While in insert mode, with mouse=a enabled, double-click on a word. It enters visual mode and highlights the word. Now hit ‘d’ for delete, and it deletes the word and returns to insert mode.

Also, instead of using the method I detailed above for split-screen editing, I’ve started using :split and :vsplit. This allows you to split the current screen up quite a lot. Then, while in one of the split frames, type ‘:e path/to/file’ and you now have multiple files open in the same window. That was HUGE to me! And since they’re all within the same session of Vim, the copy/paste buffer will go between all of the files. That rids me of the need for the mouse=c functionality. Woo!

Added: 2007-02-13

It’s funny how your methods change over time. The amazing thing is how often I find new ways of doing something in Vim. I explained somewhere above how to use Visual mode. Basically, if you have mouse=a set, you can just highlight characters and you’ll automatically be in Visual. Here’s something cool though: try moving your cursor to the middle of a line and hit Ctrl-v, then use the down arrow. You’ll notice that instead of highlighting the entire line, it allows you to highlight a certain character region on your screen. This is Visual Block mode. Imagine if you had two columns of text and you wanted to move the second column a couple of tab stops over… Just put your cursor at the beginning of the column you want to move, Ctrl-v, down arrow to the end of the column, and then hit ‘>’. Neat, eh?

Sometimes you need to replace characters in a certain chunk of code, but not the whole document. Using either Visual or Visual Block mode, highlight the area you want the ‘replace’ to affect. Then you modify the normal pattern “:%s/something/something else/g”, adding “\%V”. So to replace ‘Yay’ with ‘w00t’ in a Visual area, you’d use “:%s/\%VYay/w00t/g”. Easy as Pi. ;)