Due to the number of inquiries I get from my YouTube videos of Gizmo, I wanted to post here some of the frequently asked questions.
I’m glad you’re studying to be an engineer. It can be an extremely fun, challenging, and rewarding career. However, it’s important that you learn something before you take another single derivative. Using Google to find someone to give you all the answers to your project really cripples the purpose of doing the project in the first place. Sure, someone else may have already done what you’re trying to do. Sure, I learned from others and you will too. However, I firmly believe the best way you can help out yourself and your education is to step in there and try something. The first try will likely be wrong, and that’s why we as engineers do design analysis before we cut metal. With the prevalence of great tools like Matlab and Simulink (usually with Student versions available at a huge discount), as well as the low cost of cheap robotics parts, do a little math, run a few simulations, and then build something. You’ll learn something from each step. When you find yourself completely stuck and have specific questions to ask about why your solutions might not be working, then hit up the vast knowledge of the internet.
Posing questions to me before you have done any of this doesn’t help either of us. I’ve responded to hundreds of questions about Gizmo, but I generally only respond to those that are asking questions based on the results of whatever they’ve already tried. Please don’t ask me to do your project for you, and please don’t ask me to just give you my code. The code is extremely simple, the core of it is only a handful of lines. It’s all that you’ll learn getting to those few lines that is the real reward for doing the project in the first place.
I was lucky enough to purchase them from a co-worker that had them on hand. They are 24V Pittman DC gear motors, 19.1:1 gearing ratio, with very high count encoders on the motors. The part number is GM9236S021. For the 6” wheels that I have, this allows the robot to “cruise” at about 1.3 m/s (intentionally close to human walking speed) and still have enough velocity to accelerate to overcome most disturbances. The actual speed itself isn’t important as long as the motors have enough torque to accelerate, and the peak speed is fast enough to overcome disturbances the robot might encounter.
Backlash in the gearbox IS extremely important. Cheap motors will have a lot of backlash. Backlash will directly impact how smoothly the robot balances and how far it will oscillate back and forth when standing still.
My general suggestions on motors are:
1) If you’re going to put your money anywhere, get good geared motors with high quality gearboxes.
2) Don’t drive directly off an output shaft that uses a bushing (or drive one with a tensioned belt).
3) Encoders, either on the motor, output shaft, or wheels are desirable, if not absolutely necessary.
I generally chose what I had on hand or could purchase locally at low cost.
Wheels – The wheels are model airplane wheels from a hobby shop. I chose these wheels because they are very lightweight and thus have very low inertia. They were also the right size. They have fine traction on hard surfaces or carpet, but poor traction on gravel or sand.
Hubs – The hubs were custom turned a lathe using a large bolt as a starting piece. The hubs are less than optimal – the set screws that hold them to the shafts tend to work themselves out over time as the robot balances. This could be improved by using two set screws at an angle to each other, but I’ve just never gotten around to doing this.
Gyroscope – Analog Devices ADXRS150 single axis gyroscope. These are available already soldered to a board from a number of suppliers around the net. I used a custom board at the time. These days, just about any gyro will work, and I would probably use a digital variety. The rate range needs to be above about 50 degrees per second, but if you use more than about 300 degrees per second you’ll likely start loosing resolution that will be necessary for proper state estimation.
Accelerometers – Analog devices ADXL202 dual axis analog accelerometer. These are also readily available, although these days digital versions are probably easier to use. It can be done with one axis, but it’s more robust with two.
Microcontroller – STR710 microcontroller development board. I had one, so it was free. I also have access to a rather expensive toolchain for this part, but there are free options out there. The choice isn’t that important, there’s no reason you can’t make it work on a moderate 8-bit micro-controller. If you have no bias, the STM32 series of processors is really nice and you can get a very cheap development board for <20USD from ST as well as free development tools and software.
This page attempts to share the design, but this page is also as far as I’ll go. I won’t share the actual code because it’s very straightforward and I feel like it’s creation is one of the more rewarding parts of the endeavor.
Yes, I have one somewhere. No, I won’t send it to you. There is a simple reason for this: it’s a classic design problem for engineering students, and you should take the time to go through the process yourself. However, if you’re not an engineering student, know that you don’t really need a complicated model to have a working robot. The control laws described below can be easily coded and tuned by hand through trial and error. The state space model is also readily available (see Google, or Ogata, Modern Control Engineering). I found Simulink to be the most helpful tool in the design process, and used it to validate the control laws I wanted to try before coding them.
I’m fairly certain this problem can be solved via just about any reasonable control law. I know it’s been solved using PID, fuzzy logic, LRQ, State Space, analog controllers and likely many more. I used basic linear PID controllers and tuned them by hand.
I use two cascaded loops, one for velocity control, the output of which is a commanded angle which becomes the reference input of the angle control. Note that this is possible without a direct-coupling or “feedforward” term because the commanded angle is zero for a steady state velocity. Non-zero angles will always result in vehicle acceleration.
The inner loop uses as it’s feedback term the angle estimate and controls via a Proportional-Derivative controller. Since the angle derivative is the output of the gyroscope, we shouldn’t have noise issues related to taking a simple numerical derivative. If you’re starting out, do this part as soon as you have a working state estimator. You should be able to get this working and basically balancing without any other controls and the vehicle should basically balance, although it will probably wander with a steady state error and may slowly accelerate smoothly until it’s going to fast to fall over. This happens because the state estimate isn’t perfect and may not register the slow acceleration relative to the very small gyroscope rates.
The outer loop control is a Proportional-Integral controller which outputs a commanded angle into the inner loop controller. The velocity command comes from the (wireless) control link via a joystick. The integral term compensates for trying to balance at the wrong setpoint, since balancing at a non-zero angle will result in a constant acceleration and increasing velocity. In this way the robot can handle changes in the balance point due to loads.
There is also some dead-band compensation in the PWM controller which helps to reduce the non-linearity in the PWM due to shaft and rolling friction. This is required since there is some small PWM value which should be the minimum to turn the wheels under load, and that value will very likely be non-zero. I don’t have any backlash compensation, but I have good motors with low gearbox slop.
The orientation of the robot is sensed through the use of a single axis Analog Devices (ADI) analog gyroscope (ADXRS150) and a dual axis ADI analog accelerometer. None of these sensors alone is sufficient to measure the tilt angle of the robot.
However, we can use the fact that the accelrometers, over the long term, can be used to estimate the average tilt (plus the high-frequency platform acceleration), while the gyroscope will measure the instantaneous tilt rate of the robot. Since the gyroscope isn’t perfect and has some amount of bias (it reads a value even when sitting still), simply integrating the gyroscope will result in an estimation of tilt that will “drift” over time.
If we use the arc-tangent function to derive an angle from the X (forward) and Z(down) accelerometers, we will have one estimate of our tilt angle. However, while this angle will be correct when the vehicle is still (or more precisely, not accelerating), it will be corrupted when the vehicle is accelerating (e.g the motors drive the wheels causing the robot to move). However, we can use this as one measurement of the vehicle tilt, one that we know may be inaccurate in the short term (meaning we can’t trust any one measurement).
Gyroscopes, as good as they have become recently, are also not perfect. When sitting perfectly still, they may measure a value which is non-zero. This is called bias, and is due to effects within the device as well as environmental effects such as temperature and (in poor gyroscopes) vibration. If we integrate the gyroscope measurement, we will integrate the bias along with the sensor measurement. This means that the integrated gyro value will drift over time. This can be seen by integrating a gyroscope which is stationary and observing the integrated value over a few minutes. The value will not stay at zero, but will instead have random angular walk plus constant drift due to bias.
The solution I use is a Kalman filter to optimally combine the accelerometer’s measurement of angle with the gyroscope’s measurement of angle. The nice thing about the Kalman filter is that in the process of crunching the numbers, one output is a measurement of the gyro bias, and this can be measured along with the robot’s angle.
However, a Kalman filter is actually overkill for this problem. The reason is that a Kalman filter actually changes how much it ‘trusts’ the accelerometers versus how much it ‘trusts’ the gyroscope over time. However, we don’t really need that ‘trust index’ to change over time in order to get a usable measurement of angle. The simple answer is a complimentary filter. Instead of explaining that here, check out this paper that does a nice job of explaining it.
My wife Katie and I started the hike at the Mahogany Flat Campground after overnighting at Wildrose. From there, it’s 7 miles to the Telescope Peak summit via the normal trail. You don’t get a good view of Telescope until about 1.5 miles in, and I was having some knee pain starting out, so I left the skis and boots in the car.
When we rounded the corner with Telescope in the distance, the magnitude of the snow made me regret leaving the skis enough that I sent Katie on to Arcane Meadows to start lunch, and trail-ran back to the car to get the gear. Hiking up 2000 ft to meet her at Arcane Meadows (between Bennett and Rogers Peaks), we had lunch and started the long traverse to the base of Telescope.
After the 2 mile traverse when we started climbing again, she sent me off without her but kept up within a few hundred yards until the trail turned into a class 2 scramble. I continued up, alternating between the sunny side and snowy side, trying to find the trail where I could. What was left of the ridge cornice had turned into 1-2ft deep sun cups which made walking in them very difficult. A week of above-freezing temperatures softening the snow meant that even the bottom of the cups would give way another foot or so. I followed a kind Telemarker’s tracks straight up a snowfield to the top, kicking steps into the 45 degree grade and hoping I didn’t end up a yard sale before I even strapped on the skiis.
Once at the top, I waved hello to the Telescope summit a hundred yards to the south (but only about 10ft higher) and found the Tele’s tracks in the snow. The ride down was fun but difficult. The snow was nice spring corn at the top, but had a tendency to drop out in the shadows lower down. My legs were complete toast from the 10 miles I’d already hiked, so after the first few turns I could only do 1-2 at a time. I also was determined to not ski below the ridge; by this point I was done with up-hiking, so I ended up traversing more than I had to being extra-careful.
The video breaks where I ran the snow out. I could have skiied another 1,000 ft down at this point, but it would have meant hiking back up to the ridge before continuing on the 6 miles back to the car. I opted instead to ski what was left of the cornice. In my hiking (in my alpine downhill boots) and skiing and hiking to deal with the cornice (and the lack of it in some places), I forgot to turn the camera back on. Basically the best skiing was on the 60 degree steep, 10-20 ft tall east face of the cornice; I was thankful that my edges were sharp.
By the time I checked the camera, I was cruising down the easy part, and passed Katie as she snapped a few photos. I asked my legs to put in a good speed check for a better photo op, but they kindly refused. Had I been on A/T skis I could have skated up a little way and then skiied down another half-mile along the ridge, but at this point I was just too tired. I collapsed and waited for Katie to catch up.
It’s been a dream of mine to ski this since the first time I was on Telescope in May 2006, and now it’s finally done. I’m glad I did it, but I probably won’t do it again unless I’m in much better shape. Skiing Rogers peak (10,000ft) from either the Charcoal Kilns or Thorndike Campground would be great fun with the proper A/T gear in the dead of winter when there is good snow coverage.
Thanks to Blake Poe and others that have gone before proving this isn’t the craziest thing in the world to do. Thanks to Katie for being a trooper and carrying my food and extra water, and for the awesome dinner back at Mahogany. And finally, thanks to the 50ish telemarker that kicked my ass up and down Telescope, in Tele boots all the way. I hope I’m in half as good shape as you when I’m your age.
I headed up to Mt. Waterman, my favorite local SoCal mountain, alone early on Sunday morning. To my amazement, the road up the mountain was icy down low, snow packed up high, but open all the way. The plow drivers waved as I drove on through almost alone on the road. When I arrived at 8:45, the parking lot was almost empty but the lifts were already running.
Being the first open day of the season for Mt. Waterman (snow from Heaven, not from Hoses), it was a bit low tide out on the mountain. Waterman has some incredible terrain features (read big rocks to huck), but on this day they were a bit exposed. However, I quickly found that the coverage was more than adequate due to a good foot of solid wet base snow that was subsequently covered by a foot plus of light, fluffy, Colorado Champange. This was SoCal skiing at it’s absolute best.
This was only my second time at Mt. Waterman, so I didn’t know the mountain too well and stayed mostly on-piste. I ran laps down to empty lift lines and only found out later that the road was supposed to be closed but the county had forgotten to send CHP early to block the road. This resulted in less than 200 of us having the powder day of the decade while the rest of SoCal sat in lines on icy and snowpacked roads hoping they had woken up just a few minutes earlier.
Blake, Andy, and I headed up to Mt. Baldy after a week’s worth of storms dropped 5-7ft on the local Southern California ski area. Roads were restricted, lines were long, but we made the best of the day and got in some stellar runs, including skiing the east face of Mt. Harwood after hiking 500ft up from the top of chair 4.
Took a chance last weekend to hit up a little known SoCal mountain on a partial powder day (it snowed 18-24 inches 36 hours prior). The powder wasn’t quite Colorado Champagne, but it was pretty darned good for SoCal. If you consider yourself an decent skiier, and you can handle blacks most of the time, Waterman is your place. They only have a few green and blue runs (which are good enough for first timers, but not for someone just wanting long cruisers), but they have a good number of steep runs in and out of the trees.