Go to Post The most important deisgn criteria is always performance in any of the parts / systems we design. But we do try to abide by the saying -- if it doesn't look good (right), it probably isn't good (right). - Adam Freeman [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 23-01-2016, 11:40
ToMoPAnae's Avatar
ToMoPAnae ToMoPAnae is offline
Registered User
AKA: Patrick Fischer
FRC #3620 (Average Joes)
Team Role: Driver
 
Join Date: Jan 2015
Rookie Year: 2015
Location: St. Joseph
Posts: 8
ToMoPAnae is a glorious beacon of lightToMoPAnae is a glorious beacon of lightToMoPAnae is a glorious beacon of lightToMoPAnae is a glorious beacon of lightToMoPAnae is a glorious beacon of light
CAN Talon Speed Control Mode Trouble with Encoder Feedback

My team is having trouble getting the speed control setting to work with our CAN Talon. We cannot get the Talon to respond to changes in the error or the set point of desired speed. We know that our encoder is working correctly because we can see changes in encoder position and velocity through both the RoboRio and our program. We have firmware version 2.0 on the CAN Talons and the Talon is connected to a Quad encoder. We cannot even get the Talon to tell the motor to spin regardless of the set point. The LEDs on the Talon stay solid orange while this program is running, regardless of the set point. If we are in vBus mode the Talon works correctly. We are using a 775 Pro motor. The encoder is an Armabot RS7.

This is the code that we are running. We used the code from the software reference guide for how to use the speed mode of control with java. We removed parts of their code that were unnecessary. Any help or suggestions would be greatly appreciated.

Code:
public class Robot extends IterativeRobot {
    
    CANTalon _talon = new CANTalon(2);
    Joystick joy = new Joystick(0);
    StringBuilder sb = new StringBuilder();
    int _loops = 0;
    double target_Speed = 0;
	
    public void robotInit() {
    	_talon.changeControlMode(TalonControlMode.Speed);
    	_talon.setFeedbackDevice(FeedbackDevice.QuadEncoder);
    	_talon.reverseSensor(false);
    	_talon.configEncoderCodesPerRev(12);
    	_talon.configNominalOutputVoltage(+0.0f, -0.0f);
    	_talon.configPeakOutputVoltage(+12.0f, -12.0f);
    	_talon.setProfile(0);
    	_talon.setP(0);
    	_talon.setI(0);
    	_talon.setD(0);
    	_talon.setF(0);
    	
    }
    
    public void teleopPeriodic() {
    	double leftYStick = joy.getAxis(AxisType.kY);
    	double motorOutput = _talon.getOutputVoltage() / _talon.getBusVoltage();
    	sb.append("\tout");
    	sb.append(motorOutput);
    	sb.append("\tspd");
    	sb.append(_talon.getSpeed());
    	sb.append("\tjoy");
    	sb.append(leftYStick);
    		
    		target_Speed = 1000;
    		_talon.set(target_Speed);
    		sb.append("\terr");
    		sb.append(_talon.getClosedLoopError());
    		sb.append("\ttrg");
    		sb.append(target_Speed);
    		sb.append("\tencV");
    		sb.append(_talon.getEncVelocity());
    	
    	if(++_loops >= 10)
    	{
    		_loops = 0;
    		System.out.println(sb.toString());
    	}
    	sb.setLength(0);
    
    }
}
Attached Files
File Type: java Robot.java (2.2 KB, 7 views)

Last edited by ToMoPAnae : 23-01-2016 at 11:42. Reason: Attached Robot.java file
 


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 22:34.

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