Dr. Lawlor's Code, Robots, & Things

March 9, 2017

Fairbanks PM2.5 Air Quality Data

Filed under: Air Quality — Dr. Lawlor @ 1:49 am

Tomorrow night the borough assembly will consider Ordinance 2017-18 (page 70 in the agenda) which strengthens the current air quality prohibitions.  It’s been two years since the prohibition ordinance first passed, so I thought it was a good time to look at the AKDEC data on whether the air is now cleaner.

The biggest factor contributing to air quality here is the exterior temperature–when it’s cold, not only are people burning more home heating fuel and leaving their cars running, there’s usually a temperature inversion that traps that pollution near the ground.  So these charts use the exterior temperature as the horizontal axis; the R^2 coefficient below shows that temperature explains about half the variance in PM2.5.

Here are the last 4 years of PM2.5 data for Fairbanks.  The blue data is from the two winters before the ordinance; the orange data is from the two winters after the ordinance took effect.


Here’s the same chart for North Pole, which has much bigger air quality problems, and has had frequent air quality alerts (burn bans) in effect the past few winters.


I personally dislike the entire prohibit, tax, and fine approach that the current air quality ordinance takes–the long term solution is cheap natural gas in Fairbanks; the short term or summertime solution is indoor HEPA filters, they’re cheap and they work.

But to me the data clearly show a 15-25% reduction in PM2.5 in the post-ordinance years, even after controlling for the weather effect.  That’s a much bigger reduction than I’d expected!

February 20, 2017

Materials Breaking: Collection of Videos

Filed under: Random Thoughts — Dr. Lawlor @ 3:06 pm

High magnification (electron microscope?) image of lathe tools turning various steels.  Steel’s deformation is ductile, like clay.

Ultra high speed footage of breaking glass, showing a brittle fracture that propagates at about half the speed of sound in glass (kilometers per second).

Even higher speed footage (500ns between frames) of plexiglass cracking:

Tensile stretching steel rebar to failure.  There is a lot of plastic deformation before the final break.

Without steel reinforcing, concrete fails in a brittle fashion, with cracks opening up in the areas in tension.

At supersonic velocity, a crash test dummy can obliterate a cinder block wall.


January 23, 2017

Sandstruder: metering sand for 3D printing

Filed under: Random Thoughts — Dr. Lawlor @ 10:59 am

For the NASA 3D printed habitat challenge, I’m upgrading my 3D printer to be able to shuffle around fluffy basalt dust.  For that, I need a sort of extruder capable of moving sand around.  My weekend project was a “sandstruder”, designed to extract sand from a hopper, and send it down a (to be determined) sort of sand Bowden tube.


OpenSCAD model


3D printed in two halves


Extruding sand!

Sand extrusion seems quite reliable, although metering is not very consistent.  Wired up as an “extruder”, and programmed like a Wade’s geared extruder, a software commanded “10mm of filament” emits between 8 and 14 grams of dust, with an average around 11 grams.  It seems to run reliably up to the speed limit of the stepper, a few thousand mm per minute (so a few kilograms of sand per minute).

If the auger bit gets jammed up on a rock, the stepper just skips steps rather than destroying itself, which is one advantage of this low-torque direct drive setup.  I will need to pre-screen the sand to eliminate the rocks, however.

Like it?  Download an STL or the OpenSCAD source code on thingiverse (or github)!

April 26, 2016

Terrain Rendering in 3D

Filed under: Graphics, Linux, Programming, Random Thoughts — Dr. Lawlor @ 4:49 pm

Back in 2003 I worked on a terrain simplification algorithm, a modification of Lindstrom’s method, to allow interactive exploration of big terrains in 3D.

A binary distribution is available for Windows (.zip) or Linux (.tar.gz), and the binaries should work, and let you view your own binary DEM and JPEG texture.  I made an attempt to include the source in there, although I built both of the binaries using my custom build system, so it’s likely to take quite a bit more work, and possibly even some missing custom libraries, to get it to compile.

November 15, 2015

Interactive Web-Based Visualization Tools

Filed under: Random Thoughts — Dr. Lawlor @ 11:05 pm

Many datasets can be most easily viewed in 3D:

  • ArmsGlobe displays small arms and ammunition shipments through time and space.
  • ViziCities loads OpenStreetMap data into 3D, in browser.

A variety of physical simulations can use WebGL for interactive visualization.  One thing I love about WebGL is your pixel and vertex shaders run on the GPU with exactly the same performance you’d get in a full application, but it’s delivered instantly on any platform in a browser.

Several modern interactive 3D computer-aided design (CAD) programs are shifting to web-based tools:

  • OpenJSCAD provides a 3D constructive solid geometry programming language in-browser using JavaScript for computational geometry, and WebGL for rendering.
  • Onshape provides high end 3D computer aided design features similar to SolidWorks, but runs entirely in browser.

