Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Java (http://www.chiefdelphi.com/forums/forumdisplay.php?f=184)
-   -   Problems using CAN with PID (http://www.chiefdelphi.com/forums/showthread.php?t=102429)

a240 09-02-2012 22:44

Problems using CAN with PID
 
Hello,

I've been trying to use the CANJaguar class with PID control, but due to a lack of examples and documentation it has been a lot of guess and check work. I have successfully created a CANJaguar object and correctly configured it to the point where I could get encoder feed back. However I have run into a bit of trouble trying to use PID Control with the robot.

Here is some sample test code I created for a CANJaguar based driveTrain: http://code.google.com/p/iraiders-fr...riveTrain.java

My problem is that even after setting a setpoint value using setX(x), the driveTrain wheel fail to move. Testing shows that the method getX() returns a value of zero. What's wrong? If anyone knows anything about the topic any information would be very helpful.

Patrick Chiang 09-02-2012 23:34

Re: Problems using CAN with PID
 
Try with kSpeed instead of kPosition for ControlMode. Unit is Rotations/Minute.

You can also use bdc-comm to adjust the CAN jaguars directly through serial cable.

gpetilli 10-02-2012 17:26

Re: Problems using CAN with PID
 
Agreed you must switch to kSpeed. You will need different P I D numbers when you switch to kSpeed. For tuning speed mode, start with the I number (not P as you would for kPosition). Once you have an I you like, you can ramp up P to tame minor oscillations. Always set D to zero in speed mode. There are several posts which give more details on tuning CANJaguar kSpeed controllers.

Patrick Chiang 10-02-2012 20:30

Re: Problems using CAN with PID
 
Quote:

Originally Posted by gpetilli (Post 1123911)
Agreed you must switch to kSpeed. You will need different P I D numbers when you switch to kSpeed. For tuning speed mode, start with the I number (not P as you would for kPosition). Once you have an I you like, you can ramp up P to tame minor oscillations. Always set D to zero in speed mode. There are several posts which give more details on tuning CANJaguar kSpeed controllers.

Wait a second. Why does D have to be set to 0 in speed mode? Ours seem to work best with P=.700, I=.085, D=5.000

LukeS 11-02-2012 20:25

Re: Problems using CAN with PID
 
Quote:

Originally Posted by Patrick Chiang (Post 1123988)
Wait a second. Why does D have to be set to 0 in speed mode? Ours seem to work best with P=.700, I=.085, D=5.000

It varies, there are different strategies. This year I've had good luck with speed control using the Ziegler-Nichols method (search it) with P and I (no D).


All times are GMT -5. The time now is 11:43.

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