Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Java (http://www.chiefdelphi.com/forums/forumdisplay.php?f=184)
-   -   Encoder (http://www.chiefdelphi.com/forums/showthread.php?t=134838)

nfusselman1 18-02-2015 10:39

Encoder
 
I am needing to know what encoders do we need to buy to put them on the drive train and how would be connect them and program them be have never used them before.

Ether 18-02-2015 11:34

Re: Encoder
 
Quote:

Originally Posted by nfusselman1 (Post 1446338)
I am needing to know what encoders do we need to buy to put them on the drive train and how would be connect them and program them be have never used them before.

Describe your drivetrain in detail (e.g. mecanum or H drive or skidsteer, what gearboxes, etc etc) and what you want the encoders to do for you.



legts 18-02-2015 12:20

Re: Encoder
 
As @Ether said, more details would be appreciated. I programmed the encoders for my team this year but my experience is limited.

nfusselman1 18-02-2015 12:26

Re: Encoder
 
we have the gearbox drive train with the AM14U2 Drive System. (We only use one motor on each side if that helps)

legts 18-02-2015 12:28

Re: Encoder
 
What do you use for speed control (talons, victors, jaguars) and what kind of wheels do you have?

nfusselman1 18-02-2015 12:32

Re: Encoder
 
Talons

nfusselman1 18-02-2015 12:33

Re: Encoder
 
and the regular kit weals (tile)

legts 18-02-2015 12:34

Re: Encoder
 
My team uses jaguars, but the code might be similar. What language do you program in?

nfusselman1 18-02-2015 12:35

Re: Encoder
 
java

legts 18-02-2015 12:45

Re: Encoder
 
What our electrical team did was they wired optical encoders onto the axel and into the jag. Inside of the DriveTrain subsystem, I called a method on each of the jags to inform them that they have encoders. That portion of code looked like this:
Quote:

rightFront.setPercentMode(CANJaguar.kQuadEncoder, encoderCounts);
Below that, I enabled encoder control on each of the jags:
Quote:

rightFront.enableControl();
I was then able to use the encoders in other programs.

I wouldn't know without looking at the javadocs, but if I were to make an educated guess I would say that setting up encoders would be similar to this but with talons instead of jaguars.

nfusselman1 18-02-2015 12:47

Re: Encoder
 
ok what kind of encoders did you get and how did you attach them.

nickmcski 18-02-2015 12:51

Re: Encoder
 
What do you plan to use the encoders for? Making sure both wheels turn at the same speed or are you using it for finding out how far you have driven?

legts 18-02-2015 12:56

Re: Encoder
 
We used optical encoders, I'd have to ask the electrical folks for more details. I'm working on incorporating them into autonomous mode.

nfusselman1 18-02-2015 12:56

Re: Encoder
 
both but mainly distance.

nickmcski 18-02-2015 13:53

Re: Encoder
 
These are the encoders our team purchased http://www.andymark.com/product-p/am-0180.htm and they are working extremely well for us. One thing we want to try is wiring them directly up to our talons (You can only do this if you have the talon SRX's).

If you cant wire them up to the talons then wire them up to the roboRIO, our team accomplished this by cutting up 2 unneeded PWM cables. We wired the cables like so:


(This image is not mine, I just found it online)

Then we programmed them link this
Code:

        Encoder encoderleft; //Declare the encoders so they are accessible in all methods
        Encoder encoderright;

        public void robotInit() {
                encoderleft = new Encoder(0, 1); //Initalize the encoder, A channel is plugged into DIO 0, B channel DIO 1.
                encoderright = new Encoder(2, 3);

                encoderleft.setDistancePerPulse(0.11); //did some math to calculate that for 1 pulse the robot moved 0.11 of an inch (Will be different for other robots)
                encoderright.setDistancePerPulse(0.11);
        }

        public void autonomousPeriodic() {
                double distance = (encoderleft.getDistance() + encoderright.getDistance()) /2; //Find the distance robot has travled based off of the average of the 2 encoders.
               


                //Code to make your robot move off of the encoder values here
        }



All times are GMT -5. The time now is 13:01.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi