Go to Post Just to be clear, NOTHING anyone says here is a confirmation. The ONLY source for official answers to questions like this is the FIRST Q&A system. - dlavery [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

 
 
 
Thread Tools Rating: Thread Rating: 11 votes, 5.00 average. Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 02-03-2015, 20:11
ashaylok ashaylok is offline
Registered User
FRC #2876
 
Join Date: Feb 2015
Location: Burlington
Posts: 2
ashaylok is an unknown quantity at this point
Exclamation PID Controller Help on Tote Lifting Mechanism

Hello,

My team currently uses an elevator mechanism to raise and stack totes. Earlier we implemented PID and created set points to automatically stack totes for the our drive team. We measured potentiometer values in order to obtain these set points then subtract the bottom potentiometer value from the set points in order to find the difference. This was done in order to allow us to reset the set points, if the potentiometer does shift, each time the elevator trips our bottom limit switch. Currently the elevator correctly cycles through the set points, forwards and backwards, without the totes. The elevator also correctly cycles downwards with the totes on the elevator; however, the elevator cannot cycle upwards while it is holding totes. I believe this is due to the way PID works. PID detects the distance needed to travel, and calculates the necessary speed in order to quickly reach the set point without overshooting. The problem is that totes introduce a second dynamic, weight. The more weight the elevator must move, the greater speed/current is needed to move the elevator arm up. PID however, cannot calculate this. The PID is still calculating a speed based on the distance, though it notices that the distance is not decreasing at the desired speed. The PID does not adapt by increasing the speed; rather it recalculates the speed based on the distance again.




Here is the code we have implemented.


public class ElevatorNextSetpoint extends Command {

public ElevatorNextSetpoint() {
// Use requires() here to declare subsystem dependencies
// eg. requires(chassis);

// BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=REQUIRES
requires(Robot.elevator);

// END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=REQUIRES
}

// Called just before this Command runs the first time
protected void initialize() {
//Go to next setpoint

Robot.elevator.incrementSetpoint();
}

// Called repeatedly when this Command is scheduled to run
protected void execute() {
}

// Make this return true when this Command no longer needs to run execute()
protected boolean isFinished() {
return true;
}

// Called once after isFinished returns true
protected void end() {
}

// Called when another command which requires one or more of the same
// subsystems is scheduled to run
protected void interrupted() {
}


\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\


public static final int POTENTIOMETER_NOISE = 30;

public void incrementSetpoint() {
for (int i = 0; i < setpointArray.length; i++) {
if (setpointArray[i] >= potentiometer.get() + POTENTIOMETER_NOISE) { //setpointArray[] contains our
setSetpoint(setpointArray[i]);
break;
}
}
}


\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\


public void decrementSetpoint() {
for (int i = setpointArray.length - 1; i >= 0; i--) {
if (setpointArray[i] < potentiometer.get() - POTENTIOMETER_NOISE) {
setSetpoint(setpointArray[i]);
break;
}
}
}


\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\


public void resetPotentiometerValues(){
BOTTOM = returnPIDInput();
STAGING_HEIGHT = BOTTOM + STAGING_DIFF_FROM_BOTTOM;
ONE_TOTE_HIGH = STAGING_HEIGHT + ONE_TOTE_DIFF_FROM_STAGING;
TWO_TOTE_HIGH = ONE_TOTE_HIGH + TWO_TOTE_DIFF_FROM_ONE_TOTE;
TOP = TWO_TOTE_HIGH + TOP_DIFF_FROM_TWO_TOTE;
}
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 22:30.

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