Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Java (http://www.chiefdelphi.com/forums/forumdisplay.php?f=184)
-   -   PID Example HELP (http://www.chiefdelphi.com/forums/showthread.php?t=92432)

Mark_K 20-02-2011 12:23

PID Example HELP
 
We're new to Java this year and we were having some problem with PID.

PIDController doesn't seem to work, and we were wondering if we could possibly have some code to use as guidelines that has PID in it.

Thanks

Mark_K 20-02-2011 14:03

Re: PID Example HELP
 
We are unable to initialize it. We import the library and when tried to call the error says cannot find symbol. symbol: constructor PIDController()

ArchVince 20-02-2011 14:08

Re: PID Example HELP
 
Are you passing the required argument? Take a look at the documentation, and there are two constructors. Both require arguments.

PIDController(double Kp, double Ki, double Kd, PIDSource source, PIDOutput output, double period)

and

PIDController(double Kp, double Ki, double Kd, PIDSource source, PIDOutput output)

Mark_K 20-02-2011 14:18

Re: PID Example HELP
 
Yes, the code is PIDController(pVal , iVal , dVal, armposition, arm);
armposition is from the pot and arm is the jag

ArchVince 20-02-2011 14:24

Re: PID Example HELP
 
What type of objects are each one? I'm unclear on what pot is, my apologies.

That sentence did not come out like I meant it to.

Mark_K 20-02-2011 14:26

Re: PID Example HELP
 
double, double, double, edu.wpi.first.wpilibj.AnalogChannel, edu.wpi.first.wpilibj.Jaguar

ArchVince 20-02-2011 14:34

Re: PID Example HELP
 
Is cannot find symbol. symbol: constructor PIDController() the exact error message? Because just as a test, I tried to initialize a Solenoid with a string as an argument and it said cannot find symbol. symbol: constructor Solenoid(java.lang.String). That would mean that it isn't being given any arguments whatsoever. Is there another place in your code where you accidentally initialized one, perhaps?

Mark_K 20-02-2011 14:39

Re: PID Example HELP
 
symbol: method PIDController() is the error

Patrickwhite 20-02-2011 21:08

Re: PID Example HELP
 
I believe the problem is your source and output. You are sending edu.wpi.first.wpilibj.AnalogChannel, edu.wpi.first.wpilibj.Jaguar, while PIDController expects classes implementing the edu.wpi.first.wpilibj.PIDSource and edu.wpi.first.wpilibj.PIDOutput interfaces. The idea is that you create your own classes implementing these interfaces, and pass them to the constructor.

My bad, I must have checked the wrong class in the javadoc somehow.

Geek 2.0 21-02-2011 00:01

Re: PID Example HELP
 
Quote:

Originally Posted by Patrickwhite (Post 1027864)
I believe the problem is your source and output. You are sending edu.wpi.first.wpilibj.AnalogChannel, edu.wpi.first.wpilibj.Jaguar, while PIDController expects classes implementing the edu.wpi.first.wpilibj.PIDSource and edu.wpi.first.wpilibj.PIDOutput interfaces. The idea is that you create your own classes implementing these interfaces, and pass them to the constructor.

AnalogChannel implements PIDSource and Jaguar implements PIDOutput, so that's probably not their problem.

ArchVince 21-02-2011 00:40

Re: PID Example HELP
 
Quote:

Originally Posted by Geek 2.0 (Post 1028053)
AnalogChannel implements PIDSource and Jaguar implements PIDOutput, so that's probably not their problem.

Yeah, it should be able to work. I'm still curious about two things, though.

1. The error says it's a method, not a constructor.
2. The error doesn't list ANY arguments.

Any chance we could see the part of your code that is erroring?


All times are GMT -5. The time now is 22:16.

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