Go to Post Is it legal? Yes. Is it Graciously Professional? Yes. Is it smart? No. - dlavery [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

 
Reply
 
Thread Tools Rating: Thread Rating: 13 votes, 5.00 average. Display Modes
  #1   Spotlight this post!  
Unread 04-02-2015, 23:12
BananaKing1378's Avatar
BananaKing1378 BananaKing1378 is offline
BaNaNaK1Ng8o8
AKA: Banene
FRC #1378 (Hilo Banana Robotics)
Team Role: Human Player
 
Join Date: Jun 2014
Rookie Year: 2008
Location: Pluto
Posts: 7
BananaKing1378 is an unknown quantity at this point
PID Controller class not calculating output value

Hello! So to get to the point, the PIDController we are using is not calculating an output value.

We set the controller to read input from an encoder and output to a talon. In the code it looks like this:

LiftControl (0.1, 0.1, 0.1, &EnTwoSim, &TwoSim);

We followed example given by the WPILibrary website. We want the PID to basically hold the lift at a position when the driver has stopped pushing the button to move the lift. We thought to accomplish this by making the setpoint of the class to be equal to the encodervalue. This would make the error small by nature but the PID should make the motor "fight" against forces pushing against it by design.

We printed the value of the error, encoder value, setpoint, and output value to the dashboard. As expected the error is small, and the encoder value and setpoint are close. However, the output value remains at 0. I have tried to set the minimum and maximum output values but that did nothing. I looked at the PIDController class and saw that there is a protected function that calculates the output but it can only be accessed by a "Notifier" that is created when the PIDController object is initialized.

Anyway, I hope this wasn't too confusing and would greatly appreciate any help we could get on this issue. Thanks!
Reply With Quote
  #2   Spotlight this post!  
Unread 04-02-2015, 23:59
mmaunu's Avatar
mmaunu mmaunu is offline
Registered User
FRC #2485 (W.A.R. Lords)
Team Role: Mentor
 
Join Date: Mar 2013
Rookie Year: 2010
Location: San Diego, CA
Posts: 87
mmaunu is a jewel in the roughmmaunu is a jewel in the roughmmaunu is a jewel in the roughmmaunu is a jewel in the rough
Re: PID Controller class not calculating output value

Hello!

Without looking at the actual code, I am going to make a guess...but could you post the code in question? I am assuming that you are using a PIDController object.

Did you enable the PIDController object? The API has an enable method and a disable method so that you can turn the controller on and off. It is not enabled by default. When the operator lets go of the button, enable the controller; disable it when the button gets pressed so that the lift can move to a new position. Or, alternatively, you can have another button that sets a predetermined setpoint so that this new button starts automatically taking the lift to a new position.
__________________
2014 Las Vegas (Winners with 987, 2478; Excellence in Engineering)
2014 San Diego (Finalists with 987, 3250; Quality Award)
2013 Inland Empire (Winners with 1538, 968; Excellence in Engineering Award)
2013 San Diego (Finalists with 2984, 4322; Creativity Award)
2012 Las Vegas (Finalists with 2034, 3187; Quality Award)
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 12:07.

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