Go Down

Topic: gyro sensor (Read 781 times) previous topic - next topic

hcwickz

Hi everyone

I am using two gyro sensor-lisy300al for the two brushless motor to stabilise my helicopter.
I had designed the graph showing deg/s for the motor . But how can i make use of the graph to do something to stabilise it ?
The speed of the brushless motor is controlled by manually adjusting the voltage.
As the gyro sensor is only calculating the angular velocity( how fast it is spinning) , what does it got to do with stabilising?



WizenedEE

If you add up all of the speeds (the output of the gryo) you'll get the angle. It's called integrating (from calculus, but it's not difficult at all). You can use the angle to tell the helicopter to lift up one side more or less so that it's always horizontal.

hcwickz

can u give me an actual formula of getting the angle? so how to use the angle to tell the helicopter to lift up one side more or less ?
On my project , i am using a tail motor which is on the far right and a main motor which is on the far left . the tail motor has a faster speed , so which side to lift more or less? left or right?
Thanks , this is my  first time doing this.

WizenedEE

Code: [Select]

void loop() {
  static unsigned int angle = 0;
  static unsigned long lastTime = 0;
  static unsigned long time;
  anglerate= analogRead(2);
  /*Scale anglerate so that it's in degrees per millisecond, centered around 0 - depends on specific gyroscope*/
  time = millis();
  angle += anglerate * (lastTime - time); /* This is the important part */
  lastTime = time;
}


If you look up integrals, the second to last line (angle +=...) is what is doing the integration. anglerate is the height of the rectangle, and (lastTime - time) is dx. In a real integral, they say that dx is infinitely close to 0, but in real life, you can only get so accurate so dx is just the time per loop.

Fenestron

I think it will be better if you dont use integral to stabilze your helis
because while you integrating the signal there will be a drift which
leads a big error after a while. It will be better if you only use the angular
velocity of the gyro to stabilize your helis. But if you wanna actually take the control
of heading
you may also use a magnetometer.

hcwickz


I think it will be better if you dont use integral to stabilze your helis
because while you integrating the signal there will be a drift which
leads a big error after a while. It will be better if you only use the angular
velocity of the gyro to stabilize your helis. But if you wanna actually take the control
of heading
you may also use a magnetometer.


Ya i know i will be using the angular velocity of the gyro to stabilize
But angluar velocityt only tell me the speed of the motor , but what does it do with stabilizing ?
any advise?

Fenestron

?f you consider the gyro output is equal to zero while helicopter is standing at a constant
heading. and if you multiply the output of the rate gyro with a constant which you tune during flight test
and add it with the heading control motor output value
( if the gyro rate is positive the motor will get faster and if it has a minus sign it will slow down)
. this can be damp the oscillations and stabilize your helis.

MarkT

[ Firstly just say the gyro knows nothing about the speed of the motor, it measures to turning of the vehicle framework ]

This is a standard problem in flight control, the keywords to search for are "inertial navigation", "6DOF", "9DOF", "IMU", "kalman filter".

Basically you combine the rate-gyro and accelerometer signals to determine the current attitude of the craft and use this to determine the correction amounts for each motor.  You can also add compass and GPS sensors into the mix for full navigation.

In the short term integrating the gyro will provide attitude information, but unless you have a 3-axis gyro it won't be very accurate for complex flight (and drifts anyway because you are integrating).  A lower bandwidth correction from accelerometer is used to cancel the drift.  Alternatively this could be done via RC, since humans can react in that timescale (so a gyro-only system stablilises only in short term, but this really is useful!).

A quadcopter is easier than an aeroplane in that it doesn't have to stray much from horizontal, which makes the maths easier I believe - for simple stabilization 2-axis gyro is probably fine (if you don't mind it spinning slowly about the vertical axis!)  To control the latter (yaw) you need a means of altering the thrust vector from one or more rotors, BTW

To calibrate your integration method you can always just set it running and turn the sensor 360 degrees, whatever value your integrating variable reaches must represent 360 degrees(!)

[aside silicon gyros are actually "rate gyros" - measure rotation rate, not angle, which is not the same thing as a standard navigation gyro (which is stable on timescales of weeks)]
[ I won't respond to messages, use the forum please ]

Go Up