We’ve been building a web-based robot configuration, programming, and visualization system called RobotMoose.

Short link here for D2D workshophttp://tinyurl.com/d2dwebviz

September 28, 2015

Earthquake P-wave and nighttime anxiety

Filed under: Random Thoughts — Dr. Lawlor @ 9:24 pm

About 2am last night, I woke up feeling extremely anxious, and the hairs on my arms were standing up–neither of which is at all typical for me!  A few seconds later, I felt the bed start shaking very gently, and I realized it was probably an earthquake.

Checking the USGS Earthquake Map, there was indeed a magnitude 3.1 earthquake in our hills at this time, about 60km away and 11km deep.  Clearly something about the earthquake woke me up, but it’s surprising I subconsciously managed to detect the P wave while sound asleep, considering the later S wave (typically 2-3 times larger) could barely be felt.

September 15, 2015

Rescuing Data from a Banished Daemon

Filed under: Linux, Programming — Dr. Lawlor @ 9:12 pm

Last week we managed to accidentally delete the entire directory housing our custom database server (superstar), including the on-disk backups and historical backups of its robot info database.  Not good.

Amazingly, ps showed the server was still running, and poking around we could even see the in-memory copy of the database was still fine, but it was trapped inside this banished daemon.

# ps
no_priv 5149 0.1 0.0 14932 1640 ? S 18:04 0:08 ./superstar

Checking /proc/5149 shows the directory and exe have been deleted, which make a lot of tools break:

# ls -al /proc/5149
lrwxrwxrwx 1 no_priv no_priv 0 Sep 11 18:09 cwd -> /home/itest/git3/superstar (deleted)
-r-------- 1 no_priv no_priv 0 Sep 11 18:20 environ
lrwxrwxrwx 1 no_priv no_priv 0 Sep 11 18:09 exe -> /home/itest/git3/superstar/superstar (deleted)

We tried for a while to recreate or change the cwd, so we could tickle the daemon into backing up its database somewhere accessible–relinking won’t seem to change this directory, although possibly inode-level reconstruction of the old directory could have worked.

But I could still copy off the running executable for analysis:

# cp /proc/5149/exe /tmp/necrodaemon
# nm /tmp/necrodaemon | grep back
000000000061ca40 b _ZL15backup_filename

This is the in-memory address of the string holding the filename where the daemon tries to back up its in-memory database.  Currently it reads “db.bak”, a relative path, which is a problem since the process’s current working directory is gone.

Now just attach to the daemon in gdb, and we can see and change what’s inside it.

# gdb -p 5149

Of course, the daemon wasn’t compiled with debug symbols, so we can’t call methods or even functions.  So step one is verifying there’s anything actually at that “backup_filename” memory address–it’s a std::string, which has a single pointer to a separate refcounted object that actually holds the bytes of the string.  We then overwrote the bytes of this string to make the relative path into an absolute path, “/a.bak”, a file which we’d previously created and given the correct permissions.

(gdb) p *(long *)0x61ca40
$1 = 27717720
(gdb) p *(char **)0x61ca40
$7 = 0x1a6f058 "db.bak"
(gdb) set {char}0x1a6f058 = '/'
(gdb) p *(char **)0x61ca40
$8 = 0x1a6f058 "/b.bak"
(gdb) set {char}0x1a6f059 = 'a'
(gdb) p *(char **)0x61ca40
$9 = 0x1a6f058 "/a.bak"
(gdb) detach
Detaching from program: , process 5149
(gdb) quit

As soon as the backup ran, the daemon had written its in-memory database to the newly created file “/a.bak”, so our data was saved–daemon necromancy to the rescue!

August 12, 2015

Parrot “Rolling Spider” UAV Hacking: Dumping the Filesystem

Filed under: Hardware, Linux, Programming, Rolling Spider — Dr. Lawlor @ 11:53 pm

I just got a new tiny UAV, the Parrot “Rolling Spider” ($80), which is very fun to fly via bluetooth with my phone.  But it’s also a linux-based computer, so it’s also fun to hack!

The easiest way to get a root shell is to just plug it in via the USB cable, which not only shows up as a removable USB drive, it also shows up as a network device (at least, as of the 1.99.2 firmware version).  This means you can immediately get a root shell with:


That was easy!  Now to dump the filesystem, to netcat on port 1234.  (The ^p avoids /proc, which has infinite recursive root links; the ^y avoids /sys, which has files that change in size.)

tar cpf - [^p][^y]* | nc -l -p 1234

To get the filesystem as a file on your desktop computer, now just:

nc 1234 > rootfs.tar

This has *everything*, from:

