Finally finished the zombie crawler. Based on this guy’s design, I used two windshield wiper motors, two ESCs, a transmitter/receiver combination, and two RC batteries. Those Li-Poly batteries are something else – 3.7A for an hour of use, packed into a tiny package. Awesome stuff. Anywhere, here’s Bartok, the first segment of my upcoming demo reel:

And if you’re wondering, yes – I sell these.

This is something I come across from time to time, and it seems that the procedure is a bit different than it is for Linux, so I thought I’d save the process that I found works (if only so I can find it again later myself.)

Edit ~/.bash_profile (this way you only screw with your own PATH, and no other users’. Say you need to add “/Applications/Graphics/Pixie/bin” to your path, as I did (seriously, getting Pixie to work on OS X is proving to be a massive headache). Let’s also say you need to edit your DYLD_LIBRARY_PATH (Mac’s equivalent of Linux’s LD_LIBRARY_PATH) as you may need to for Pixie. Add the following lines to the end of the file:

export PATH=”/Applications/Graphics/Pixie/bin:$PATH”
export DYLD_LIBRARY_PATH=”/Applications/Graphics/Pixie/lib:$DYLD_LIBRARY_PATH”

Save it, and enter

source ~/.bash_profile

in your terminal to make the change effective immediately. This should do the trick in 10.8 Lion. Pixie’s install instructions mention some nonsense about “DYLIB_LIBRARY_PATH” for the Mac – ignore it. Seriously.

There is a deplorable lack of info on the web about how to do this without an Arduino; that is, via hardware only instead of software. Thus, after much blood, sweat and tears, I hope to save others the same trials. Read on:

Power the Wifly. Make sure it’s powered with 3.3V, not 5. When connecting for the first time for setting up an ad-hoc network, jump pin 8 to pin 1 when powering up. The red, green and yellow LEDs will blink quickly.

Open your wireless manager and look for an ad-hoc network named something similar to “Wifly-GSX-9f.” Try to connect to it. You may have to edit the wireless connection IPv4 settings to reflect a “Link-local,” rather than a “DHCP” connection. Try to connect again.

Once your computer has connected to the network, open a terminal and type the following:

telnet 169.254.1.1 2000

169.254.1.1 is the default IP address of the Wifly unit, and 2000 is the default connection port. It should connect almost immediately, greeting you with

Connected to 169.254.1.1.
Escape character is ‘^]’.
*HELLO*

Enter

$$$

and press ‘Enter.’ The unit will respond

CMD

Type:

set ip address 169.254.1.1

The unit will echo the command and respond with

AOK
<2.32>

Now type, one after another:

set ip netmask 255.255.0.0
set ip dhcp 0
set wlan ssid my_chosen_ssid_name
save
reboot

Now disconnect all power from the Wifly, reconnect it, and try to telnet to the same address (169.254.1.1 2000) again. You should be able to connect without any problems. If you disconnect from the network, remember that you have now renamed it, and you need to look for your chosen ssid, not “Wifly-GSX-XXX.”

At some point in image processing, you may want to see image edges on a live basis – for OCR, perhaps, or just because it looks kinda cool… Here’s an nifty little bit of C code (now somewhat deprecated) that will convert a live stream from a webcam to a black-and-white, edge-illuminated image.

#include <cv.h>
#include <highgui.h>
#include <stdio.h>

int main(){

int c, i, j;

//capture frame from camera
CvCapture* capture = cvCaptureFromCAM(CV_CAP_ANY);
if(!capture){
fprintf(stderr, "Error: capture is NULL \n");
getchar();
return -1;
}
//set resolution of capture
cvSetCaptureProperty(capture, CV_CAP_PROP_FRAME_WIDTH, 256);
cvSetCaptureProperty(capture, CV_CAP_PROP_FRAME_HEIGHT, 192);

//create window for display
cvNamedWindow("canny");

while(true){

//find/mark edges using canny
IplImage* frame = cvQueryFrame(capture);
IplImage* grey = cvCreateImage(cvGetSize(frame), 8, 1);
cvCvtColor(frame, grey, CV_RGB2GRAY);
IplImage* frame2 = cvCreateImage(cvSize(grey->width+6, grey->height+6), grey->depth, grey->nChannels);

CvPoint offset = cvPoint(3,3);
cvCopyMakeBorder(grey, frame2, offset, IPL_BORDER_REPLICATE, cvScalarAll(0));
IplImage* edges = cvCreateImage(cvGetSize(frame2), IPL_DEPTH_8U, frame2->nChannels);
cvCanny(frame2, edges, 4900, 39200, 7);

cvShowImage("canny", edges);

//wait for a keypress
int c = cvWaitKey(10);
if (c!=-1) break;

} //end while

cvReleaseCapture (&capture);
cvDestroyWindow("canny");
return 0;

} //end main

It’s a small window size (256×192) in this case because I was running it on the Raspberry Pi, and the Pi can’t handle a large window size – gets bogged down in the processing. Just reset those values to whatever your processor can handle.