Half a year after our terrible performance at SparkFun’s AVC competition, I’ve analyzed the data collected during one of the runs and have figured out the mistakes I made in the navigation software. I had previously tried looking at the data, but needed to be able to visualize it to make any sense of it all. My first step was to generate a KML file from the data collected during the run, showing the planned waypoints as well as the recorded GPS locations. I then imported the KML file into Google maps so I could see the route taken by the robot.
The blue stars indicate the planned waypoints. The red pins show the actual route of the vehicle. This seems accurate and shows that the vehicle took a sharp right turn after the first corner and seemed to be heading for the wrong waypoint. The placemarks on the map are annotated with notes including the compass bearing and target bearing and shows that the navigation software had calculated a bearing of 49 degrees. The robot wasn’t even accurately keeping to that bearing, but that’s another story.
Next, I found an online calculator for calculating the bearing between latitude and longitude locations and entered one of the GPS co-ordinates and the target waypoint. This calculated an angle of 41 degrees instead and mapped out the route on Google maps too, which confirmed that this was correct route.
Clearly, I had an error in my math. Because I was running on an Arduino microcontroller with limited computing power, I had chosen to implement a simple algorithm based on trigonometry, using the delta of latitude and longitude between the two points to form a right-angled triangle and then used the atan() function to calculate the angle. This was a huge mistake and didn’t take into account that at a latitude of 40 degrees, one degree of latitude is 68.99 miles, whereas one degree of longitude is 53.06 miles. After modifying the simple trig math to scale the latitude and longitude deltas accordingly, the calculations become correct, within a reasonable tolerance.
UPDATE: I have now run simulations of one million random pairs of latitude/longitude co-ordinates within the bounds of SparkFun’s parking lot to compare the results of the modified simple algorithm versus the accurate and more expensive algorithm and the difference between the two algorithms never exceeds 0.1 degrees.
This wasn’t the only issue affecting our performance, but was one of the main factors. The compass wasn’t calibrated either and wasn’t giving accurate readings, but I am hoping that this is now resolved. I’ll be taking G-Force out for some new test runs soon to see if these changes help.
I’ve started tinkering again with our autonomous vehicle that failed so miserably at Sparkfun AVC 2015. My focus so far has been on the compass, which I suspect was one of the bigger contributors to our poor performance. Some tests confirmed that the compass was very inaccurate so I took the time to learn how to calibrate the compass this weekend and the compass seems to be very accurate now. I didn’t run through this process when we competed in 2014 and we did pretty well then, so maybe we just got lucky.
After studying the datasheet for the HMC6352, I forked the Sparkfun Arduino library and added an example sketch for performing calibration. The library is available here. The calibration process requires the compass to be rotated on a flat surface at a steady pace. I placed the vehicle and my laptop on a lazy susan so I could rotate it with both hands during the calibration process.
Over the Christmas break, I have set up a dedicated web site as a central place to put information for my voice changer shield kit. I have also converted the software into an Arduino Library with example sketches, making installation simpler. The ring modulator example sketch is also now much easier to understand as a result, since all of the low level SPI code has been moved into the library.
For more information, please see the new Ultimate Voice Changer web site.
I have 12 voice changer kits in stock over on my Tindie store. These kits are for an Arduino Uno shield that lets you create various voice effects, such as a ring modulator effect, as used to create the voices of Cybermen and Daleks in Doctor Who. For more information, see my main Ultimate Voice Changer Arduino Shield page.
I wanted to print something on my Taz 4 today, but I was greeted with an “Error: MINTEMP” message when I powered the printer up. I assumed it was simply down to my garage being too cold (it was somewhere around 20F as far as I know). I contacted Lulzbot support to see if there would be issues starting the printer up in these temperatures (after overriding the minimum temperature somehow) and they told me the issue was not related to temperature but meant there was a bad/broken connection somewhere.
Their support team was super helpful, especially considering this was a Sunday over a holiday weekend. I’m really happy that I purchased from them. Anyway, I followed their diagnostic process which involved bringing the extruder into the house to warm it up to room temperature and then measure the resistance of the thermistor and another component. Everything checked out OK and they recommended tracing the wiring back to the controller board to make sure everything was connected OK.
However, I connected the now-at-room-temperature extruder back onto the printer and everything started working again, so this really was an issue of the extruder just being too cold.
Although I got things working again, it wasn’t much help as prints wouldn’t stay adhered to the glass platform presumably due to the cold ambient temperature in my garage. It looks like I’ll have to wait a couple days until the temperatures are back in the 50’s and try again.
March 2016 Update
I purchased a small space heater for $25 from a local hardware store and have that inside the enclosure. On a cold day, I run the space heater for 15 minutes or so until the printer is warm enough to turn on and then I turn the space heater off. I am also now draping a blanket over the front of the enclosure to keep cold air out. Also, to prevent prints from peeling up at the edges, I applied a coating of UVA glue (a regular glue stick) to the bed when cold. I only had to do this once and now ABS sticks to the bed so well that I have to use a rubber mallet to remove parts!
I started learning the Rust programming language about a week ago and have high hopes for this becoming one of the main languages I start to use professionally. Before that though, I wanted to find a hobby project to give me more motivation for working with the language on a regular basis, so I spent much of this weekend researching how to get Rust running on my Beaglebone Black so that I could get the traditional “Hello, World” example running (in other words, making an LED blink).
There aren’t official releases of Rust or Cargo for BBB yet, and I gave up on compiling Rust from source after hitting an internal compiler error in gcc (possibly due to lack of RAM). Luckily there are some unofficial binaries out there that work great. I also found the sysfs_gpio crate (Rust library) for GPIO manipulation.
I also tried creating a Docker image so that I could compile projects on my desktop, but cross-compile for deployment to the BBB. I was able to build the projects OK, but ran into an issue where a different GLIBC version was installed on the BBB, so the projects wouldn’t run.
I’ve created a github repo for my BBB/Rust experiments. So far, I only have the blinking LED code working, which is really just the example from sysfs_gpio, but now that I have this working, I’m sure I can start building out some new crates for working with various sensors.
When I purchased my 3D printer almost a year ago, my main interest was in being able to design my own objects to print. I was able to print some simple mounts using SketchUp but have struggled to advance beyond simple designs for a long time. Recently, I learned about OnShape from my local makerspace. OnShape is a browser-based, hosted CAD system and is free to use if you make your designs public (you can have 10 private documents too).
I’ve been learning how to use OnShape for around a month now, and have finally been able to come up with some relatively complex designs. I’m currently designing all the parts for a Dalek as this is a good way to force me to learn many features, given the different geometries involved. Here is the dome and eye stalk, which are modeled as separate parts, but one of the nice features of OnShape is that you can then put these parts together to make sure they fit.
OnShape has some really great video tutorials that have helped me get up to speed. I expect I’ll be learning a lot more over the coming months. My end goal is to be able to make some mechanical parts and start creating some fun robots / animatronics.
With Halloween approaching, I recently ordered a latex Ood mask from China for around $25. It’s pretty realistic, but the costume would not be complete without a translation sphere, so I had to make one!
Here’s a photo of me trying out the full costume for the first time.
This was a really simple project that was fun to put together. The starting point is a 100 mm diameter acrylic fillable ornament. You can find these in hobby stores pretty easily. The ornament has a plastic hoop attached for hanging the ornament on a tree, but this is easy removed with a hacksaw or craft knife.
The next step is to use some “frosted glass” spray paint (I used the Rustoleum version). I sprayed both the interior and exterior of the two halves of the ball. Tip: spray a little at a time and be patient for each layer to dry a bit before adding the next.
For the tubing, I ordered some beverage tubing from Amazon and cut a 2 foot length. To attach the tube to the sphere, I drilled a small hole through the bottom of one of the halves of the sphere and hot glued a screw in place. Another tip: when drilling acrylic, start with the smallest drill bit you have and drill hole, then repeat as required, moving up one size at a time. This reduces the risk of the acrylic shattering.
To attach the tube, I put some hot glue on the screw and then slipped the tubing over the top, being careful not to get hot glue on my fingers.
To make this look authentic I needed a silver/gray ring around the sphere. I used my 3D printer to create the ring. Another approach may have been to cut a strip of foam. The trick here is to attach this ring to the half of the sphere with the recessed lip, leaving a gap for the other half of the sphere to attach still.
That concludes the main part of the construction. The final step is to add some LED lighting! The simplest option here is to simply tape LEDs onto coin batteries. This has the advantage of being small too.
And here is the end result:
I’ve owned a TAZ 4 for around 9 months and it has been a pretty frustrating experience to date, resulting in me getting very little value out of this printer so far.
The issues are not specific to the TAZ 4, which I think is a great piece of hardware, but more an issue with having it sitting in my home office. I work from home, and generally work long hours, meaning that I haven’t been able to use the printer often (the combination of noise, heat, and fumes mean I can’t be in the room for extended periods when it is running). Also, I’ve run into issues with prints cooling down too quickly and peeling off the bed.
To solve all of these problems I have now moved the printer to the garage and built a very simple and low cost enclosure out of plywood. The first test print ran for nearly 6 hours and turned out perfectly. I should have done this right from the start.
The cost of the enclosure was well under $100 and the bill of materials (all from Lowes) was:
- 1/4″ x 24″ x 48″ plywood sheets x 4 (back, sides, top)
- 1/4″ x 3″ x 48″ plywood strips x 2 (top and bottom of front)
- 1/4″ x 6″ x 48″ plywood strip x 1 (to fill gap in top)
- 5/8″ x 5/8″ x 36″ wooden beams (for supports)
- 18″ x 24″ acrylic sheets x 2 (the doors)
- Hinges (for the doors)
- Magnetic pads (to keep the doors closed)
- Wood glue and wood screws (very short ones)
The basic size of the enclosure is 36″ W x 30″ D x 24″ H, although mine ended up being 36 3/4″ wide due to a miscalculation of how the hinges would work, and this is why there is a 3/4″ gap where the doors don’t quite meet.
I managed to find a great low cost workbench to put the enclosure on. The workbench is made by Edsal and the SKU is UBM4830. I managed to buy this for $108 including delivery from Walmart.com (fulfilled by zoro tools). The workbench is 30″ D and is very sturdy.
The enclosure does not have a base and can therefore be lifted off when required. I had thought about making a lid with hinges but my woodworking skills are limited and I didn’t want to over think this.
For lighting, I’m using some holiday lighting but I plan to make something a bit nicer using some Adafruit neopixels soon.
Well, that could have gone better… SparkFun AVC 2015 is over and was an epic fail for G-Force 2.0, our entry this year. G-Force 2.0 was a minor update of our 2014 entry, which came in second place in peloton class. This year, the chassis was made from laser cut wood and was much smaller and lighter than last year, allowing me to use faster motors with lower torque. Other than that, the electronics and software were largely the same. I really don’t know why it performed so badly. The navigation was very unreliable and I’m wondering if it is because the compass was closer to the motors and the ground this time and maybe was picking up interference.
I didn’t have much time for testing before the event and that ultimately was the issue. I have the luxury of time now to do more testing before next year.