Go to Post Well, we put it in the bag at 11:58 last night. Needless to say we had to pull guys off of it to put it in the bag. I hope we didn't miss somebody and bag him up too. - jimwick [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 05-02-2017, 15:12
pblankenbaker pblankenbaker is offline
Registered User
FRC #0868
 
Join Date: Feb 2012
Location: Carmel, IN, USA
Posts: 118
pblankenbaker is a glorious beacon of lightpblankenbaker is a glorious beacon of lightpblankenbaker is a glorious beacon of lightpblankenbaker is a glorious beacon of lightpblankenbaker is a glorious beacon of light
Wink PIDController strategy for slow sensor/vision update rates

I am just curious if people have noticed any significant (or bad) behaviors out of a PID controlled loop if the pidGet() method returns the same value?

Code:
      @Override
      public double pidGet() {
           // How much bad impact is there if the video subsystem has not processed
           // determined new information since the last time the PIDController called pidGet()?
 
           double angleToTarget = videoSystem.getAngleToTarget();
           return angleToTarget;
      }
It seems like it probably isn't a huge deal if you are only using P, but I'm concerned about what happens when D and I are non-zero.

While we can increase the period of the PIDController so that it is slightly larger than our camera's frame rate, there is always the possibility that we might fail to detect the current frame being processed. In this case we will have no new information to work with when our pidGet() is called.

We can detect if this occurs. Unfortunately we are not certain as to what to do about it.

Code:
      @Override
      public double pidGet() {
           // Get the count of times the video subsystem has computed new values
           int updateCnt = videoSystem.getUpdateCount();
           if (updateCnt == lastUpdateCnt) {
              // Video system has not found the target since we were last called!!!
              // Now what do we do? I guess for now we'll just fall through and
              // use the old information.
           }

           // Used to verify that we have new information to work with
           lastUpdateCnt = updateCnt;

           // Get angle to target computed by video subsystem
           double angleToTarget = videoSystem.getAngleToTarget();
           return angleToTarget;
      }
Right now, we are just not worrying about it (we just return the old information to the PIDController). But, this doesn't feel right (especially since this makes the change in error go to 0 - dropping D from the output).

We have thought about extending the PIDController class and overriding the calculate() method so that it only runs when new information is available, but we weren't certain if this might introduce other issues.

Does anyone have some other suggestions?

Thanks.
Reply With Quote
  #2   Spotlight this post!  
Unread 05-02-2017, 15:19
SamCarlberg's Avatar
SamCarlberg SamCarlberg is online now
GRIP, WPILib. 2084 alum
FRC #2084
Team Role: Mentor
 
Join Date: Nov 2015
Rookie Year: 2009
Location: MA
Posts: 161
SamCarlberg is a splendid one to beholdSamCarlberg is a splendid one to beholdSamCarlberg is a splendid one to beholdSamCarlberg is a splendid one to beholdSamCarlberg is a splendid one to beholdSamCarlberg is a splendid one to beholdSamCarlberg is a splendid one to behold
Re: PIDController strategy for slow sensor/vision update rates

Unless you have a very fast vision processing time (< 25ms), using vision targeting for PID is pretty bad. You'll be better off grabbing the angle and plugging that into the setpoint of a gyro/encoder-based PID controller.
__________________
WPILib
GRIP, RobotBuilder
Reply With Quote
  #3   Spotlight this post!  
Unread 05-02-2017, 16:22
pblankenbaker pblankenbaker is offline
Registered User
FRC #0868
 
Join Date: Feb 2012
Location: Carmel, IN, USA
Posts: 118
pblankenbaker is a glorious beacon of lightpblankenbaker is a glorious beacon of lightpblankenbaker is a glorious beacon of lightpblankenbaker is a glorious beacon of lightpblankenbaker is a glorious beacon of light
Re: PIDController strategy for slow sensor/vision update rates

Thanks, that makes sense to me. Sounds like the general strategy is to just let a slow/sporadic sensor (like vision processing) drive the set point for a PID that uses another sensor that has a higher and more reliable refresh rate (like a gyro).
Reply With Quote
Reply


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 09:43.

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