Go to Post instead of complaining, suck it up, think a little harder, and make the most of what you do have. - Andy Grady [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

 
Reply
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 15-02-2016, 00:51
FireAmpersand's Avatar
FireAmpersand FireAmpersand is offline
Registered User
AKA: Manning Team Co-Captian
FRC #4627 (Manning Robotics)
Team Role: Electrical
 
Join Date: Jan 2015
Rookie Year: 2014
Location: Calgary, Canada
Posts: 34
FireAmpersand is an unknown quantity at this point
Coding a am-2816a motor encoder.

Hi there. We want to use a encoder for our lifting motor on our robot and can't seem to figure it out. First off is the wires go back to the roboRIO or straight to the Talon srx (CAN). Secondly, how to we code it up so we get sensor feed back from the motor. Thanks in advance.
Reply With Quote
  #2   Spotlight this post!  
Unread 15-02-2016, 01:36
TimTheGreat's Avatar
TimTheGreat TimTheGreat is offline
ArchdukeTim
FRC #1418 (Vae Victis)
Team Role: Programmer
 
Join Date: Jan 2013
Rookie Year: 2011
Location: Falls Church
Posts: 231
TimTheGreat will become famous soon enoughTimTheGreat will become famous soon enough
Re: Coding a am-2816a motor encoder.

Quote:
Originally Posted by FireAmpersand View Post
First off is the wires go back to the roboRIO or straight to the Talon srx (CAN).
So the wires go to a talon Encoder Breakout board. You can find the wiring specifications on the andymark encoder description page.

In code, change the control mode of the motor
Code:
motor.changeControlMode(CANTalon.TalonControlMode.Position)
To get the sensor feedback you can view it in networktables by adding
Code:
motor.get()
and to set the motor to a certain encoder position

Code:
motor.set(int encValue)
__________________
There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult.



2012 - Gracious Professionalism - Greater DC
2014 - Regional Finalist - Virginia | Industrial Design - Virginia | Regional Finalist - Greater DC
2015 - Innovation in Control - Greater DC
2016 - District Event Winner - VAHAY | Innovation in Control - VAHAY | District Event Winner - MDBET | Industrial Design - MDBET | District Champion - CHCMP | Innovation in Control - CHCMP
Reply With Quote
  #3   Spotlight this post!  
Unread 15-02-2016, 01:38
FireAmpersand's Avatar
FireAmpersand FireAmpersand is offline
Registered User
AKA: Manning Team Co-Captian
FRC #4627 (Manning Robotics)
Team Role: Electrical
 
Join Date: Jan 2015
Rookie Year: 2014
Location: Calgary, Canada
Posts: 34
FireAmpersand is an unknown quantity at this point
Re: Coding a am-2816a motor encoder.

Sweet. And this follows PID control, correct?
Reply With Quote
  #4   Spotlight this post!  
Unread 15-02-2016, 01:41
FireAmpersand's Avatar
FireAmpersand FireAmpersand is offline
Registered User
AKA: Manning Team Co-Captian
FRC #4627 (Manning Robotics)
Team Role: Electrical
 
Join Date: Jan 2015
Rookie Year: 2014
Location: Calgary, Canada
Posts: 34
FireAmpersand is an unknown quantity at this point
Re: Coding a am-2816a motor encoder.

Also is the board needed, or can we go straight to the srx's pinout?
Reply With Quote
  #5   Spotlight this post!  
Unread 15-02-2016, 02:04
GeeTwo's Avatar
GeeTwo GeeTwo is online now
Technical Director
AKA: Gus Michel II
FRC #3946 (Tiger Robotics)
Team Role: Mentor
 
Join Date: Jan 2014
Rookie Year: 2013
Location: Slidell, LA
Posts: 3,511
GeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond repute
Re: Coding a am-2816a motor encoder.

Quote:
Originally Posted by FireAmpersand View Post
Also is the board needed, or can we go straight to the srx's pinout?
It is theoretically possible to go straight back to the SRX's pinout, but because of the fine pitch of those pins, it is preferable for most teams to use the breakout to get to a pin pitch solderable by regular humans.
__________________

If you can't find time to do it right, how are you going to find time to do it over?
If you don't pass it on, it never happened.
Robots are great, but inspiration is the reason we're here.
Friends don't let friends use master links.
Reply With Quote
  #6   Spotlight this post!  
Unread 15-02-2016, 02:43
FireAmpersand's Avatar
FireAmpersand FireAmpersand is offline
Registered User
AKA: Manning Team Co-Captian
FRC #4627 (Manning Robotics)
Team Role: Electrical
 
Join Date: Jan 2015
Rookie Year: 2014
Location: Calgary, Canada
Posts: 34
FireAmpersand is an unknown quantity at this point
Re: Coding a am-2816a motor encoder.

Ok thats good too know, its just that its week 6 and we don't want to wait on shipping
Reply With Quote
  #7   Spotlight this post!  
Unread 15-02-2016, 10:16
TimTheGreat's Avatar
TimTheGreat TimTheGreat is offline
ArchdukeTim
FRC #1418 (Vae Victis)
Team Role: Programmer
 
Join Date: Jan 2013
Rookie Year: 2011
Location: Falls Church
Posts: 231
TimTheGreat will become famous soon enoughTimTheGreat will become famous soon enough
Re: Coding a am-2816a motor encoder.

Quote:
Originally Posted by FireAmpersand View Post
Sweet. And this follows PID control, correct?
Yes. I forgot earlier but I think you have to set the PID before the motor will work. Generally only P is needed, but if it doesn't work too well increase I very very slightly (start at .002)

Code:
motor.setPID(P, I, D)
__________________
There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult.



2012 - Gracious Professionalism - Greater DC
2014 - Regional Finalist - Virginia | Industrial Design - Virginia | Regional Finalist - Greater DC
2015 - Innovation in Control - Greater DC
2016 - District Event Winner - VAHAY | Innovation in Control - VAHAY | District Event Winner - MDBET | Industrial Design - MDBET | District Champion - CHCMP | Innovation in Control - CHCMP
Reply With Quote
  #8   Spotlight this post!  
Unread 15-02-2016, 16:32
CyberTeam5713 CyberTeam5713 is offline
Registered User
FRC #5713
 
Join Date: Feb 2016
Location: Michigan
Posts: 25
CyberTeam5713 is an unknown quantity at this point
Please Help

Down below is my code and we want the robot to drive with arcade with a xbox controller also plz help me to get it to turn. And we are using the standard wheels on the robot



package org.usfirst.frc.team5713.robot;

import edu.wpi.first.wpilibj.IterativeRobot;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.RobotDrive;
import edu.wpi.first.wpilibj.livewindow.LiveWindow;
import edu.wpi.first.wpilibj.Timer;
import edu.wpi.first.wpilibj.Talon;



public class Robot extends IterativeRobot {
RobotDrive drive = new RobotDrive(1,2,3,4);
Joystick driveStick = new Joystick(0);
Joystick controlStick = new Joystick(1);
Talon frontLeft = new Talon(1);
Talon rearLeft = new Talon(2);
Talon frontRight = new Talon(3);
Talon rearRight = new Talon(4);

public void robotInit() {
drive = new RobotDrive(1,2,3,4);
driveStick = new Joystick(0);
controlStick = new Joystick(1);
frontLeft = new Talon(1);
frontLeft.enableDeadbandElimination(true);
frontLeft.set(+1.0);
rearLeft = new Talon(2);
rearLeft.enableDeadbandElimination(true);
rearLeft.set(-1.0);
frontRight = new Talon(3);
frontRight.enableDeadbandElimination(true);
frontRight.set(+1.0);
rearRight = new Talon(4);
rearRight.enableDeadbandElimination(true);
rearRight.set(-1.0);

public void teleopInit(){
drive = new RobotDrive(1,2,3,4);
driveStick = new Joystick(0);
controlStick = new Joystick(1);
frontLeft = new Talon(1);
frontLeft.enableDeadbandElimination(true);
frontLeft.set(-1.0);
rearLeft = new Talon(2);
rearLeft.enableDeadbandElimination(true);
rearLeft.set(+1.0);
frontRight = new Talon(3);
frontRight.enableDeadbandElimination(true);
frontRight.set(-1.0);
rearRight = new Talon(4);
rearRight.enableDeadbandElimination(true);
rearRight.set(+1.0);

}




public void teleopPeriodic() {
while (isOperatorControl() && isEnabled()) {
drive.setSafetyEnabled(true);


double joystickLeftY = driveStick.getRawAxis(2);
double joystickLeftX = driveStick.getRawAxis(1);
drive.arcadeDrive(joystickLeftY, joystickLeftX, true);
Timer.delay(0.01); } }

also our team is using standard wheels and we have the middle wheel and back wheel connected to drive train and the middle wheel has two motors and the same applies to the other middle wheel. for going forward and backward can someone plz help
Reply With Quote
  #9   Spotlight this post!  
Unread 15-02-2016, 17:06
TimTheGreat's Avatar
TimTheGreat TimTheGreat is offline
ArchdukeTim
FRC #1418 (Vae Victis)
Team Role: Programmer
 
Join Date: Jan 2013
Rookie Year: 2011
Location: Falls Church
Posts: 231
TimTheGreat will become famous soon enoughTimTheGreat will become famous soon enough
Re: Please Help

Quote:
Originally Posted by CyberTeam5713 View Post

Code:
package org.usfirst.frc.team5713.robot;

import edu.wpi.first.wpilibj.IterativeRobot;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.RobotDrive;
import edu.wpi.first.wpilibj.livewindow.LiveWindow;
import edu.wpi.first.wpilibj.Talon;



public class Robot extends IterativeRobot {
RobotDrive drive;
Joystick driveStick;
Joystick controlStick;

public void robotInit() {

Talon frontLeft = new Talon(1); 
Talon rearLeft = new Talon(2);
Talon frontRight = new Talon(3);
Talon rearRight = new Talon(4);
drive = new RobotDrive(1,2,3,4); 
driveStick = new Joystick(0);
controlStick = new Joystick(1);

public void teleopInit(){ 
}

public void teleopPeriodic() { 
drive.setSafetyEnabled(true);


double joystickLeftY = driveStick.getRawAxis(2);
double joystickLeftX = driveStick.getRawAxis(1);
drive.arcadeDrive(joystickLeftY, joystickLeftX, true); }
This should work.
__________________
There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult.



2012 - Gracious Professionalism - Greater DC
2014 - Regional Finalist - Virginia | Industrial Design - Virginia | Regional Finalist - Greater DC
2015 - Innovation in Control - Greater DC
2016 - District Event Winner - VAHAY | Innovation in Control - VAHAY | District Event Winner - MDBET | Industrial Design - MDBET | District Champion - CHCMP | Innovation in Control - CHCMP
Reply With Quote
  #10   Spotlight this post!  
Unread 15-02-2016, 17:13
CyberTeam5713 CyberTeam5713 is offline
Registered User
FRC #5713
 
Join Date: Feb 2016
Location: Michigan
Posts: 25
CyberTeam5713 is an unknown quantity at this point
TimTheGreat

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 08:12.

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