<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>nppilot | Blue Duck Valley Rd</title><link>https://juju.nz/michaelh/categories/nppilot/</link><atom:link href="https://juju.nz/michaelh/categories/nppilot/index.xml" rel="self" type="application/rss+xml"/><description>nppilot</description><generator>Source Themes Academic (https://sourcethemes.com/academic/)</generator><language>en-us</language><copyright>© 2017-2025 Michael Hope</copyright><lastBuildDate>Sun, 30 Aug 2015 11:09:30 +0000</lastBuildDate><image><url>img/map[gravatar:%!s(bool=false) shape:circle]</url><title>nppilot</title><link>https://juju.nz/michaelh/categories/nppilot/</link></image><item><title>No luck on flying</title><link>https://juju.nz/michaelh/2015/08/no-luck-on-flying/</link><pubDate>Sun, 30 Aug 2015 11:09:30 +0000</pubDate><guid>https://juju.nz/michaelh/2015/08/no-luck-on-flying/</guid><description>&lt;p>Looks like the plane is too heavy. It took off OK on the first try, but I couldn’t get it to lift on five goes past that. The first flight was probably due to the little bit of extra voltage a freshly charged battery has.&lt;/p>
&lt;p>I did some measurements and the plane with autopilot is 1130 g, which is 255 g / 30 % higher than the design flying weight of 875 g. 110 g of that is in the MDF plate and 50 g is in my usual higher capacity batteries.&lt;/p>
&lt;p>Next step is to redo the plate in polystyrene. I’m tempted to follow Z-8’s
&lt;a href="http://www.rcgroups.com/forums/showthread.php?t=1224971" target="_blank" rel="noopener">instructions&lt;/a> and change the prop to a APC 10×7 E and upgrade the motor to a
&lt;a href="http://www3.towerhobbies.com/cgi-bin/wti0001p?&amp;amp;I=LXXGY4&amp;amp;P=8" target="_blank" rel="noopener">Super Tigre .10&lt;/a>. The Super Tigre has a higher constant power (320 W vs 210 W), is a drop in replacement, and as a bonus saves 50 g.&lt;/p>
&lt;p>Edit: annnd I crashed it 🙂 I fitted a 10×7 prop and new receiver and got the elevator direction wrong. The good news is the 10×7 makes the plane leap away. The bad news is it lept away into the ground…&lt;/p></description></item><item><title>Trojan+PX4 ready to fly</title><link>https://juju.nz/michaelh/2015/08/trojanpx4-ready-to-fly/</link><pubDate>Fri, 28 Aug 2015 19:06:27 +0000</pubDate><guid>https://juju.nz/michaelh/2015/08/trojanpx4-ready-to-fly/</guid><description>&lt;p>I picked up yet another board to try in my never-complete car autopilot project. This time it’s a Pixhawk
&lt;a href="http://px4.io/" target="_blank" rel="noopener">PX4&lt;/a> (from
&lt;a href="http://cvg.ethz.ch/" target="_blank" rel="noopener">ETH&lt;/a> here in Zurich, woo!) with a FrSky PPM receiver, u-blox GPS, and 433 MHz telemetry mounted on my trusty
&lt;a href="http://www.parkzone.com/Products/Default.aspx?ProdID=PKZ4400" target="_blank" rel="noopener">P-28 Trojan&lt;/a>.&lt;/p>
&lt;p>
&lt;a href="https://juju.net.nz/michaelh/blog/wp-content/uploads/2015/08/IMG_20150828_202952.jpg" target="_blank" rel="noopener">&lt;img src="https://juju.net.nz/michaelh/blog/wp-content/uploads/2015/08/IMG_20150828_202952.jpg" alt="Top view assembled" width="1714" height="2285" class="aligncenter size-full wp-image-275" />&lt;/a>&lt;/p>
&lt;p>
&lt;a href="https://juju.net.nz/michaelh/blog/wp-content/uploads/2015/08/IMG_20150828_203032.jpg" target="_blank" rel="noopener">&lt;img src="https://juju.net.nz/michaelh/blog/wp-content/uploads/2015/08/IMG_20150828_203032.jpg" alt="Under view of autopilot" width="584" height="779" class="aligncenter size-large wp-image-276" />&lt;/a>&lt;/p>
&lt;p>Laser cutters are awesome. The baseboard that everything is mounted on was made by taking a basic sketch and measurements, drawing it in Inkscape, then cutting it out of 3 mm MDF (we were out of plywood…) on the laser cutter at work. Fast and accurate.&lt;/p>
&lt;p>I’ll fly it tomorrow. The software has stabalisation, altitude hold, and a waypoint engine. It can also auto takeoff and auto land but that’s not a good idea on the grass without rangefinder.&lt;/p></description></item><item><title>New rover board</title><link>https://juju.nz/michaelh/2015/07/nppilot-new-rover-board/</link><pubDate>Sun, 12 Jul 2015 20:17:14 +0000</pubDate><guid>https://juju.nz/michaelh/2015/07/nppilot-new-rover-board/</guid><description>&lt;p>I have this long term, never complete project to make a self driving RC car. I’m making progress on the third reboot and finished up the rover board today:&lt;/p>
&lt;p>
&lt;a href="https://juju.net.nz/michaelh/blog/wp-content/uploads/2015/07/IMG_20150712_220612.jpg" target="_blank" rel="noopener">&lt;img src="https://juju.net.nz/michaelh/blog/wp-content/uploads/2015/07/IMG_20150712_220612.jpg" alt="IMG_20150712_220612" width="2448" height="2180" class="aligncenter size-full wp-image-269" />&lt;/a>&lt;/p>
&lt;p>On the board is a NAZE32 running Cleanflight for the sensors and real time control, a GPS, a Frsky receiver, a Beaglebone Black for logging, and a Adafruit LCD for status.&lt;/p>
&lt;p>The big changes with this reboot is moving the control software to a realtime controller instead of embedded Linux and adding a display and Wifi for a much faster test and debug cycle.&lt;/p></description></item><item><title>1.8″ LCD support for the ESP8266</title><link>https://juju.nz/michaelh/2015/05/1-8-lcd-support-for-the-esp8266/</link><pubDate>Sun, 17 May 2015 18:21:14 +0000</pubDate><guid>https://juju.nz/michaelh/2015/05/1-8-lcd-support-for-the-esp8266/</guid><description>&lt;p>I’ve ported the
&lt;a href="http://www.adafruit.com/products/358" target="_blank" rel="noopener">Adafruit 1.8″ LCD&lt;/a>
&lt;a href="https://github.com/adafruit/Adafruit-ST7735-Library" target="_blank" rel="noopener">driver&lt;/a> to the new-ish
&lt;a href="https://github.com/esp8266/Arduino" target="_blank" rel="noopener">Arduino ESP8266&lt;/a> port and done an optimisation pass. Short story is that the demo that comes with the board is down from 6083 ms to 3424 ms, and big operations like fill screen is down from 1454 ms to 157 ms. Hurray for FIFOs and better bus utilisation!&lt;/p>
&lt;p>
&lt;a href="https://juju.net.nz/michaelh/blog/wp-content/uploads/2015/05/IMG_20150517_191847.jpg" target="_blank" rel="noopener">&lt;img src="https://juju.net.nz/michaelh/blog/wp-content/uploads/2015/05/IMG_20150517_191847.jpg" alt="IMG_20150517_191847" width="2363" height="2295" class="aligncenter size-full wp-image-263" />&lt;/a>&lt;/p>
&lt;p>I’m quite impressed with the Arduino port: the group have done a lot of work on the completeness, speed, and in porting the standard libraries like the SD FAT support I plan to use for logging.&lt;/p>
&lt;p>My goal is to restart my self driving RC car project with a
&lt;a href="http://www.hobbyking.com/hobbyking/store/__55819__AfroFlight_Naze32_Acro_AbuseMark_FunFly_Controller.html" target="_blank" rel="noopener">NAZE32&lt;/a> as the controller board and an
&lt;a href="https://olimex.com/Products/Modules/Ethernet/MOD-WIFI-ESP8266-DEV/" target="_blank" rel="noopener">ESP8266&lt;/a> as logging, display, and telemetry. Let’s see how far I get this time 🙂&lt;/p></description></item><item><title>Pin to native mapping for the Teensy LC</title><link>https://juju.nz/michaelh/2015/05/pin-to-native-mapping-for-the-teensy-lc/</link><pubDate>Sun, 03 May 2015 19:43:56 +0000</pubDate><guid>https://juju.nz/michaelh/2015/05/pin-to-native-mapping-for-the-teensy-lc/</guid><description>&lt;p>I’m hacking on porting
&lt;a href="nuttx.org">NuttX&lt;/a> to the
&lt;a href="https://www.pjrc.com/teensy/teensyLC.html" target="_blank" rel="noopener">Teensy LC&lt;/a> instead of using PJRC’s excellent Arduino support. For reference, here’s the Arduino pin mapping to the native pin:&lt;/p>
&lt;pre>0 PTB16
1 PTB17
2 PTD0
3 PTA1
4 PTA2
5 PTD7
6 PTD4
7 PTD2
8 PTD3
9 PTC3
10 PTC4
11 PTC6
12 PTC7
13 PTC5
14 PTD1
15 PTC0
16 PTB0
17 PTB1
18 PTB3
19 PTB2
20 PTD5
21 PTD6
22 PTC1
23 PTC2
24 PTE20
25 PTE21
26 PTE30
&lt;/pre>
&lt;p>This was made by running
&lt;a href="https://github.com/PaulStoffregen/cores/blob/master/teensy3/core_pins.h" target="_blank" rel="noopener">core_pins.h&lt;/a> through the C preprocessor.&lt;/p></description></item><item><title>Fast-ish boot for the Arietta</title><link>https://juju.nz/michaelh/2015/01/fast-ish-boot-for-the-arietta/</link><pubDate>Thu, 22 Jan 2015 20:09:07 +0000</pubDate><guid>https://juju.nz/michaelh/2015/01/fast-ish-boot-for-the-arietta/</guid><description>&lt;p>A while ago I posted about cutting the ACME Arietta boot time down from ~30 s to ~4 s. Here’s the hacks I did to get there.&lt;/p>
&lt;p>After the kernel has finished initialising it runs ‘init’ which is responsible for setting up the system and starting any services. ‘init’ has the concept of runlevels including runlevel S (initial startup), runlevel 2 (normal operation) and runlevel 6 (reboot). You can configure what init does when it enters a runlevel, including changing it from running a bunch of generic scripts to running a single, specific, and much faster script.&lt;/p>
&lt;p>So that’s the trick: change init from executing all of the scripts in &lt;code>/etc/rc2.d/&lt;/code> and instead have it run your own &lt;code>/etc/init.d/rc2&lt;/code>.&lt;/p>
&lt;p>The first step is to change the init config file &lt;code>/etc/inittab&lt;/code>. As a diff:&lt;/p>
&lt;pre>-l2:2:wait:/etc/init.d/rc 2
+l2:2:wait:/etc/init.d/rc2
&lt;/pre>
&lt;p>Then create a file holding helper functions, including a log function that’s useful when timing individual steps:&lt;/p>
&lt;p>&lt;code>/etc/init.d/rc.common&lt;/code>:&lt;/p>
&lt;pre>PATH=/sbin:/usr/sbin:/bin:/usr/bin
export PATH
umask 022
start() {
echo "+ $@..."
$@
}
&lt;/pre>
&lt;p>Overwrite the initial startup script &lt;code>/etc/init.d/rcS&lt;/code> with:&lt;/p>
&lt;pre>#!/bin/busybox sh
. /etc/init.d/rc.common
start mount -t proc /proc /proc
start mount -t sysfs /sys /sys
start mount -o remount,rw /
start mount -t tmpfs none /run
mkdir -p /run/network /run/lock
start mount -a
start hostname $(cat /etc/hostname)
#start /etc/init.d/udev start
echo > /sys/kernel/uevent_helper
start udevd --daemon
start udevadm trigger --action=add
start udevadm settle --timeout=0
# PENDING: Load modules.
# PENDING: sysctl
# PENDING: urandom
start ifconfig lo 127.0.0.1 netmask 255.0.0.0 up
&lt;/pre>
&lt;p>and finally create &lt;code>/etc/init.d/rc2&lt;/code> to start your services and perhaps application:&lt;/p>
&lt;pre>#!/bin/busybox sh
. /etc/init.d/rc.common
make_mac() {
echo 00$(echo $HOSTNAME $@ | md5sum | cut -b -10)
}
# Ethernet
start modprobe g_ether use_eem=0 dev_addr=$(make_mac dev) host_addr=$(make_mac host)
start ifconfig usb0 192.168.10.10 netmask 255.255.255.0 up
# OpenSSH
mkdir -p /var/run/sshd
chmod 0755 /var/run/sshd
start /usr/sbin/sshd
# Finished!
echo uptime: `cat /proc/uptime`
&lt;/pre>
&lt;p>Make sure the files are executable (&lt;code>chmod +x ...&lt;/code>).&lt;/p>
&lt;p>The make_mac() function is used to give the USB ethernet gadget a fixed MAC address instead of generating a random one at each boot. This makes setting a static IP address in Chrome OS easier.&lt;/p>
&lt;p>Note that I’m using busybox as the shell. It’s really small so should be quick to load and run. Run &lt;tt>sudo apt-get install busybox&lt;/tt> to get it.&lt;/p>
&lt;p>Fiddling with init scripts is a good way to break the boot. The easiest way to fix a problem is to put the SD card into your laptop and edit the files directly.&lt;/p>
&lt;p>Click
&lt;a href="https://juju.net.nz/michaelh/blog/wp-content/uploads/2015/01/arietta-faster-boot.tar.gz" target="_blank" rel="noopener">here&lt;/a> for a tarball of the files.&lt;/p></description></item><item><title>golang and realtime musings</title><link>https://juju.nz/michaelh/2014/10/golang-and-realtime-musings/</link><pubDate>Sun, 19 Oct 2014 18:23:21 +0000</pubDate><guid>https://juju.nz/michaelh/2014/10/golang-and-realtime-musings/</guid><description>&lt;p>I’m using
&lt;a href="http://golang.org/" target="_blank" rel="noopener">golang&lt;/a> as the language for my self balancing robot project. It should be interesting as golang is designed for server loads, not for realtime, but the bot will need to update at 100 Hz (10 ms/cycle) to say upright.&lt;/p>
&lt;p>I had a look at
&lt;a href="http://golang.org/doc/install/source" target="_blank" rel="noopener">the source&lt;/a> and there’s a few issues:&lt;/p>
&lt;p>No priorities. The fast control loop should take priority but goroutines are cooperative, have no concept of priority, and are multiplexed onto threads in undefined ways.&lt;/p>
&lt;p>The timers are fired from one thread. Ideally timers should have priority and smear, so the control timer can fire first and any other timers can run at roughly the right time when the CPU has gone idle.&lt;/p>
&lt;p>The garbage collector is stop world. It’d be nice if the control thread had its own GC pool. Not going overboard with short lived objects should keep this under control.&lt;/p>
&lt;p>The next step is to measure see if any of this is a problem. I plan to have the control loop set a pin on entry and clear it on exit, and then use a
&lt;a href="http://www.atmel.com/devices/attiny85.aspx" target="_blank" rel="noopener">ATTINY&lt;/a> as a timer to measure the start and runtime jitter.&lt;/p></description></item><item><title>Balancing robot first steps</title><link>https://juju.nz/michaelh/2014/09/balancing-robot-first-steps/</link><pubDate>Sun, 21 Sep 2014 18:01:47 +0000</pubDate><guid>https://juju.nz/michaelh/2014/09/balancing-robot-first-steps/</guid><description>&lt;p>I’m working on a self balancing robot as a &lt;em>coming-into-winter-something-inside-sounds-good&lt;/em> project. Today I got it
&lt;a href="http://youtu.be/AO2-zbcM4jQ" target="_blank" rel="noopener">driving about&lt;/a>: not balancing, not smart, but still a good milestone.&lt;/p>
&lt;p>It’s been a lot of fun due to the different tech involved. The body is laser cut acrylic with finger joints to join the base to the motor plates. The controller is a
&lt;a href="http://www.acmesystems.it/arietta" target="_blank" rel="noopener">Arietta&lt;/a> 400 MHz ARM9 running Debian. The motors are some cheap DC motors/gearbox/wheel combos from Olimex. The motor controller is a L298. The ‘up’ sensor is a six axis MPU6050 giving gyros and accelerometers.&lt;/p>
&lt;p>It’s definitely a v1. I want to redo the frame to be much narrower and taller giving a more ‘upright’ shape. I might build a PCB instead of veroboard to shrink the whole design.&lt;/p>
&lt;p>The current hard problem is the supply. I need 5V to drive the USB Wifi adapter so I’m considering changing the 6V 4x AA battery pack for a 7.4 V 2S LiPo. It’s a better size and is a high enough voltage that I can put a 5 V linear regulator and have both the motor and control from the same battery.&lt;/p>
&lt;p>
&lt;a href="https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/09/IMG_20140921_154022.jpg" target="_blank" rel="noopener">&lt;img src="https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/09/IMG_20140921_154022-1024x768.jpg" alt="Robot main view" width="584" height="438" class="aligncenter size-large wp-image-212" srcset="https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/09/IMG_20140921_154022-1024x768.jpg 1024w, https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/09/IMG_20140921_154022-300x225.jpg 300w, https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/09/IMG_20140921_154022-400x300.jpg 400w" sizes="(max-width: 584px) 100vw, 584px" />&lt;/a>&lt;/p>
&lt;p>
&lt;a href="https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/09/IMG_20140921_154037.jpg" target="_blank" rel="noopener">&lt;img src="https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/09/IMG_20140921_154037-1024x768.jpg" alt="Robot main view alternate" width="584" height="438" class="aligncenter size-large wp-image-211" srcset="https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/09/IMG_20140921_154037-1024x768.jpg 1024w, https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/09/IMG_20140921_154037-300x225.jpg 300w, https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/09/IMG_20140921_154037-400x300.jpg 400w" sizes="(max-width: 584px) 100vw, 584px" />&lt;/a>&lt;/p></description></item><item><title>Console on a old Nokia display</title><link>https://juju.nz/michaelh/2014/07/console-on-a-old-nokia-display/</link><pubDate>Tue, 15 Jul 2014 18:34:59 +0000</pubDate><guid>https://juju.nz/michaelh/2014/07/console-on-a-old-nokia-display/</guid><description>&lt;p>After a night of hacking I have the cutest console ever: fbcon on my
&lt;a href="http://www.acmesystems.it/arietta" target="_blank" rel="noopener">Arietta G25&lt;/a> showing on a 84×48
&lt;a href="https://www.olimex.com/Products/Modules/LCD/MOD-LCD3310/" target="_blank" rel="noopener">Nokia 3310 LCD&lt;/a> thanks to
&lt;a href="https://github.com/notro/fbtft" target="_blank" rel="noopener">fbtft&lt;/a>. The nice thing is it’s tiny enough to fit on my RC car but shows as a standard framebuffer so will work with everything.&lt;/p>
&lt;p>
&lt;a href="https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/07/zoom.jpg" target="_blank" rel="noopener">&lt;img src="https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/07/zoom-950x1024.jpg" alt="zoom" width="584" height="629" class="aligncenter size-large wp-image-201" srcset="https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/07/zoom-950x1024.jpg 950w, https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/07/zoom-278x300.jpg 278w, https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/07/zoom.jpg 1156w" sizes="(max-width: 584px) 100vw, 584px" />&lt;/a>&lt;/p>
&lt;p>
&lt;a href="https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/07/IMG_20140715_201811.jpg" target="_blank" rel="noopener">&lt;img src="https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/07/IMG_20140715_201811-743x1024.jpg" alt="IMG_20140715_201811" width="584" height="804" class="aligncenter size-large wp-image-202" srcset="https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/07/IMG_20140715_201811-743x1024.jpg 743w, https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/07/IMG_20140715_201811-217x300.jpg 217w" sizes="(max-width: 584px) 100vw, 584px" />&lt;/a>&lt;/p>
&lt;p>There’s two versions of the display with two controller chips. fbtft required some patching which I’ll send upstream after company review.&lt;/p>
&lt;p>I’m tempted to put
&lt;a href="https://www.google.com/search?q=moon&amp;#43;gerty&amp;amp;tbm=isch" target="_blank" rel="noopener">GERTY&lt;/a>‘s face from Moon on it while it drives about.&lt;/p></description></item><item><title>Shorter boot time on the Arietta G25</title><link>https://juju.nz/michaelh/2014/07/shorter-boot-time-on-the-arietta-g25/</link><pubDate>Sun, 13 Jul 2014 19:25:45 +0000</pubDate><guid>https://juju.nz/michaelh/2014/07/shorter-boot-time-on-the-arietta-g25/</guid><description>&lt;p>Short story: my
&lt;a href="http://www.acmesystems.it/arietta" target="_blank" rel="noopener">Arietta G25&lt;/a> now boots to prompt in 3.9 s instead of the stock 50.7 s. Nice.&lt;/p>
&lt;p>I had a hack about with reducing the boot time of the Arietta G25 ARM9 based Linux board. I’m planning on doing some kernel hacking so shorter is better as it cuts the build/push/test cycle down.&lt;/p>
&lt;p>My log is
&lt;a href="https://juju.nz/michaelh/michaelh/nppilot/boottime.html">here&lt;/a>. I pulled the usual tricks like switching to custom init scripts (eck), dropping udev for mdev, and doing things like USB Ethernet initialisation as late as possible.&lt;/p>
&lt;p>I had a few surprises: LZO is faster than Gzip (despite being bigger and taking longer to load from SD), -O2 is faster to boot than -Os (despite being heavier on the cache), and switching from 115200 baud to 460800 also made a difference.&lt;/p>
&lt;p>This is all against a Chromebook host with Crouton. The USB Ethernet also works fine once I switched the board from EEM to ECM mode.&lt;/p></description></item><item><title>Unstable heading</title><link>https://juju.nz/michaelh/2014/02/unstable-heading/</link><pubDate>Sun, 16 Feb 2014 19:48:42 +0000</pubDate><guid>https://juju.nz/michaelh/2014/02/unstable-heading/</guid><description>&lt;p>The replacement wishbone arrived so the cars in good shape, but still no luck with the heading controller. I can get it to slowly oscillate along a straight line by using a low Kp and restricting the steering, but the step response is poor. Adding a differential term based off the GPS heading didn’t help and showed up the high frequency noise you’d expect from a differential.&lt;/p>
&lt;p>I suspect there’s quite a bit of lag in the GPS heading and that it has a hard time calculating on tight, small radius turns. This seems reasonable as the heading must come from the velocity angle or difference in position. Measuring and plotting would help…&lt;/p>
&lt;p>Next step is to wire up the MPU-6050 based gyro I got off ebay.
&lt;a href="http://www.i2cdevlib.com/" target="_blank" rel="noopener">i2cdevlib&lt;/a> has a driver for it that uses the
&lt;a href="https://code.google.com/p/simplo/" target="_blank" rel="noopener">Fastwire&lt;/a> ATMEGA I2C library, but I’ve stripped out so much there’s not much original code left. The board is physically a bit tight so it’ll be tricky to fit.&lt;/p></description></item><item><title>Heading controller progress</title><link>https://juju.nz/michaelh/2014/02/heading-controller-progress/</link><pubDate>Sun, 02 Feb 2014 16:55:18 +0000</pubDate><guid>https://juju.nz/michaelh/2014/02/heading-controller-progress/</guid><description>&lt;p>The heading controller is basically working. The big changes were reducing the maximum steering angle to reducing how much trouble the controller can get itself into, and putting the gain on the dial so I could tune it while driving. There’s still a lot of slow oscillation so I I’ll add a differential term to counter how steering angle integrates to heading.&lt;/p>
&lt;p>The reliability problem has gone after switching from the golang
&lt;a href="http://golang.org/cmd/gc/" target="_blank" rel="noopener">gc&lt;/a> compiler to
&lt;a href="http://gcc.gnu.org/onlinedocs/gccgo/" target="_blank" rel="noopener">gccgo&lt;/a>. I think there’s a problem with the runtime as the whole app locks up and gdb reports all threads being in a function with ‘futex’ in the name. I want to report this to the golang team, but how do you reduce “a 10 thread 1000 line program, on ARM, on a random kernel, in the cold, in a noisy environment, sometimes locks up after 10 minutes of activity.”&lt;/p>
&lt;p>Next step is the differential term. I only have GPS heading so I’ll look at the run data and see how noisy the heading differential is. Getting a
&lt;a href="http://www.adafruit.com/products/1032" target="_blank" rel="noopener">gyro&lt;/a> is tempting.&lt;/p>
&lt;p>Actually, the zeroth step is replacing the
&lt;a href="http://www.conrad.ch/ce/de/product/232789/Reely-EL347FEL347R-Ersatzteil-Untere-Querlenker-vorne-hinten" target="_blank" rel="noopener">front wishbone&lt;/a>:&lt;/p>
&lt;p>
&lt;a href="https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/02/IMG_20140202_165208.jpg" target="_blank" rel="noopener">&lt;img src="https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/02/IMG_20140202_165208-300x225.jpg" alt="IMG_20140202_165208" width="300" height="225" class="alignnone size-medium wp-image-138" srcset="https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/02/IMG_20140202_165208-300x225.jpg 300w, https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/02/IMG_20140202_165208-1024x768.jpg 1024w, https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/02/IMG_20140202_165208-400x300.jpg 400w" sizes="(max-width: 300px) 100vw, 300px" />&lt;/a>&lt;/p>
&lt;p>I must have half broken it in the first Great Crash, and last nights glue job didn’t hold. Conrad want an excessive 50 CHF including shipping for two of them and a new bumper. German word of the day: a bumper is the much more awesome
&lt;a href="http://www.conrad.ch/ce/de/product/223353/Reely-MV1401-Ersatzteil-Frontrammer" target="_blank" rel="noopener">Frontrammer&lt;/a>.&lt;/p></description></item><item><title>Adding watchdogs to track down a halt</title><link>https://juju.nz/michaelh/2014/02/adding-a-watchdog-to-track-down-a-halt/</link><pubDate>Sat, 01 Feb 2014 20:39:17 +0000</pubDate><guid>https://juju.nz/michaelh/2014/02/adding-a-watchdog-to-track-down-a-halt/</guid><description>&lt;p>The car controller is dropping out now and again for no obvious reason. I thought it was due to the cold changing the internal RC oscillator frequency and making the serial communications unreliable, but I’ve switched to a 12 MHz crystal and it’s no better. The problem doesn’t happen inside, so I suspect it’s interference from the motor causing a serial error which the serial driver locks up on. Restarting the program without resetting the hardware clears the fault so I should be able to handle it in software as well.&lt;/p>
&lt;p>I’ve added a watchdog on all of the interesting dimensions: GPS data, GPS lock, input from the remote, heartbeats from the board, and two-way communications via a ping. Hopefully the fault will now show up in the logs.&lt;/p>
&lt;p>I’ll dump the message and error counter to the log as well to see if the rates change when driving.&lt;/p>
&lt;p>Heh, next thing you know my car will be running Borgmon…&lt;/p></description></item><item><title>Fixing bad AVR fuses the hard(er) way</title><link>https://juju.nz/michaelh/2014/01/fixing-bad-avr-fuses-the-harder-way/</link><pubDate>Wed, 29 Jan 2014 20:01:40 +0000</pubDate><guid>https://juju.nz/michaelh/2014/01/fixing-bad-avr-fuses-the-harder-way/</guid><description>&lt;p>Lesson for the day: always put the big ICs in sockets. I fitted a crystal to the AVR on the interface board yesterday and managed to brick the chip by setting the fuse values to use an oscillator that didn’t exist. Thanks for the day: the person who invented
&lt;a href="http://en.wikipedia.org/wiki/Desoldering#Desoldering_braid" target="_blank" rel="noopener">desoldering braid&lt;/a>. It’s awesome and got the pins clean enough that I could just lever the old chip out.&lt;/p>
&lt;p>I’ve now fitted a socket, a new processor, and gone to a 12 MHz crystal. This should take care of the serial baud rate problems when the chip is cold and gives me a bit more resolution on the control signals out to the servos.&lt;/p></description></item><item><title>Heading controller tests</title><link>https://juju.nz/michaelh/2014/01/heading-controller-tests/</link><pubDate>Sun, 26 Jan 2014 20:27:40 +0000</pubDate><guid>https://juju.nz/michaelh/2014/01/heading-controller-tests/</guid><description>&lt;p>The heading controller didn’t work out as well. I had one bug when converting from 0..360 degrees to -Pi..Pi radians, but most of the problems were due to reliability and a lack of speed.&lt;/p>
&lt;p>You need quite a bit of room when testing as you need to go &amp;gt; 15 km/h to get a good heading from the GPS and to give the wheels something to turn against. Using the three position switch to change modes and dump back into manual mode works well, so I only had a few low speed bumps.&lt;/p>
&lt;p>There’s a reliability problem in the communications between the I/O board and the BeagleBone which I suspect is due to temperature. I’m using the internal RC osciallator on the AVR and, according to the datasheet, the frequency may change ~0.1 MHz between my normal toasty testing place inside and the zero degrees outside. Time to fit a crystal and perhaps take it up to 20 MHz at the same time to give lower noise in the software PWM. The upgrade may be fun as I’ve soldered the AVR onto the board – if I burn the fuses wrong then I don’t know if I can recover the chip without desoldering it.&lt;/p></description></item><item><title>Speed controller test</title><link>https://juju.nz/michaelh/2014/01/speed-controller-test/</link><pubDate>Sun, 19 Jan 2014 16:26:20 +0000</pubDate><guid>https://juju.nz/michaelh/2014/01/speed-controller-test/</guid><description>&lt;p>The speed controller is working well. It’s a simple PI controller but was easy to tune and handles the moderate slope of the road OK. The speed wasn’t very stable at 10 km/s as the motor and gearing doesn’t like going that low, but it was much better at 17.5 km/h (Ethan suggested 20, I suggested 15, we compromised).&lt;/p>
&lt;p>Adding the ‘P’ term made a big difference to the step response.&lt;/p>
&lt;p>
&lt;a href="https://juju.net.nz/michaelh/video/Speed%20Controller%20Test.mp4" target="_blank" rel="noopener">Speed controller test&lt;/a>&lt;/p></description></item><item><title>It’s oscillating!</title><link>https://juju.nz/michaelh/2014/01/its-oscillating/</link><pubDate>Sun, 12 Jan 2014 19:38:36 +0000</pubDate><guid>https://juju.nz/michaelh/2014/01/its-oscillating/</guid><description>&lt;p>I’ve hooked in the demands from the rover to the control board and added a simple PID based speed controller. The three position switch on the remote takes the car from manual control to auto with speed=0 to auto with speed=10 km/h. I’ve hooked in the dial on the remote to change the Ki term so I can fiddle with the response while the car is running.&lt;/p>
&lt;p>
&lt;a href="https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/01/IMG_20140112_153303.jpg" target="_blank" rel="noopener">&lt;img src="https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/01/IMG_20140112_153303-300x225.jpg" alt="IMG_20140112_153303" width="300" height="225" class="alignnone size-medium wp-image-114" srcset="https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/01/IMG_20140112_153303-300x225.jpg 300w, https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/01/IMG_20140112_153303-1024x768.jpg 1024w, https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/01/IMG_20140112_153303-400x300.jpg 400w" sizes="(max-width: 300px) 100vw, 300px" />&lt;/a>&lt;/p>
&lt;p>
&lt;a href="https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/01/IMG_20140112_153220.jpg" target="_blank" rel="noopener">&lt;img src="https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/01/IMG_20140112_153220-300x225.jpg" alt="IMG_20140112_153220" width="300" height="225" class="alignnone size-medium wp-image-116" srcset="https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/01/IMG_20140112_153220-300x225.jpg 300w, https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/01/IMG_20140112_153220-1024x768.jpg 1024w, https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/01/IMG_20140112_153220-400x300.jpg 400w" sizes="(max-width: 300px) 100vw, 300px" />&lt;/a>&lt;/p>
&lt;p>It worked quite well, but I caused a ding while fiddling: the gain was high enough to cause the speed to oscillate (peak ~= 30 km/h, with about 5 s period) and it surged into the curb. The bumper worked well, but the rover battery moved forward and put a hole in the box.&lt;/p>
&lt;p>Next is adding a deadband to give finer control and better limits on the maximum drive and integral.&lt;/p></description></item><item><title>The driving lunchbox</title><link>https://juju.nz/michaelh/2014/01/the-driving-lunchbox/</link><pubDate>Sat, 04 Jan 2014 14:52:02 +0000</pubDate><guid>https://juju.nz/michaelh/2014/01/the-driving-lunchbox/</guid><description>&lt;p>I found a good container to house the electronics on my
&lt;a href="https://juju.net.nz/src/nppilot.git/" target="_blank" rel="noopener">never-complete autopilot project&lt;/a>. Here’s some pictures of it mounted onto the car:&lt;/p>
&lt;p>
&lt;a href="https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/01/IMG_20140104_1344421.jpg" target="_blank" rel="noopener">&lt;img src="https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/01/IMG_20140104_1344421-300x225.jpg" alt="IMG_20140104_134442" width="300" height="225" class="alignnone size-medium wp-image-105" srcset="https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/01/IMG_20140104_1344421-300x225.jpg 300w, https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/01/IMG_20140104_1344421-1024x768.jpg 1024w, https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/01/IMG_20140104_1344421-400x300.jpg 400w" sizes="(max-width: 300px) 100vw, 300px" />&lt;/a>&lt;/p>
&lt;p>
&lt;a href="https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/01/IMG_20140104_1344172.jpg" target="_blank" rel="noopener">&lt;img src="https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/01/IMG_20140104_1344172-300x225.jpg" alt="IMG_20140104_134417" width="300" height="225" class="alignnone size-medium wp-image-107" srcset="https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/01/IMG_20140104_1344172-300x225.jpg 300w, https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/01/IMG_20140104_1344172-1024x768.jpg 1024w, https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/01/IMG_20140104_1344172-400x300.jpg 400w" sizes="(max-width: 300px) 100vw, 300px" />&lt;/a>&lt;/p>
&lt;p>
&lt;a href="https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/01/IMG_20140104_1344061.jpg" target="_blank" rel="noopener">&lt;img src="https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/01/IMG_20140104_1344061-300x225.jpg" alt="IMG_20140104_134406" width="300" height="225" class="alignnone size-medium wp-image-108" srcset="https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/01/IMG_20140104_1344061-300x225.jpg 300w, https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/01/IMG_20140104_1344061-1024x768.jpg 1024w, https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/01/IMG_20140104_1344061-400x300.jpg 400w" sizes="(max-width: 300px) 100vw, 300px" />&lt;/a>&lt;/p>
&lt;p>The car is a Conrad
&lt;a href="http://www.conrad.de/ce/de/product/376809/Reely-Rhino-III-110-Modellauto-Elektro-Buggy-4WD-EP-250B-RtR-24-GHz" target="_blank" rel="noopener">Rhino III buggy&lt;/a>. It’s a cheapie house brand, but I’ve been really happy the toughness and level of technology so far. Two of the wheels fell off due to poor self-locking nuts but they were an easy fix. The mud is there for authenticity.&lt;/p>
&lt;p>The container is a lunch box which gives me a 180 x 130 mm working area, some protection, and an easy way to keep out the dust. The plastic is a bit brittle so I’ll replace it in the future. The standoffs are M6 x 60 and are far too meaty for the job. I’m a bit worried the container will flex with vibration but it should stiffen up when I screw the
&lt;a href="http://beagleboard.org/products/beaglebone%20black" target="_blank" rel="noopener">Beaglebone Black&lt;/a> into it. The clearance from the hot motor should be enough.&lt;/p>
&lt;p>Next step is power for the computer. I’m thinking a ~1000 mAh 2 cell Lipo which should give a couple of hours of life.&lt;/p></description></item><item><title>Supervisor is working</title><link>https://juju.nz/michaelh/2013/12/supervisor-is-working/</link><pubDate>Sun, 29 Dec 2013 20:51:52 +0000</pubDate><guid>https://juju.nz/michaelh/2013/12/supervisor-is-working/</guid><description>&lt;p>The supervisor for my autopilot is working. This is a fairly critical piece that runs on the AVR I/O board and handles the handover between the manual remote, the autopilot, and any safeties.&lt;/p>
&lt;p>This means I have:&lt;/p>
&lt;ul>
&lt;li>Multi-channel PWM input from the RC receiver.
&lt;ul>
&lt;li>A link with the Go based, BeagleBone hosted pilot that receives demands.
&lt;ul>
&lt;li>A state machine that handles remote to pilot handover.
&lt;ul>
&lt;li>Throttle shutdown on remote loss, pilot loss, and resume on low throttle.
&lt;ul>
&lt;li>And indicators for all. &lt;/ul>
There’s many hacks, like using polling instead of triggering on an input cycle, but it’s getting closer to being safe to try on the real car.&lt;/li>
&lt;/ul>
&lt;/li>
&lt;/ul>
&lt;/li>
&lt;/ul>
&lt;/li>
&lt;/ul>
&lt;/li>
&lt;/ul></description></item><item><title>First tries with Go</title><link>https://juju.nz/michaelh/2013/12/first-tries-with-go/</link><pubDate>Mon, 23 Dec 2013 19:20:36 +0000</pubDate><guid>https://juju.nz/michaelh/2013/12/first-tries-with-go/</guid><description>&lt;p>I’d like to learn
&lt;a href="http://golang.org" target="_blank" rel="noopener">Go&lt;/a>, so I’m considering using for the command side of my never complete self driving RC truck project. Here’s some quick notes after a night of hacking:&lt;/p>
&lt;ul>
&lt;li>
&lt;a href="http://golang.org/doc/effective_go.html" target="_blank" rel="noopener">Effective Go&lt;/a> is short, detailed, and just right if you’re happy in other languages
&lt;ul>
&lt;li>Go 1.2 builds cleanly on a Samsung ARM Chromebook in a Ubuntu Saucy Crouton chroot
&lt;ul>
&lt;li>The emacs packages are in misc/emacs. Copy to &lt;code>~/.emacs.d/lisp&lt;/code>
&lt;ul>
&lt;li>Inside emacs, try &lt;code>go-mode&lt;/code> and &lt;code>gofmt&lt;/code>
&lt;ul>
&lt;li>
&lt;p>
&lt;a href="http://golang.org/pkg/encoding/binary/" target="_blank" rel="noopener">encodings/binary&lt;/a> can encode and decode bytes to structs, so that takes care of the message parsing. &lt;/ul>
The target machine is a ARM Cortex-A8 based BeagleBone Black and so far the ARM support seems first class.&lt;/p>
&lt;p>Aside: You can do a surprising amount in GCC Go without touching the runtime. I wonder if you could write basic code for the AVR in Go?&lt;/p>
&lt;/li>
&lt;/ul>
&lt;/li>
&lt;/ul>
&lt;/li>
&lt;/ul>
&lt;/li>
&lt;/ul>
&lt;/li>
&lt;/ul></description></item><item><title>Regulator board</title><link>https://juju.nz/michaelh/2013/12/regulator-board/</link><pubDate>Fri, 20 Dec 2013 19:40:02 +0000</pubDate><guid>https://juju.nz/michaelh/2013/12/regulator-board/</guid><description>&lt;p>
&lt;a href="https://juju.net.nz/michaelh/blog/wp-content/uploads/2013/12/wpid-IMG_20131220_203548.jpg" target="_blank" rel="noopener">&lt;img title="IMG_20131220_203548.jpg" class="alignnone size-full" alt="image" src="https://juju.net.nz/michaelh/blog/wp-content/uploads/2013/12/wpid-IMG_20131220_203548.jpg" />&lt;/a>&lt;/p>
&lt;p>
&lt;a href="https://juju.net.nz/michaelh/blog/wp-content/uploads/2013/12/wpid-IMG_20131220_203523.jpg" target="_blank" rel="noopener">&lt;img title="IMG_20131220_203523.jpg" class="alignnone size-full" alt="image" src="https://juju.net.nz/michaelh/blog/wp-content/uploads/2013/12/wpid-IMG_20131220_203523.jpg" />&lt;/a>&lt;/p>
&lt;p>I’m pretty happy with this. It’s a USB to 3.3 V 1 A supply using a AMS1117 linear regulator. I used the SMT version as the pin spacing is fine for veroboard and I can hide it away on the bottom of the board. The cable is three pins to give some keying and a bit more strength and hold.&lt;/p>
&lt;p>It could use some hot glue as strain relief on the cable.&lt;/p></description></item></channel></rss>