drwxr-xr-x root/root 0 1969-12-31 14:00 bin/
lrwxrwxrwx root/root 0 1969-12-31 14:00 bin/getopt -> busybox
lrwxrwxrwx root/root 0 1969-12-31 14:00 bin/dd -> busybox
lrwxrwxrwx root/root 0 1969-12-31 14:00 bin/cp -> busybox
lrwxrwxrwx root/root 0 1969-12-31 14:00 bin/df -> busybox
lrwxrwxrwx root/root 0 1969-12-31 14:00 bin/ip -> busybox
-rwxrwxr-x root/root 35 1969-12-31 14:00 bin/kk
lrwxrwxrwx root/root 0 1969-12-31 14:00 bin/ln -> busybox
lrwxrwxrwx root/root 0 1969-12-31 14:00 bin/ls -> busybox
lrwxrwxrwx root/root 0 1969-12-31 14:00 bin/mv -> busybox
lrwxrwxrwx root/root 0 1969-12-31 14:00 bin/ps -> busybox
lrwxrwxrwx root/root 0 1969-12-31 14:00 bin/rm -> busybox
lrwxrwxrwx root/root 0 1969-12-31 14:00 bin/sh -> busybox
lrwxrwxrwx root/root 0 1969-12-31 14:00 bin/vi -> busybox
-rwxrwxr-x root/root 305 1969-12-31 14:00 bin/blink_led_orangeleft.sh
lrwxrwxrwx root/root 0 1969-12-31 14:00 bin/ash -> busybox


drwxr-xr-x root/root 0 1969-12-31 14:00 usr/share/avahi/
-rw-r--r-- root/root 560 1969-12-31 14:00 usr/share/avahi/avahi-service.dtd
-rw-r--r-- root/root 5104 1969-12-31 14:00 usr/share/avahi/service-types
drwxr-xr-x root/root 0 1969-12-31 14:00 var/
lrwxrwxrwx root/root 0 1969-12-31 14:00 var/log -> /tmp/
-rw-rw-r-- root/root 7 1969-12-31 14:00 version.txt
drwxr-xr-x root/root 0 1969-12-31 14:00 www/
-rw-rw-r-- root/root 485 1969-12-31 14:00 www/index.html

For example, now I can see the contents of the control shell scripts:

$ cat bin/set_led_greenleft.sh 

# temp behaviour : red light right on
gpio 33 -d ho 1
# temp behaviour : red light left off
gpio 30 -d ho 0

#green light right off
gpio 31 -d ho 0

#green light left on
gpio 32 -d ho 1

I can also see the details of how the code was built:

$ file bin/busybox
busybox: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.16, stripped

Of course, eventually I’ll want to permanently modify this filesystem, by re-flashing the UAV with a reverse engineered PLF firmware file, which is similar to the Parrot AR Drone PLF format.  I’m nearly there with “plftool -e raw -i rollingspider_update.plf -o .”, but each resulting file has the filename prepended in some sort of fixed-length binary header.

Stay tuned!

August 6, 2015

Alaska90: my huge new 3D printer design

Filed under: 3D Printing, Hardware — Dr. Lawlor @ 12:51 am

I started working on a huge new 3D printer design, the “Alaska90”, back in November 2014, but I got busy with school and stalled out.  This summer I finally got a few spare days and finished up the build, which is working well and printing huge things. Main features:

  • 600mm x 500mm x 600mm build volume (24 inch x 20 inch x 24 inch), to construct models as big as a few feet on each side.  By contrast, a typical printer prints about 200mm (8 inches) on a side.
  • Frame is built from 3/4 inch plywood, and parts are secured using 1/4 inch hex head bolts.  By contrast, a typical printer uses 1/4 inch wood or plastic, and tiny M4 screws.
  • Uses heavy 16mm steel rods, so it’s rigid enough to mill wood with a small dremel tool.
  • Support rods are moved inward, to gauss points, to better support the 24 inch x 24 inch bed.

3D rendering of Alaska90 3D printerPhotograph of Alaska90 3D printer The full design details, STL files, and OpenSCAD source code for the Alaska90 printer is on my github.

July 18, 2015

LaserJet 8500: a huge awesome ancient laser printer

Filed under: Random Thoughts — Dr. Lawlor @ 8:52 pm

At a surplus auction today, I picked up an Apple LaserJet 8500, a 60 pound black and white laser printer from the 1990’s.  Why did I bother buying such an ancient beast?

It can feed huge 13 x 19 inch paper!  I often do robot design work in CAD, then laser print a template to glue onto steel, plywood, plastic sheet, or whatever material for further drilling, cutting, and machining.  This means the size of my parts is limited by the size of my printer, so a big printer lets me build bigger parts more easily.

Anyway, the hard part was getting the printer’s IP address.  Once you have the original IP, you can reconfigure it via telnet (it will make you set a password), and then send it Postscript files via the JetDirect (9100) network port.  All you need is the LaserJet 8500 PPD file, version 1.2–link is plain text that I had to unpack from Apple’s ancient classic Mac smi.bin file using the BasiliskII emulator.

Older Posts »

Create a free website or blog at WordPress.com.