Dr. Lawlor's Code, Robots, & Things

January 2, 2018

Migraine – Potassium – Sodium link?

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

Raw foods, like fruits, vegetables, nuts, and meats, include lots of potassium.  Modern processed foods include lots of sodium, because sodium is a cheap way to make foods tastier.

If you eat too many processed sodium-rich foods, your kidneys excrete the excess sodium, but this also washes potassium out of your body.

Yesterday, I skipped my usual daily apple and yogurt (potassium-rich foods), but I did eat a large helping of pesto pasta, which was green and tasty.  But then last night I woke up with a head-splitting migraine, including sensitivity to light and sound, which is quite unusual for me.  I also had an urge to eat something salty like corn chips: salty foods usually don’t work for me, but it indicates how your body reacts to an electrolyte imbalance.  Suspecting low potassium, I drank two glasses of apple-cherry 100% juice–each glass has 8% of your daily RDA of potassium, 1% of your RDA of sodium.  The migraine immediately began to recede.

Looking at the labels this morning, the processed pesto I used turns out to be high in sodium, with almost no potassium.

Disclaimer: I am a doctor, but of computer science, not medicine!  Actual medical doctors are now examining therapies that treat electrolyte imbalance to treat migraine.


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.

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.

July 17, 2015

Flailing squid: 3D printer adhesion failure

Filed under: Random Thoughts — Dr. Lawlor @ 12:21 am

After starting an all-night print, I checked on my printer this morning to discover this many-tentacled glob of plastic, which apparently ate my print:

3D printer with orange plastic squirting in all directions from extruder.

3D printer with orange plastic squirting in all directions from extruder.

The problem here is the print head grabbed one corner of the print, and peeled it up.  With that corner sticking up as leverage, it incrementally peeled up the rest of the print, which stuck to the hot nozzle.  Since I’d left the printer running unattended (bad idea!), it KEPT PRINTING, with plastic squirting in all directions, resulting in an annoying-to-remove glob instead of a clean print.

The fix was to heat the hotend back up, and carefully clip away the gobs of excess plastic.  I had to be fairly careful, because the hotend’s heater and thermistor wires were buried in the goo.  I’ve wrapped them more securely in kapton tape for when this happens again.

This was with rubbery NinjaFlex, but I’ve had the same thing happen with ordinary ABS.  The trick is keeping an eye on the printer while it prints!

October 23, 2014

Monkeys, Typewriters, and Shakespeare

Filed under: Random Thoughts — Dr. Lawlor @ 6:39 pm

This Wednesday we did our first ACM student chapter coding challenge, verifying the infinite monkey theorem:

“A monkey pounding keys on a typewriter for an infinite time will eventually generate the complete works of Shakespeare.”

Clearly, we don’t have infinite time, but computers are faster than monkeys, and a virtual monkey doesn’t need bananas or people to clear the typewriter jams (and clean the cage).  Also, the crucial role of “monkey editor” needs to be automated.

Surprisingly, the default C++11 random number generator std::default_random_engine repeats every 4 billion keystrokes, which happens within only a few minutes.  std::mt19937 did not repeat during the duration of this test.

Shakespeare’s word length distribution is approximately:

0 19 101 588 1871 3295 4443 4963 4486 3486 2372 1584 860 476 219 92 39 15 9 7 0 1 0 1 0

That is, there are 0 words with 0 letters, 19 words with one letter (a, i, and other letters counting section titles and abbreviations), 101 two-letter words, etc.

The spacebar is bigger than the other keys, which is good because otherwise the median monkey-word has length 26.  By varying the size of the spacebar, we can set the average word length.

In typing 1.8 trillion keystrokes (on a quad-core machine over the course of a few days), billions of short words were generated, but the longest Shakespearean words generated were only 9 letters long:


This is all of them.  The full bard is 5 million characters long.  Monkeys, get crackin’!

August 9, 2014

WebGL Nonlinear Iterated Function System Rendering

Filed under: Random Thoughts — Dr. Lawlor @ 1:13 am

A few years ago I built a fun little nonlinear iterated function system fractal renderer that works on the GPU.  I got very pretty pictures and interesting scientific results, but my demo is an OpenGL application, so it’s a pain for people to download and see. Juergen Wothke just ported my renderer to use WebGL, so it can animate beautiful swoopy lines in realtime, at least in Chrome. A prerecorded video doesn’t capture the full resolution or the 60fps speed that a good graphics card is capable of producing!

Read his technical details at his blog.  Browser audio processing was the main headache.

I’d love to see somebody build a full-on interactive editor for nonlinear IFS using WebGL and my GPU rendering technique!

Older Posts »

Create a free website or blog at WordPress.com.