Go to Post New mentor joins one team and ends up impacting several in the same region. I like that. :) - Travis Hoffman [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 27-01-2017, 19:19
thecoopster20 thecoopster20 is offline
4th Year Programmer - Java
FRC #3602 (Robomos)
Team Role: Programmer
 
Join Date: Mar 2016
Rookie Year: 2014
Location: Escanaba, MI
Posts: 27
thecoopster20 is an unknown quantity at this point
Multiple Sensor PID Loops

I'm relatively new to programming robots in Java and am looking for some pointers on how to accomplish the following.

Our team wants to be able to do a few PID controlled tasks, mostly with the drive system. We are using a command based structure for our code. Essentially we want to be able to use a few different sensors for a few different tasks, they are as follows:

-Average encoders to drive straight and drive for a certain distance
-Use two ultrasonic sensors to turn the robot until its relatively parallel to a surface as well as drive until we are a certain distance away from a surface
-Utilize vision to turn towards a target

Now, the solutions I've seen so far here on CD are varied. One idea I saw was to create multiple PID loops within the drive subsystem. Another idea was to create separate dummy subsystems specifically for each PID task. I'm not quite sure what the best way to approach this problem is.
Reply With Quote
  #2   Spotlight this post!  
Unread 28-01-2017, 09:42
wlogeais wlogeais is offline
Registered User
FRC #2177 (The Robettes)
Team Role: Mentor
 
Join Date: Feb 2016
Rookie Year: 2011
Location: Minnesota
Posts: 18
wlogeais is an unknown quantity at this point
Re: Multiple Sensor PID Loops

Quote:
Originally Posted by thecoopster20 View Post
Now, the solutions I've seen so far here on CD are varied. One idea I saw was to create multiple PID loops within the drive subsystem. Another idea was to create separate dummy subsystems specifically for each PID task. I'm not quite sure what the best way to approach this problem is.
I'd suggest that the second of these ideas is more difficult/risky, with the potential for parallel commands sending conflicting drive-straight/rotate instructions.

The second idea just requires you to use conditions (eg if setpoint-is-angle, elseif setpoint-is-distance...) within your ChassisPIDSubsystem's returnPIDInput() and usePIDOutput() and potentially within a custom-onTarget() too.
Reply With Quote
  #3   Spotlight this post!  
Unread 28-01-2017, 11:54
thecoopster20 thecoopster20 is offline
4th Year Programmer - Java
FRC #3602 (Robomos)
Team Role: Programmer
 
Join Date: Mar 2016
Rookie Year: 2014
Location: Escanaba, MI
Posts: 27
thecoopster20 is an unknown quantity at this point
Re: Multiple Sensor PID Loops

Okay, that makes sense. Would each different setpoint set require different values for the constants as well?
Reply With Quote
  #4   Spotlight this post!  
Unread 28-01-2017, 13:29
wlogeais wlogeais is offline
Registered User
FRC #2177 (The Robettes)
Team Role: Mentor
 
Join Date: Feb 2016
Rookie Year: 2011
Location: Minnesota
Posts: 18
wlogeais is an unknown quantity at this point
Re: Multiple Sensor PID Loops

Quote:
Originally Posted by thecoopster20 View Post
Okay, that makes sense. Would each different setpoint set require different values for the constants as well?
With this approach you need to limit drive-action to drive or rotate, not drive-curve, and this way the setpoint and the input-output values all need to be within one 'dimension' (at a time). (You might also want/need conditions for the strafe-dimension, if that is relevant to autonomous).
Reply With Quote
  #5   Spotlight this post!  
Unread 29-01-2017, 12:53
thecoopster20 thecoopster20 is offline
4th Year Programmer - Java
FRC #3602 (Robomos)
Team Role: Programmer
 
Join Date: Mar 2016
Rookie Year: 2014
Location: Escanaba, MI
Posts: 27
thecoopster20 is an unknown quantity at this point
Re: Multiple Sensor PID Loops

That not only makes sense, but works much better with what we're trying to accomplish. The idea is to use all of these PID loops for autonomous gear placement, so it does make more sense to worry about one drive function at a time rather than multiple. We're ditching the ultrasonic capability so now I only need to worry about turning with vision and driving straight for a set distance with encoders. Appreciate the help.
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 13:16.

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