Go Down

Topic: Balancing robot for dummies (Read 145 times) previous topic - next topic

Villa

Quote
It does not must be torgue, but in this case it is. At output you got torgue and you interpret it like speed. Look at my algorithm, and dont use motor speed pid.


Yeah, I understand what you mean, but my question is on what basis/theory did you make that conclusion? Could you please give me a more thorough explanation?

Another thing I wonder is about the sample time of the PID loops? How fast the driving loop, the balance loop and the heading loop should be?

Thanks,

Villa

kas

#181
Jan 02, 2011, 11:05 am Last Edit: Jan 02, 2011, 11:10 am by kas Reason: 1
Hi SnakeLT, thanks for joining the group
I understand you are from Lituania (cold is it??)  ;)
As for most of us here, English is not your native language.
Please take your time, work at your own speed, and produce structured technical information

Your bot is really cute and agile, the frame is... a CD box  :)
Which development platform are you using ??

You do not use accelerators and the reason you gave...
Quote
in long term equilibrium angle is always 0deg, so you only need to know short term angle. So in long term angle, program artifically slowly averaging angle to 0deg.
...is pretty smart 8-)

Also I don't see motor velocity in your diagram. Is it computed in the "Driving PID" bloc ??
Please let us have additional info on your control strategy, together with source code or pseudo code

I now realize that, as Villa mentioned earlier, a single PID loop will never produce a completly still robot
Also, a single encoder is not definitly enough to keep a fixed heading



kas

@niebing1987

You can definitly aquire angle with only one ACC
The angle is small and some folks assume sin(x) = x   (in radians)
Now... the ADXL202 is a dual ACC, why don't you use the 2 axis for a more linear mesurement ??  :)

Code: [Select]
     Acc = MeasureAcc() + ACC_OFFSET;
     MeaAngle = asin((FP32)Acc/GRAVITY_G);      //Measure angle by the accelerometer
Can I assume ACC_OFFSET is sensorZero[] ?
Is GRAVITY_G the gravity offset ? (  (ADC value "upward" - ADC value "downward")/2  )
Why is this value divided rather than substracted ?
Are MeaAngle and MeaAngleDot refering the same units for angle (deg, rad, quids...) ?


Code: [Select]
     ADData = ReadTLC4541();  //measure the anglespeed by the gyro 5000.0*(ADData-RefAD)/65536.0/0.67/K;
     MeaAngleDot = 0.001995*(RefAD-ADData) / K;
You use a 16 bit serial ADC to access the Murata gyro
Try changing the sign of MeaAngleDot

With so few information, those are only shots in the dark
What microcontroler are you using ? is it fast enough ?

Looking at the diagrams, ACC and Gyro are in phase
(gyro is zero when movement is inverted)
Your Kalman graph is just dead and may need different parameters
see danielaaroe post #157

Good luck in your quest  ;), keep us aware



SnakeLT

Villa, I'm not physicist and can't explain it.  In balancing robot case torgue is something like robot heigth*gravity*sin(angle), balance pid directly deals with angle. In my robot all PID's run at 100Hz.

kas, yes I'm from Lithuania, not so cold -4degC, but alot of snow.
I'm using GCC for avr, main procesor xmega. Yes speed derived from position (D term).

Angle calculation:
Code: [Select]
volatile float gOffset = 0;
float KOF = 0.004; //0.005
volatile float G_Angle = 0;
float TimeInterval = 0.01;

void GetGyroData(int GyroRaw)
{
 float GyroSpeed;
 gOffset = KOF * GyroRaw + (1-KOF) * gOffset;
 GyroSpeed = GyroRaw - gOffset;
 G_Angle += gyroSpeed*TimeInterval;
}

niebing1987

Hi,kas
Quote
Now... the ADXL202 is a dual ACC, why don't you use the 2 axis for a more linear mesurement ??  

When I firstly read the details about the robot, they just used one axis and asin, so i  :(.....but i will make the change.
Quote
Can I assume ACC_OFFSET is sensorZero[] ?
Is GRAVITY_G the gravity offset ? (  (ADC value "upward" - ADC value "downward")/2  )
Why is this value divided rather than substracted ?
Are MeaAngle and MeaAngleDot refering the same units for angle (deg, rad, quids...) ?

yes,ACC_OFFSET is the sensorZero
however, GRAVITY_G is not the gravity offset, it is the ADC value when the axis is paralleled to the gravity.
Quote
What microcontroler are you using ? is it fast enough ?
Looking at the diagrams, ACC and Gyro are in phase
(gyro is zero when movement is inverted)
Your Kalman graph is just dead and may need different parameters

my microcontroller is LPC1114, 32bit, colock 48MHz, it should be fast enough.
For my poor english, i do not understand clearly ACC and Gyro is in phase, is it right like this?

Go Up