Go to Post We can either sit around and complain about what could have been, or we can focus on the upside of what we have and move on. - Vikesrock [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

 
Reply
Thread Tools Rate Thread Display Modes
  #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
  #2   Spotlight this post!  
Unread 19-01-2017, 18:39
granjef3's Avatar
granjef3 granjef3 is offline
Code Ninja
AKA: Matt
FRC #2383 (Ninjineers)
Team Role: Programmer
 
Join Date: Sep 2015
Rookie Year: 2016
Location: Florida
Posts: 10
granjef3 is an unknown quantity at this point
Re: VersaPlanetary Integrated Encoder

Quote:
Originally Posted by Kram.Niestmaub View Post
We are having problems with the encoder. The Code is as follows.
...snip...

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.
What is the error value you are getting, and where are you seeing it?
Post the output from RioLog when you run your code.
__________________

2016 Galileo Division Semifinalists with 341 Miss Daisy, 3683 Team Dave, and 4525 Renaissance Robotics

Thanks to all of our past alliance members!
Reply With Quote
  #3   Spotlight this post!  
Unread 19-01-2017, 18:47
Kevin Sevcik's Avatar
Kevin Sevcik Kevin Sevcik is offline
(Insert witty comment here)
FRC #0057 (The Leopards)
Team Role: Mentor
 
Join Date: Jun 2001
Rookie Year: 1998
Location: Houston, Texas
Posts: 3,748
Kevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond repute
Send a message via AIM to Kevin Sevcik Send a message via Yahoo to Kevin Sevcik
Re: VersaPlanetary Integrated Encoder

First off debugging. Is the status light on your SRX encoder green or yellow? If not, you don't have power or you've assembled it wrong and it can't see the magnet. If you spin the wheel by hand, do you see a change in feedback or error? If not, there may be a problem with your cable or encoder.

Secondly, you should have a non-zero value for F. For initial tuning, you want PID = 0, F = number. Then tweak F up until you have 0 error at your target speed.

Thirdly, if all these are tied together in one system, it's better to have a single feedback and PID, and slave the other talons to the one that's doing PID. You have to do that anyways if you only have one. Check the Talon Software Reference Manual for info on that.

Thirdly, I'd rather you weren't setting ALL that in the Shoot function. It's fine for debugging, but the final code should have most of that in an initialize function and the Set calls only in Shoot.

Lastly, let me know if you haven't figured this out by Saturday and I can swing by your shop and see if I can help.
__________________
The difficult we do today; the impossible we do tomorrow. Miracles by appointment only.

Lone Star Regional Troubleshooter
Reply With Quote
  #4   Spotlight this post!  
Unread 19-01-2017, 18:56
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
Re: VersaPlanetary Integrated Encoder

Quote:
Originally Posted by Kevin Sevcik View Post
First off debugging. Is the status light on your SRX encoder green or yellow? If not, you don't have power or you've assembled it wrong and it can't see the magnet. If you spin the wheel by hand, do you see a change in feedback or error? If not, there may be a problem with your cable or encoder.

Secondly, you should have a non-zero value for F. For initial tuning, you want PID = 0, F = number. Then tweak F up until you have 0 error at your target speed.

Thirdly, if all these are tied together in one system, it's better to have a single feedback and PID, and slave the other talons to the one that's doing PID. You have to do that anyways if you only have one. Check the Talon Software Reference Manual for info on that.

Thirdly, I'd rather you weren't setting ALL that in the Shoot function. It's fine for debugging, but the final code should have most of that in an initialize function and the Set calls only in Shoot.

Lastly, let me know if you haven't figured this out by Saturday and I can swing by your shop and see if I can help.
It turns out the encoder has no lights, our mechanical is rebuilding them as we speak. As for PID and other points this is simple prototype code thank you for the suggestions.
Reply With Quote
  #5   Spotlight this post!  
Unread 19-01-2017, 19:04
Kevin Sevcik's Avatar
Kevin Sevcik Kevin Sevcik is offline
(Insert witty comment here)
FRC #0057 (The Leopards)
Team Role: Mentor
 
Join Date: Jun 2001
Rookie Year: 1998
Location: Houston, Texas
Posts: 3,748
Kevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond repute
Send a message via AIM to Kevin Sevcik Send a message via Yahoo to Kevin Sevcik
Re: VersaPlanetary Integrated Encoder

No light means no power. Check your cables and connections.
__________________
The difficult we do today; the impossible we do tomorrow. Miracles by appointment only.

Lone Star Regional Troubleshooter
Reply With Quote
  #6   Spotlight this post!  
Unread 19-01-2017, 19:52
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
Re: VersaPlanetary Integrated Encoder

Quote:
Originally Posted by Kevin Sevcik View Post
No light means no power. Check your cables and connections.
We fixed it!!! They didn't see the broken cable at first! Thank you
Reply With Quote
Reply


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 15:33.

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