Home
YaPIDE
QtDSO
QtDMM
QtDMM2
QtWvDialer
Bits
T.O.B.B.
IMU
Motorcontroller
News
Photos
Disclaimer
Imprint
[画像:T.O.B.B. (Terribly Overengeneered Balancing Bot)]
(http://www.geology.smu.edu/~dpa-www/robo/nbot/).
When I first saw videos of nBot I instantly knew that this is a must have toy. It took me some time to really get started with it. My first contat with microcontrollers was the PIC. The more I worked with it, the more I learned to hate it. This went up to the point that I stoped playing with electronics at all. Two years later I gave the AVR (Atmega16) a try and instantly fell in love with it. It is ridicuously easy to program ("C") and can even be debugged through JTAG. All that for a few €. T.O.B.B. is my second AVR project (The first was evertool, a excellent AVR programmer). My PCB's are still a bit clumsy (I've never really done that before) and sport some greenwire, but they work.
The current implementation of T.O.B.B. is roughly 35cm high and weights ~2.5kg. It is controlled by two homemade Atmega16 boards.
T.O.B.B. is driven by two 12V (~4Watt) motors with a gear ratio of 1:50. This was a bad idea, as the motors are too slow to handle more than roughly 2° of tilt. I already ordered two 10W motors with a gear ratio of 1:18 which hopefully will work better. The motors are powered by two 7.2V/1.7Ah NiCd battery packs.
//=======================================
// Recursive complimentary filter
// Transition frequency at 0.25%
// nyquist frequency.
//---------------------------------------
// Copyright 2008 Matthias Toussaint
// Usable under the terms of the GPL 2.0
//=======================================
// Filter 'object' definition
//
typedef struct
{
float hp_x0, hp_x1;
float hp_y0;
float lp_x0, lp_x1;
float lp_y0;
float hp_last;
float hp_int;
} CompFilter;
// very simple complimentary filter
// (0.25% nyquist hp-lp combination)
//
float comp_filter_step( CompFilter *filter,
float angle,
float rate );
float comp_filter_step( CompFilter *filter,
float raw_angle,
float raw_angle_rate )
{
// highpass filter angle rate from gyro
//
filter->hp_x0 = filter->hp_x1;
filter->hp_x1 = raw_angle_rate * (1.0f/1.003927011f);
filter->hp_y0 = filter->hp_x1 - filter->hp_x0 +
0.9921767002f*filter->hp_y0;
// integrate angle rate using trapezoidal rule
//
filter->hp_int -= 0.5f*(filter->hp_last +
filter->hp_y0);
filter->hp_last = filter->hp_y0;
// lowpass filter angle from accelerometer
//
filter->lp_x0 = filter->lp_x1;
filter->lp_x1 = raw_angle * (1.0f/2.556465999e+02f);
float lp = filter->lp_y0 = filter->lp_x0 +
filter->lp_x1 +
0.9921767002f*filter->lp_y0;
return lp + filter->hp_int;
}
//=======================================
// Savitzky-Golay 1st derivation filter
//---------------------------------------
// Copyright 2008 Matthias Toussaint
// Usable under the terms of the GPL 2.0
//=======================================
// Filter 'object' definition
//
typedef struct
{
float x0, x1, x2, x3, x4, x5, x6;
} SavgolFilter7;
float sg_derive7_step( SavgolFilter7 *filter,
float angle );
float sg_derive7_step( SavgolFilter7 *filter,
float angle )
{
filter->x0 = filter->x1;
filter->x1 = filter->x2;
filter->x2 = filter->x3;
filter->x3 = filter->x4;
filter->x4 = filter->x5;
filter->x5 = filter->x6;
filter->x6 = value;
return 0.1071429f*(filter->x6-filter->x0) +
0.0714286f*(filter->x5-filter->x1) +
0.0357143f*(filter->x4-filter->x2);
}
The following three plots show the first derivative of the respective measurement. This corresponds to the angle rate. It clearly shows that the variance in the combined output is quite close to the "better" sensor.
The last plot shows the spectrum of the complimentary filter output. I'm not 100% sure how to interpret the data, but I believe that T.O.B.B. has a mechanical resonance frequency of ~1Hz and the gearbox seems to introduce strong vibrations around 10Hz. What do you think?