If you need assistance, please send an email to forum at 4hv dot org. To ensure your email is not marked as spam, please include the phrase "4hv help" in the subject line. You can also find assistance via IRC, at irc.shadowworld.net, room #hvcomm.
Support 4hv.org!
Donate:
4hv.org is hosted on a dedicated server. Unfortunately, this server costs and we rely on the help of site members to keep 4hv.org running. Please consider donating. We will place your name on the thanks list and you'll be helping to keep 4hv.org alive and free for everyone. Members whose names appear in red bold have donated recently. Green bold denotes those who have recently donated to keep the server carbon neutral.
Special Thanks To:
Aaron Holmes
Aaron Wheeler
Adam Horden
Alan Scrimgeour
Andre
Andrew Haynes
Anonymous000
asabase
Austin Weil
barney
Barry
Bert Hickman
Bill Kukowski
Blitzorn
Brandon Paradelas
Bruce Bowling
BubeeMike
Byong Park
Cesiumsponge
Chris F.
Chris Hooper
Corey Worthington
Derek Woodroffe
Dalus
Dan Strother
Daniel Davis
Daniel Uhrenholt
datasheetarchive
Dave Billington
Dave Marshall
David F.
Dennis Rogers
drelectrix
Dr. John Gudenas
Dr. Spark
E.TexasTesla
eastvoltresearch
Eirik Taylor
Erik Dyakov
Erlend^SE
Finn Hammer
Firebug24k
GalliumMan
Gary Peterson
George Slade
GhostNull
Gordon Mcknight
Graham Armitage
Grant
GreySoul
Henry H
IamSmooth
In memory of Leo Powning
Jacob Cash
James Howells
James Pawson
Jeff Greenfield
Jeff Thomas
Jesse Frost
Jim Mitchell
jlr134
Joe Mastroianni
John Forcina
John Oberg
John Willcutt
Jon Newcomb
klugesmith
Leslie Wright
Lutz Hoffman
Mads Barnkob
Martin King
Mats Karlsson
Matt Gibson
Matthew Guidry
mbd
Michael D'Angelo
Mikkel
mileswaldron
mister_rf
Neil Foster
Nick de Smith
Nick Soroka
nicklenorp
Nik
Norman Stanley
Patrick Coleman
Paul Brodie
Paul Jordan
Paul Montgomery
Ped
Peter Krogen
Peter Terren
PhilGood
Richard Feldman
Robert Bush
Royce Bailey
Scott Fusare
Scott Newman
smiffy
Stella
Steven Busic
Steve Conner
Steve Jones
Steve Ward
Sulaiman
Thomas Coyle
Thomas A. Wallace
Thomas W
Timo
Torch
Ulf Jonsson
vasil
Vaxian
vladi mazzilli
wastehl
Weston
William Kim
William N.
William Stehl
Wesley Venis
The aforementioned have contributed financially to the continuing triumph of 4hv.org. They are deserving of my most heartfelt thanks.
// minimum high of 600 us for -90 degrees, with +90 degrees at 2400 us, 10 us per degree // timer timebase set to us units to simplify the configuration/math
TIM3->CCR1 = 600 + ((servo_angle[0] + 90) * 10); // where angle is an int -90 to +90 degrees, PC.6 TIM3->CCR2 = 600 + ((servo_angle[1] + 90) * 10); // where angle is an int -90 to +90 degrees, PC.7 TIM3->CCR3 = 600 + ((servo_angle[2] + 90) * 10); // where angle is an int -90 to +90 degrees, PC.8 TIM3->CCR4 = 600 + ((servo_angle[3] + 90) * 10); // where angle is an int -90 to +90 degrees, PC.9 } }
Registered Member #2431
Joined: Tue Oct 13 2009, 09:47PM
Location: Chico, CA. USA
Posts: 5639
OK heres the list:
-- lets just talk about the pitch axis for simplicity, the other axis' will be parallel and similar anyway. -- lets define the pitch axis as a "Y" axis, and nose up means positive above zero, while nose down means negative degrees below zero.
-- there are gyros in the kk board, but i dont have access to them or thier code. -- i want to seperate navigation and stability, focusing only on stability for now. i want it to hover, well do more later -- Ill keep my gyros 10 times slower than the kk's gyros, to avoid aliasing and or oscillating feedback. -- ill post a schematic below of the control flow
Registered Member #49
Joined: Thu Feb 09 2006, 04:05AM
Location: Bigass Pile of Penguins
Posts: 362
I'm not going to look up the specs for all these board, why don't you make a simple post regarding your plan?
What is a KK board. Its expecting servo PWM input... so this must be some kind of off the shelf gyro?
If that board isn't controlling your stability adequate... why are you using it? I'm not sure I follow the logic of having a micro running a PID controller... feeding into an off the shelf PID controller.
Registered Member #2431
Joined: Tue Oct 13 2009, 09:47PM
Location: Chico, CA. USA
Posts: 5639
AndrewM wrote ...
I'm not going to look up the specs for all these board, why don't you make a simple post regarding your plan?
i wasnt expecting anyone to do so.
AndrewM wrote ...
What is a KK board. Its expecting servo PWM input... so this must be some kind of off the shelf gyro?
If that board isn't controlling your stability adequate... why are you using it? I'm not sure I follow the logic of having a micro running a PID controller... feeding into an off the shelf PID controller.
well it doesnt seem to be worth a dam, we can get rid of it. all it does is take in a RC control from the human, pass it to a gyro stability program and spilt up that result to the serovs and fans. Minsoo kim didnt put accelerometers on it so it cant hold it self level. for 240-350$ more i guess i could buy his lame upgrade, the black board which im using know cost me 140$ already.
what id like to do, since he won t answer my emails, is just to release an open source code here at 4hv that anyone could load on an STM32 board for $9-$25 then go fly. then yould need some spark fun orsimilar supplier of the imu, but still its cheaper and better.
Registered Member #49
Joined: Thu Feb 09 2006, 04:05AM
Location: Bigass Pile of Penguins
Posts: 362
Yeah thats what I thought. I have a similar unit for fixed wing aircraft and it works pretty well... but I'd be pretty wary about dropping it into something like this. From your videos its just not up to snuff so I don't think adding another PID layer upstream is going to be a good solution.
So you basic sensor suite is... 3 axis gyro and 3 axis accel? And all of this is accessible by your STM32?
I think your basic case should be a stable hover... that is, all rates are zero and the angle of the gravity vector equals your user's commanded angle (ie. the stick position). You said in your other thread you want to control Pitch first (indeed I think that will be your toughest axis to control). So lets call pitch "θ"...
Proportional error: E_p = θ_dot_gyro
Integral error: E_i = θ_actual - θ_commanded
The derivative term is harder since you don't have a derivative sensor. You'll want to make sure you have nice clean data coming out of your rate sensor, otherwise your derivative terms can go nuts; if you can't clean the data then you'll want to implement a running average or something, depending on your sample rate.
To be honest I'd try PI control first... because I bet that even if you DO implement D control that it will be so noisy you'll need to turn the gain down to uselessness.
Then your loop output would be:
u = Ki * E_i + Kp * E_p
You'll need to write your equations of motion in order to determine how to use the u signal... but almost surely you'll want u to signal the motion of your fan angle servos together (ie. left and right side equally).
Registered Member #2431
Joined: Tue Oct 13 2009, 09:47PM
Location: Chico, CA. USA
Posts: 5639
AndrewM wrote ...
Yeah thats what I thought. I have a similar unit for fixed wing aircraft and it works pretty well... but I'd be pretty wary about dropping it into something like this. From your videos its just not up to snuff so I don't think adding another PID layer upstream is going to be a good solution.
yep we'll ditch the KKmulticopter board, and move on.
AndrewM wrote ...
So you basic sensor suite is... 3 axis gyro and 3 axis accel? And all of this is accessible by your STM32?
yep, i can access the gyro at 400 or 800 hz, and the accel at 400 to 2000 dps... this imu is fully under my control and coded right to the STM32.
AndrewM wrote ...
I think your basic case should be a stable hover... that is, all rates are zero and the angle of the gravity vector equals your user's commanded angle (ie. the stick position). You said in your other thread you want to control Pitch first (indeed I think that will be your toughest axis to control). So lets call pitch "θ"...
Proportional error: E_p = θ_dot_gyro
Integral error: E_i = θ_actual - θ_commanded
ok, my brain is slowing...
AndrewM wrote ...
The derivative term is harder since you don't have a derivative sensor. You'll want to make sure you have nice clean data coming out of your rate sensor, otherwise your derivative terms can go nuts; if you can't clean the data then you'll want to implement a running average or something, depending on your sample rate.
To be honest I'd try PI control first... because I bet that even if you DO implement D control that it will be so noisy you'll need to turn the gain down to uselessness.
ok, well we can leave out the D term for now, but i was going to use a complimentary filter as suggested by big5824, to "de-noise" the signal.
big5824's site :
raw data
filtered with complimetary scheme
AndrewM wrote ...
Then your loop output would be:
u = Ki * E_i + Kp * E_p
You'll need to write your equations of motion in order to determine how to use the u signal... but almost surely you'll want u to signal the motion of your fan angle servos together (ie. left and right side equally).
ok i see the above as a simple PI type deal, i can figure out how to code that, but what do you mean by "You'll need to write your equations of motion ..."
Registered Member #49
Joined: Thu Feb 09 2006, 04:05AM
Location: Bigass Pile of Penguins
Posts: 362
Patrick wrote ...
ok i see the above as a simple PI type deal, i can figure out how to code that, but what do you mean by "You'll need to write your equations of motion ..."
Write equations for the pitch rate, θ_dot, in terms of the fan state.
For a PI controller it'll be simple, like:
θ_dot = F_fan * distance_to_c.m. / I_pitch
distance_to_c.m. will be a function of the fan servo angle... when you write that equation you should see immediately why steve and I told you to get your fans as far above the center of mass as possible.
When you have that equation you can model the system and simulate how to utilize the output of the loop, u.
Eventually when you implement a more complex controller you can add things to the EOM, like the acceleration of the fan servos; changing the fan angle will jerk the body of your craft around, for example. You can make the EOMs as complex as you like.
Also: keep in mind that you'll need a solution to correct your gyro drift - this is apparently where people have implemented kalman filters and the like. I haven't ever built a control loop like this so I don't know if its a necessity or a "nice-to-have." Seems to me that, as a first order attempt, a simple high pass filter on the gyro output before the controller should be enough to get things working...
Registered Member #2431
Joined: Tue Oct 13 2009, 09:47PM
Location: Chico, CA. USA
Posts: 5639
AndrewM wrote ...
Patrick wrote ...
ok i see the above as a simple PI type deal, i can figure out how to code that, but what do you mean by "You'll need to write your equations of motion ..."
Write equations for the pitch rate, θ_dot, in terms of the fan state.
For a PI controller it'll be simple, like:
θ_dot = F_fan * distance_to_c.m. / I_pitch
distance_to_c.m. will be a function of the fan servo angle... when you write that equation you should see immediately why steve and I told you to get your fans as far above the center of mass as possible.
When you have that equation you can model the system and simulate how to utilize the output of the loop, u.
Eventually when you implement a more complex controller you can add things to the EOM, like the acceleration of the fan servos; changing the fan angle will jerk the body of your craft around, for example. You can make the EOMs as complex as you like.
Also: keep in mind that you'll need a solution to correct your gyro drift - this is apparently where people have implemented kalman filters and the like. I haven't ever built a control loop like this so I don't know if its a necessity or a "nice-to-have." Seems to me that, as a first order attempt, a simple high pass filter on the gyro output before the controller should be enough to get things working...
ok i see what youre getting at with the equation now.
are you meaning dot product for theta_dot? F = newtons dist = meters what units are I_pitch? is that an angle?
This site is powered by e107, which is released under the GNU GPL License. All work on this site, except where otherwise noted, is licensed under a Creative Commons Attribution-ShareAlike 2.5 License. By submitting any information to this site, you agree that anything submitted will be so licensed. Please read our Disclaimer and Policies page for information on your rights and responsibilities regarding this site.