Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Java (http://www.chiefdelphi.com/forums/forumdisplay.php?f=184)
-   -   How do you make a PID move a motor in Java? (http://www.chiefdelphi.com/forums/showthread.php?t=126326)

Maxchrist 12-02-2014 16:11

How do you make a PID move a motor in Java?
 
Hi we are trying to get a motor to move with a potentiometer to specific positions, and we are attempting to use a PID controller to do so. We have tried using .setSetpoint(), but we do not know what that value actually means and how to make the motor move, if that is the right way to do it. If someone could help us out it would be great. Thank you.

cgmv123 12-02-2014 16:26

Re: How do you make a PID move a motor in Java?
 
Did you enable the PIDController?

Maxchrist 12-02-2014 16:31

Re: How do you make a PID move a motor in Java?
 
well we are not entirely sure how to set it up, can you maybe show us a sample or something?

cgmv123 12-02-2014 16:35

Re: How do you make a PID move a motor in Java?
 
Quote:

Originally Posted by Maxchrist (Post 1341972)
well we are not entirely sure how to set it up, can you maybe show us a sample or something?

If you set the setpoint with:
Code:

pidController.setSetpoint(setpoint);
then you need to enable the controller with:
Code:

pidController.enable();
I'm not as familiar with PID controllers as I'd like to be, but here is the API if that helps: http://www.wbrobotics.com/javadoc/ed...ontroller.html

TFleig78 12-02-2014 16:40

Re: How do you make a PID move a motor in Java?
 
The PID controller needs an input (use the method returnPIDInput()). This comes from a sensor, such as a gyro or potentiometer. You then use the usePIDOutput() method to move one or multiple motors in order to make the input value reach the setpoint. You need to enable the pid with enable().
This video explains the PID subsystem really well:

http://www.youtube.com/watch?v=j2Xz8bRRcF0

Maxchrist 12-02-2014 16:52

Re: How do you make a PID move a motor in Java?
 
Thank you so much, i think that will help, I will update this when we figure out if it works


All times are GMT -5. The time now is 09:55.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi