Go to Post I just love the gleeful, free, post-ship feeling, don't you? - Grant Cox [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 19-01-2017, 18:24
Kram.Niestmaub Kram.Niestmaub is offline
Registered User
FRC #5829
 
Join Date: Jan 2017
Location: Houston Texas
Posts: 3
Kram.Niestmaub is an unknown quantity at this point
Thumbs down VersaPlanetary Integrated Encoder

We are having problems with the encoder. The Code is as follows.

public class Shooter extends Subsystem {

public CANTalon shooterMotorOne = new CANTalon(RobotMap.shooterMotorOne);
CANTalon shooterMotorTwo = new CANTalon(RobotMap.shooterMotorTwo);
CANTalon shooterMotorThree = new CANTalon(RobotMap.shooterMotorThree);
CANTalon shooterMotorFour = new CANTalon(RobotMap.shooterMotorFour);

public void updateDashboard()
{
double leftShootSpeed = shooterMotorOne.getSpeed();

SmartDashboard.putNumber("Speed",shooterMotorOne.g etSpeed());
System.out.println("Left Shoot Speed: " + leftShootSpeed);
SmartDashboard.putNumber("Error: ", shooterMotorOne.getClosedLoopError());
}
protected void initDefaultCommand() {
setDefaultCommand (new Shoot(0));
}
public void shoot(double speed) {


shooterMotorOne.setFeedbackDevice(FeedbackDevice.C treMagEncoder_Relative);
shooterMotorTwo.setFeedbackDevice(FeedbackDevice.C treMagEncoder_Relative);
shooterMotorThree.setFeedbackDevice(FeedbackDevice .CtreMagEncoder_Relative);
shooterMotorFour.setFeedbackDevice(FeedbackDevice. CtreMagEncoder_Relative);

shooterMotorOne.reverseSensor(false);
shooterMotorTwo.reverseSensor(false);
shooterMotorThree.reverseSensor(true);
shooterMotorFour.reverseSensor(true);

shooterMotorOne.changeControlMode(TalonControlMode .Speed);
shooterMotorTwo.changeControlMode(TalonControlMode .PercentVbus);
shooterMotorThree.changeControlMode(TalonControlMo de.PercentVbus);
shooterMotorFour.changeControlMode(TalonControlMod e.PercentVbus);

double shooterP = Robot.prefs.getDouble("shooterP", 0.4);
double shooterI = Robot.prefs.getDouble("shooterI", 0);
double shooterD = Robot.prefs.getDouble("shooterD", 0);
double shooterF = Robot.prefs.getDouble("shooterF", 0);
double prefspeed = Robot.prefs.getDouble("prefspeed", 100);

shooterMotorOne.setPID(shooterP, shooterI, shooterD, shooterF, 0, 0, 0);
shooterMotorTwo.setPID(shooterP, shooterI, shooterD, shooterF, 0, 0, 0);
shooterMotorThree.setPID(shooterP, shooterI, shooterD, shooterF, 0, 0, 0);
shooterMotorFour.setPID(shooterP, shooterI, shooterD, shooterF, 0, 0, 0);

shooterMotorOne.set(speed);
shooterMotorTwo.set(speed);
shooterMotorThree.set(speed);
shooterMotorFour.set(speed);
}

The code provides no errors. When we run the robot everything functions correctly, and we get an error value yet we do not receive anything for speedL. We tried 2 old encoders, and even built a new encoder.
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 23:55.

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