PID following Propeller Bot.spin
I would like to add a Rudder to My PID following Propeller Bot.
Using a standard servo, how could I make it turn PID style?
I have been trying to do this Myself, using My standard Programming techniques,
But... I seem to have run out of Four Letter Words...:freaked:
I was able to make the Rudder turn slightly(about 10 degrees) to one side.
but nothing proportional by any means.
and sometimes the Left or Right Servos would turn opposite of the expected direction.
So, I My question is, what would I add or change or... to make My Rudder, Rudder.
As an aside, I would also like to add a third forward IR Sensor..
what would be needed for that?
Thanks for any help on this.
Using a standard servo, how could I make it turn PID style?
I have been trying to do this Myself, using My standard Programming techniques,
But... I seem to have run out of Four Letter Words...:freaked:
I was able to make the Rudder turn slightly(about 10 degrees) to one side.
but nothing proportional by any means.
and sometimes the Left or Right Servos would turn opposite of the expected direction.
So, I My question is, what would I add or change or... to make My Rudder, Rudder.
As an aside, I would also like to add a third forward IR Sensor..
what would be needed for that?
Thanks for any help on this.
Comments
Propeller chip forum, in the Propeller Education Kit Labs, Tools, and Applications sticky, down at the bottom of the page.
I could post it here again if that would be helpfull..
My version of it is the same except for deletion of the Peizo speaker set up.
I will post up what little I have done to the code, it is just what I have
attempted so far, it's lines of code I tried to insert, and then commented out.
As for what I expect to happen with this code..
I expect the Rudder Servo to operate in sync with the Left and Right wheel servos.
I wish the Rudder to swing Left when the robot turns Right, and,
the Rudder should swing to the Right when the robot turns Left...
You know, like a Boats Rudder... Push the Tiller handle to Port, and the bow will
start to point to Starboard...ect.
Of course the Rudder Movements being Proportional to the Wheel Servo's Movements..
Here is the Main Part of the Program, like I say, it's just some lines of code that I added then commented out.
I'm not building a boat, I guess I could have used a Red Wagon as an example,
but then You would have to picture yourself sitting in the wagon as opposed to Pulling the Wagon...
But.. then again I'm not Building a Wagon either... Uhmm, what would You call this thing?
Velcro and Zip ties will one day rule the world...
erco, the steering Servo is a standard one from Parallax.
the "Drive" Servos, are continious rotation, also from Parallax.
The RFID reader, QTI sensors, XBee, and of course the USB Proto Board,
Are all standard Parallax issue..
The onboard Joystick is from a Nintindo 64, there is also one for the "Remote"(PPDB).
The Camera is from some clearance sale...somewhere...
it just goes for the ride and displays the action on an old tv set.
The QTI "Arm" is rotated by a racy little standard servo I picked up for 5 bucks..
the "arm" is used for raising and lowering the Line following QTI sensors,
it is also used for self defense when surrounded and outnumbered.(see Photo)...
IR sensors are mounted on some perf board for easy mounting, and adjusting.
Some extra slide switches and a pushbutton are also installed.
The Emergency Joystick(see rearview photo), was made in My shop,
It's made from a 74HC165 shift register, come to think of it, that comes from Parallax too..
InaPinch2 when fully loaded, tips the scales at about two and one half pounds.
That is a bit intimadating...
A "post Yer code" and two drive by's...
Oh well, ask a stupid question...
Actually I thought that someone would have had allready put a Rudder Servo
on the back of their Robot Platform, well, it's not just the Rudder Steering,
It's more about the PID control of the Steering...
I will keep picking away at it.
came from the N64 Joystick, and I followed it around, for a while..
then came the Xbee setup, and I can send commands from My PPDB. Remote control style.
I made it so if I want to turn hard right, then the "Drive" servos turn opposite each other,
and the Rudder servo turns hard left, and InaPinch spins around on its own axis.
to turn soft right, like for a circle, then the Rudder turns only about 45 degrees.
So My Joystick Rudder set up really only has two settings, hard turn and soft turn.
Plus center setting of course.
The Rudder servo works better then I had anticipated, when I first tried it out.
It snaps right or left the full 180 as needed, and really helps with the payload weight distribution.
Anyway, to be clear, the Rudder works fine, it's just that I would like to add PID control.
to the Rudder System.
I don't see in your sample code where it's getting commands from a joystick. What I see is, the servos actions are being controlled by the output of the PID based on distance from the IRs. Maybe you could point out in the code where the joystick commands are being used to control the servos.
For PID control, you have to have some sort of feedback to comare to a setpoint, in the sample the feedback is the distance from the IR, and I'm guessing the setpoint is a preset desired distance. For the rudder to turn "PID style" I'm thinking the setpoint would have to be the differential position of the main servos, and compare it to the actual position of the rudder, to get an error that PID could use.
I think there would be easier ways to control the rudder.
I think it's one of the greatest things to ever happen to a Robot. at least in the top 5 thats for sure...
If Anyone has not tried this out, Just run on down to the Parallax store, and set yourself up with either,
A Boe Bot Kit (easy), or..
Purchase 2 continious rotation servos, 2 IR sensors, 2 IR leds, ect. ect.(not so easy)..
Whatever Platform You choose, the sticky at the top of the Propeller Chip forum has the code to use.
"Propeller following PEKbot v0.90. zip",
It is a miracle of Modern Science, as written by Andy Lindsay.
Put Your Robot together,(Rudder not required), load the code into EEPROM, and let it roam...
Anyways, as far as My Robot(InaPinch), is concerned, let's just forget about Joysticks for now.
and just figure I am only using the PEKbot code for now.
The code works great as is, My problem, I want a Rudder too..
Rudders just look cool to Me.. and, I hate Casters, even the worlds best caster available,
I.E. Parallax's world famous Billet Machined aluminium wonder caster,
is not for Me, in fact I hate Casters so much, I have had all them removed from My office chairs...
But thats just Me..
Oh... I assure You... I will have a PID controlled Rudder system when finished.
Or should I perish before hand, My Heirs will complete the Task.. rest assured, there will be a PID Controlled Rudder...
Lack of Knowledge has never stopped Me from making decisions before...:skull:
[HTML]
For PID control, you have to have some sort of feedback to comare to a setpoint,
in the sample the feedback is the distance from the IR,
and I'm guessing the setpoint is a preset desired distance.
For the rudder to turn "PID style" I'm thinking the setpoint
would have to be the differential position of the main servos,
and compare it to the actual position of the rudder, to get an error that PID could use.
[/HTML]
from what I understand of it, is the IR's give constant feedback to the PID Calculator,
and the Calculation is used for the Drive Servos, Proportionally...
I.E if the wall is right in front of the Robot, it will do a 180 degree turn from the wall.
if the wall is just to the Left front of the Robot, it will just slightly turn Right, away from the wall.
Pretty cool stuff..
I did try to use the Servo[L] and Servo[R] calculations to activate the Rudder,
taking the largest value of the two, and then divide that number down, and putting that to the Rudder Servo.
also tried using the Lowest Value of the two, and put that to the Rudder,
then I tried taking both numbers, and put that into its own PID Calculation, No luck at all though...
I tried to just use this...(in different combinations) But this just makes the Drive Servo's go Backward or at the wrong speed, or not at all..
In fact, trying to do anything with the Rudder thru the PEKBot Program, makes the Program angry...
"COG SLAP" is what I have right now...Dang Cogs slapping around inside that little chip...
Gonna take a screw driver to the back of that chip an see if I can tighten them up some...
Have you tried taking the difference in servo speed values? If the values are equal the rudder would be neutral, if not a positive value could indicate one direction and a negative value the other, the higher the value the greater the rudder angle. This in fact would be PID rudder control since the servo speed values are the result of PID.
The beauty of PID is that it's not just a proportional feedback control system. I find the subject fascinating and I am still trying to understand it.
Sorry I couldn't be more help. Good luck! Post your success.
agfa
Edit: After posting this, I see you have tried using the difference. But It shouldn't effect the main servos operation unless you are also adjusting their values in the calculation.
Once again. Good luck.
If you were driving this wheel as well, I could understand your struggle better.
If this wheel is causing you grief because there is too much weight on it, you would do better to change your chassis layout to keep 95% of your weight on your drive wheels. This has 2 advantages. First, you reduce any turning effects due to a passive caster wheel, and secondly, you keep all your weight on your drive wheels for better traction.
Captain Obvious
Some how, it does effect them though. it's like one of the .spin files is written
in a way that "Takes Over" more of the Propeller Pins then it should,
I know that is over simplified, but not sure how to explain it just yet.
Anyway's, this is a much better direction to take, as I was messing with the difference, but not in the way you describe...
[HTML]Have you tried taking the difference in servo speed values? If the values are equal the rudder would be neutral, if not a positive value could indicate one direction and a negative value the other, the higher the value the greater the rudder angle. This in fact would be PID rudder control since the servo speed values are the result of PID.
[/HTML]
I will explore this..
thanks for your input.
I don't think it's a PID problem or a mechanical problem, just a desire to conquer.
First things first though. A walk before I run, kinda thing.
I can tell You, that the weight balance I've been using is around 80% to 85% on the drive wheels.
This thing turns very smoothly, no weight issues, and very little tail drag in sharp manuvers.
Right now, all that is required to Join in the Fun is...
The schematic of the Hardware needs, And the code from the Sticky.
(I've included My version of the Schematic)
I believe any Board will work, Be it the BOE, any one of the Proto Boards, perhaps even the PPDB.
anything that can spin 2 continious rotation, and 1 standard servo at the same time.
and it needs to drive 2 IR emmiter Leds, and 2 IR recievers,(the three wire ones).
It does'nt even have to turn a Rudder,(if you hate rudders, like I hate casters.)
Just make the Standard Servo turn in unison with the Steering of the Drive Wheels...
It will be fun, I Promise...
This stuff is so easy...it's hard...
Thank you agfa, that was most kind of You for the "IF" suggestion..
Try this on for size...