Go to Post In any case, don't beat yourself up over it. Only 24 teams get to play in elimination rounds. Sometimes you're in the 24, and sometimes you aren't. - jgannon [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 26-01-2005, 19:36
jdong jdong is offline
Linux Nerd
AKA: John D
#0245 (Adam-Bots)
Team Role: Programmer
 
Join Date: Apr 2004
Location: Rochester, MI
Posts: 98
jdong will become famous soon enoughjdong will become famous soon enough
All-Time PID Drive with Hall-effects: Coming along very nicely

Hello, everyone.

For the past few weeks, I've been working feverishly to get PID drive (Joystick-commanded velocity) to work with our given hall-effect sensors. I'm proud to say that we've got our first working prototype.


It required a complete rewrite of the algorithm... I expanded the generic PID algorithm, and got an expression for delta-output based on the current error and the last error (Proportional+Integral only). I did get another equation for the derivative band, but it required too many multiplications -- saturating processor time for no good reason.

I also got rid of the whole structure's / OOP'ness of the NASA code (sorry guys!)... At one point, I seemed to get a bit of memory corruption (printf started spitting out RANDOM garbage, then code error). As a result, the code is much lighter now!

To stabilize the system, I added PWM sloping protection. This forces the controller to only change the PWM output from cycle-to-cycle by +/- 1. Sort of like a dampener, but with much less calculation. The hall-effect sensors that we mounted could only get ~ 35 ticks/loop, so the resolution was quite low, causing major overshooting/undershooting from loop to loop. The PWM sloping seemed to have corrected this.


Problems:
1. Still need to test. Haven't tested under all conditions yet.
2. Direction. Assuming direction based on commanded PWM direction seems quite effective, but I'm still seeing if there's a weakness.



After I send this through some internal testing, I plan to GPL and release our Default_Routine() function.
__________________
John Dong
Co-Captain, Webmaster / Programmer
Team 245 -- Rochester Adams Robotics
  #2   Spotlight this post!  
Unread 26-01-2005, 22:19
Joe Johnson's Avatar Unsung FIRST Hero
Joe Johnson Joe Johnson is offline
Engineer at Medrobotics
AKA: Dr. Joe
FRC #0088 (TJ2)
Team Role: Engineer
 
Join Date: May 2001
Rookie Year: 1996
Location: Raynham, MA
Posts: 2,648
Joe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond repute
Re: All-Time PID Drive with Hall-effects: Coming along very nicely

Seems only natural for you to put in Jim Zondag's (Killer Bees, Team #33) auto shifting alorithm. Once you take the human out of the throttle control business, it seems a natural to have the velocity control figure out what gear is best.

It is a pretty simple calculation to figure out if you would be more power efficient to be in another gear.
Knowing speed and voltage, you can calculate torque on the motor and the efficiency of the motor at that speed, voltage and torque at converting VI power into Tw power
Knowing this, you can calculate the voltage and associated effieciency that would be needed in the other possible gears at that same tire speed and tire torque load point
If it is more efficient to be in another gear and you have not shifted too recently, then shift to the more efficient gear

Anyway, thanks for what you have done so far. I applaud your efforts.

Joe J.
__________________
Joseph M. Johnson, Ph.D., P.E.
Mentor
Team #88, TJ2
  #3   Spotlight this post!  
Unread 26-01-2005, 23:15
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,590
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: All-Time PID Drive with Hall-effects: Coming along very nicely

jdong, you should read this: http://www.chiefdelphi.com/forums/sh...4&postcount=26 and reconsider licensing it under the gpl.
  #4   Spotlight this post!  
Unread 28-01-2005, 17:04
jdong jdong is offline
Linux Nerd
AKA: John D
#0245 (Adam-Bots)
Team Role: Programmer
 
Join Date: Apr 2004
Location: Rochester, MI
Posts: 98
jdong will become famous soon enoughjdong will become famous soon enough
Re: All-Time PID Drive with Hall-effects: Coming along very nicely

I'm really open on licensing, as long as it's open-source. Would you rather me release it under a bsd-style license?
__________________
John Dong
Co-Captain, Webmaster / Programmer
Team 245 -- Rochester Adams Robotics
  #5   Spotlight this post!  
Unread 29-01-2005, 10:34
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,590
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: All-Time PID Drive with Hall-effects: Coming along very nicely

Quote:
Originally Posted by jdong
I'm really open on licensing, as long as it's open-source. Would you rather me release it under a bsd-style license?
I prefer BSD for my stuff, but LGPL works as well for this purpose.

With the LGPL, if somebody changes your library and gives it to somebody else, they must also give the changed code. If it's BSD, they can make any changes, and distribute or not distribute, but your name will always stay with it.

I prefer BSD as it is more free, but others prefer to force people to release changes, in that case, LGPL is what you want.
  #6   Spotlight this post!  
Unread 05-02-2005, 19:31
jdong jdong is offline
Linux Nerd
AKA: John D
#0245 (Adam-Bots)
Team Role: Programmer
 
Join Date: Apr 2004
Location: Rochester, MI
Posts: 98
jdong will become famous soon enoughjdong will become famous soon enough
Re: All-Time PID Drive with Hall-effects: Coming along very nicely

Sorry for the delays, ran into a few snags the past two weeks.

The balance between stability at low speeds and fast responses at high errors is extremely frustrating and time-consuming to find.

Right now, I've broken the algorithm into Low, High, and Overdrive modes.

Low uses small Kp/Ki (1 or 2), with a PWM limit of +/- 1 per loop. High uses a higher constant with a larger slope. Overdrive is engaged if the joy is pushed past a certain point, and switches to max PWM output.


I plan on releasing this code next week, likely under the BSD license.
__________________
John Dong
Co-Captain, Webmaster / Programmer
Team 245 -- Rochester Adams Robotics
  #7   Spotlight this post!  
Unread 05-02-2005, 19:39
jgannon's Avatar
jgannon jgannon is offline
I ᐸ3 Robots
AKA: Joey Gannon
no team
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Pittsburgh, PA
Posts: 1,467
jgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond repute
Re: All-Time PID Drive with Hall-effects: Coming along very nicely

Quote:
Originally Posted by Joe Ross
I prefer BSD for my stuff, but LGPL works as well for this purpose.

With the LGPL, if somebody changes your library and gives it to somebody else, they must also give the changed code. If it's BSD, they can make any changes, and distribute or not distribute, but your name will always stay with it.

I prefer BSD as it is more free, but others prefer to force people to release changes, in that case, LGPL is what you want.
You may be interested in why Richard Stallman says you shouldn't use the LGPL.
__________________
Team 1743 - The Short Circuits
2010 Pittsburgh Excellence in Design & Team Spirit Awards
2009 Pittsburgh Regional Champions (thanks to 222 and 1218)
2007 Pittsburgh Website Award
2006 Pittsburgh Regional Champions (thanks to 395 and 1038)
2006 Pittsburgh Rookie Inspiration & Highest Rookie Seed

Team 1388 - Eagle Robotics
2005 Sacramento Engineering Inspiration
2004 Curie Division Champions (thanks to 1038 and 175)
2004 Sacramento Rookie All-Star

_
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PID control loops - closed loop feedback KenWittlief Technical Discussion 56 26-04-2004 21:27
Actual execution time measurement Dan Technical Discussion 5 24-03-2003 11:36
Solution to Timing Loops Steven Carmain Programming 39 10-02-2003 13:33
How long should production time be??? archiver 1999 4 23-06-2002 23:16


All times are GMT -5. The time now is 17:47.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi