Go to Post The term defensive robot and mechanum wheels do not belong in the same sentence together. - Koko Ed [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: 29 votes, 5.00 average. Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 20-12-2011, 01:59
Mk.32's Avatar
Mk.32 Mk.32 is offline
Registered User
AKA: Mark
FRC #2485 (W.A.R. Lords)
Team Role: Engineer
 
Join Date: Jan 2011
Rookie Year: 2011
Location: San Diego
Posts: 770
Mk.32 has much to be proud ofMk.32 has much to be proud ofMk.32 has much to be proud ofMk.32 has much to be proud ofMk.32 has much to be proud ofMk.32 has much to be proud ofMk.32 has much to be proud ofMk.32 has much to be proud ofMk.32 has much to be proud ofMk.32 has much to be proud of
JAVA PID with Encoders

Hello all,
We were able to get the PIDController to work great with the gyro but are having problems with the encoders.

Here is the part of the code we are using: the problem is when I run autoN it does nothing. The Output class doesn't print nor does the robot move.

Quote:
package TestRobot;
import edu.wpi.first.wpilibj.*;

public class RobotMain extends IterativeRobot {

public static LinearVictor VictorLeft = new LinearVictor(1);
public static LinearVictor VictorRight = new LinearVictor(3);

Encoder LeftEncoder = new Encoder(4,6,4,7,false,CounterBase.EncodingType.k2X );
PIDEncoderClass PidWriteEncoder = new PIDEncoderClass();
PIDController PidEncoder1 = new PIDController(0.1,0,0,LeftEncoder,PidWriteEncoder) ;

public void robotInit() {
System.out.println("ROBOT IS ON.");
LeftEncoder.start();
}

public void autonomousPeriodic() {
System.out.println("AutoN");
PidEncoder1.enable();
PidEncoder1.setSetpoint(10000);
}

public void teleopPeriodic() {
System.out.println("TeloP");
System.out.println(LeftEncoder.getRaw());
}

}
Quote:
package TestRobot;
import edu.wpi.first.wpilibj.PIDOutput;

public class PIDEncoderClass implements PIDOutput{

public void pidWrite(double output) {

System.out.println("Output " + output);

RobotMain.VictorLeft.set(output);
RobotMain.VictorRight.set(output);
}

}
__________________
Engineering mentor: Team 2485: WARLords 2013-

Team President: Team 3647 2010-2013

Last edited by Mk.32 : 20-12-2011 at 02:07.
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 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