Go to Post ...playing hard and impressing teams is way more valuable than trying to play god with the rankings. - JamesBrown [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rating: Thread Rating: 22 votes, 5.00 average. Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 31-01-2013, 14:39
UriF UriF is offline
Registered User
FRC #2213
 
Join Date: Jan 2012
Location: Israel
Posts: 27
UriF is an unknown quantity at this point
Gyro PID Programming

Hello,

I am attempting to use a PID loop to force the robot into the 0 degrees starting position at a click of a button.

[+] At first, I created a PIDController and initialized it with the Gyro object as the PIDSource, and my own object with a custom PIDWrite routine which consists of:
Code:
void PIDWrite(float Output)
{
    Drive->TankDrive(Output, -Output); //This makes the robot turn around
}
I was getting unexpected results, and It turned out that the Gyro's PIDGet() was actually returning the raw angle and not a value scaled from -1.0 to 1.0

[+] I then decided to write my own PIDGet() too. All the routine does is
get the raw angle, scale it to a value from -1.0 to 1.0 and return it.
(I am under the impression that the Output and Source variables should be scaled to the same range, please tell me if this is wrong.)

After scaling both the Output and Source vars, setting the setpoint to 0.0 (the starting position at which the gyro was reset) and enabling the PID Controller, nothing happens

Please tell me if you can find anything wrong with what I did, and thanks in advance.
Reply With Quote
 


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


All times are GMT -5. The time now is 18:19.

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