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.
Registered Member #2431
Joined: Tue Oct 13 2009, 09:47PM
Location: Chico, CA. USA
Posts: 5639
hey everybody my brain is not able to wrap around this problem. i need to go from angles and velocities to RC servo PWMs, so am i not understanding the implemantation of a pid?
is it possible for a pid to not be aware of the pwm, and only the result? ordoes the output need to be "normalized" somehow to be complatiable with the rc pwm?
Registered Member #1792
Joined: Fri Oct 31 2008, 08:12PM
Location: University of California
Posts: 527
What variable are you trying to control? My understanding was that servomotors are already controlling their shaft position based on the input pulse time so there's no need for a PID loop. If you're trying to control velocity I'm not sure you can with a servomotor because you don't have feedback from the shaft sensor.
Registered Member #2431
Joined: Tue Oct 13 2009, 09:47PM
Location: Chico, CA. USA
Posts: 5639
Mattski wrote ...
What variable are you trying to control? My understanding was that servomotors are already controlling their shaft position based on the input pulse time so there's no need for a PID loop. If you're trying to control velocity I'm not sure you can with a servomotor because you don't have feedback from the shaft sensor.
well its my tilt rotor fans and angular position im trying to control with a pid + complementary filter.
Registered Member #72
Joined: Thu Feb 09 2006, 08:29AM
Location: UK St. Albans
Posts: 1659
You probably don;t need PID to control the fan angle, just set the PWM to to required position and let the servo get there. If that's too fast, ramp the PWM request to the servo.
Registered Member #30
Joined: Fri Feb 03 2006, 10:52AM
Location: Glasgow, Scotland
Posts: 6706
It's the magic of negative feedback. The "I" term of the PID will make the output go to whatever value it takes to reduce the error to zero.
Say your PID was implemented with 16-bit integers, then the output would have a range of -32768 to 32767. You just need to adapt this to the range of the PWM module on the microcontroller, which might be 0 to 1023, but not all of that range may correspond to valid inputs for a RC servo. So some scaling and maybe saturation might be needed, and as soon as you do saturation you should probably implement anti-windup for the I term too.
If your PID is implemented in floating point, you may want to think twice before using it in an embedded application. And if you don't understand the difference between fixed and floating point, you should probably think twice before trying to write an embedded application.
RC model servos already have a PID loop inside to control the motor so that shaft position (sensed by a pot inside the servo) tracks the input pulse width.
Registered Member #49
Joined: Thu Feb 09 2006, 04:05AM
Location: Bigass Pile of Penguins
Posts: 362
The servos really aren't what he wants to control; he wants to control his vehicle's pitch/roll for which he gets feedback from his gyro and accels. Servos are fast compared to the vehicle dynamics, so generally you'd model them as "perfect"/instantaneous since, as Steve says, they have their own PID controller already.
Patrick, you don't need to do anything special. Develop a function and controller that generates the servo positions as output. Servo position-to-PWM is 1:1 so just translate the output with a simple transfer function.
Registered Member #30
Joined: Fri Feb 03 2006, 10:52AM
Location: Glasgow, Scotland
Posts: 6706
Well, you hope servos are fast compared to the vehicle dynamics, but from the video (yay!) the tilt rotor looks pretty skittish. I think the wooden pole needs fastened on tighter.
I guess the way the system works is this: The Kalman filter spits out a 6-dimensional estimate of the vehicle position. (3 translation, 3 rotation.) Or maybe it works with velocities or accelerations, I don't know.
A 6-D vector of the desired position (or velocity or acceleration) is derived from the RC control inputs.
Then 6 PID controllers are used to derive 6 error signals, one for each dimension, which get mixed down in some sort of transformation matrix to drive the servos.
Things are complicated (or maybe simplified? :)) if the craft doesn't have control authority in every dimension. So for instance, a copter doesn't have independent control over translation in the horizontal plane. If it wants to translate, it first has to tilt itself (rotate) so that the downward thrust vector points partly sideways. So rotation and translation are all mixed together. I have no idea how this is handled by an autopilot.
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.