Go to Post It takes a village to raise a robotics student... - Bob Steele [more]
Home
Go Back   Chief Delphi > FIRST > General Forum
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 01-02-2014, 18:49
pribusin's Avatar
pribusin pribusin is offline
Uber Alien
AKA: Mike 1
FRC #4004 (M.A.R.S. Rovers)
Team Role: Coach
 
Join Date: Jan 2009
Rookie Year: 2009
Location: Michigan
Posts: 170
pribusin has a spectacular aura aboutpribusin has a spectacular aura aboutpribusin has a spectacular aura about
How to use encoders

My team has never used encoders. This year our robot has a throwing arm (catapult) that we are driving with a toughbox and 2 CIMs. We have an encoder on the TB. My question is how do we use it. Our goal is to determine the position of the arm. Is it possible to determine absolute position using encoders? Sort of like the insides of a servo?

We use LabView to program and I'm not sure what the encoder connects to physically so that we can read it in LV. I know you can connect it directly to a Jaguar but since we have 2 CIMS we have to use 2 controllers and we were planning to use 2 Talons.

Any suggestions? My students are asking questions and I don't have any answers.

Thanks.
Reply With Quote
  #2   Spotlight this post!  
Unread 01-02-2014, 19:04
TogetherSword8 TogetherSword8 is offline
Registered User
FRC #0888 (Robotiators)
Team Role: Alumni
 
Join Date: Feb 2012
Rookie Year: 2012
Location: Glenelg High School
Posts: 85
TogetherSword8 is an unknown quantity at this point
Re: How to use encoders

As a team that just started integrating sensors 2 years ago, these are our first trial and errors:

For an absolute position, there are absolute encoders, but I cannot tell you where to find any. How we do absolute position is by using limit switches to reset a relative position anytime a limit switch is hit. This year we are using a gear tooth counter on our arm, because of the way we are running it, with two limit switches on either side to set the limit angles, and also prevent from over-rotating.

You will get a chance to show your students how math is used with the encoder on your toughbox, because you want to find out mathematically what your ratio will be of how fast the encoder spins to how much the angle changes (assuming you are using optical or any shaft based encoder). Try not to do it experimentally, because with encoders, the mathematical formulas are more often than not more accurate than anything you can measure. (Took us a whole season to learn that lesson).

Anything else you need I am sure all of us at Chief Delphi have answers for you.
__________________
I program a robot. Which means I write code and everyone gets mad at me when something doesn't work, even if I am the only one that knows it doesn't work. The key part to know is that the robot never works.
Reply With Quote
  #3   Spotlight this post!  
Unread 01-02-2014, 19:32
apalrd's Avatar
apalrd apalrd is offline
More Torque!
AKA: Andrew Palardy (Most people call me Palardy)
VRC #3333
Team Role: College Student
 
Join Date: Mar 2009
Rookie Year: 2009
Location: Auburn Hills, MI
Posts: 1,347
apalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond repute
Re: How to use encoders

If you're going a few rotations, you can use a potentiometer. They are sold at DigiKey (http://digikey.com) under 'linear potentiometers'. They come in 1-turn (most are actually 270 degrees), 3 turn, 5 turn, and 10 turn. They are connected to an analog breakout and give a voltage between 0 and 5v (it's actually a variable resistor, so it's a ratio between the ground and power you feed it, which is 5v from the analog breakout).

If you need an absolute encoder, I've heard good things about DigiKey 987-1393-ND (360 degree absolute encoder) from Chief. We bought a bunch, and I will report their performance later.
__________________
Kettering University - Computer Engineering
Kettering Motorsports
Williams International - Commercial Engines - Controls and Accessories
FRC 33 - The Killer Bees - 2009-2012 Student, 2013-2014 Advisor
VEX IQ 3333 - The Bumble Bees - 2014+ Mentor

"Sometimes, the elegant implementation is a function. Not a method. Not a class. Not a framework. Just a function." ~ John Carmack
Reply With Quote
  #4   Spotlight this post!  
Unread 04-12-2015, 07:26
pilleya's Avatar
pilleya pilleya is offline
Elec+Mech
AKA: Alastair Pilley
FRC #4613 (Barker Redbacks)
Team Role: Mechanical
 
Join Date: May 2015
Rookie Year: 2013
Location: Sydney, Australia
Posts: 454
pilleya has a reputation beyond reputepilleya has a reputation beyond reputepilleya has a reputation beyond reputepilleya has a reputation beyond reputepilleya has a reputation beyond reputepilleya has a reputation beyond reputepilleya has a reputation beyond reputepilleya has a reputation beyond reputepilleya has a reputation beyond reputepilleya has a reputation beyond reputepilleya has a reputation beyond repute
Re: How to use encoders

The attached link seems to be incorrect, the site is about optic fibre cable manufacturing, rather then encoders
Reply With Quote
  #5   Spotlight this post!  
Unread 04-12-2015, 08:07
tr6scott's Avatar
tr6scott tr6scott is offline
Um, I smell Motor!
AKA: Scott McBride
FRC #2137 (TORC)
Team Role: Mentor
 
Join Date: Dec 2007
Rookie Year: 2005
Location: Oxford, MI
Posts: 520
tr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond repute
Re: How to use encoders

Start Labview.
Click "Support"
Click "Find FRC Examples"
Under "Sensors" Find the "Motor with Encoder" Project.

The front panel shows the wiring for the example, this is with a two channel incremental encoder.

Incremental encoders, give a count that is equal to the resolution of the encoder, usually stated as PPR, pulses per revolution, or counts per revolution.

Review the labview code, ask questions here.

Let us know what encoder you are using, and where in the gear train it is mounted.
__________________
The sooner we get behind schedule, the more time we have to catch up.

Reply With Quote
  #6   Spotlight this post!  
Unread 04-12-2015, 10:24
cbale2000's Avatar
cbale2000 cbale2000 is offline
Registered User
AKA: Chris Bale
FRC #5712 (Gray Matter)
Team Role: Mentor
 
Join Date: Apr 2006
Rookie Year: 2004
Location: Saginaw, MI
Posts: 947
cbale2000 has a reputation beyond reputecbale2000 has a reputation beyond reputecbale2000 has a reputation beyond reputecbale2000 has a reputation beyond reputecbale2000 has a reputation beyond reputecbale2000 has a reputation beyond reputecbale2000 has a reputation beyond reputecbale2000 has a reputation beyond reputecbale2000 has a reputation beyond reputecbale2000 has a reputation beyond reputecbale2000 has a reputation beyond repute
Re: How to use encoders

Quote:
Originally Posted by tr6scott View Post
Start Labview.
Click "Support"
Click "Find FRC Examples"
Under "Sensors" Find the "Motor with Encoder" Project.

The front panel shows the wiring for the example, this is with a two channel incremental encoder.

Incremental encoders, give a count that is equal to the resolution of the encoder, usually stated as PPR, pulses per revolution, or counts per revolution.

Review the labview code, ask questions here.

Let us know what encoder you are using, and where in the gear train it is mounted.
Do the methods in the Labview examples work the same if the encoder is connected via a Talon SRX encoder input?
My teams programmers have been struggling to get these encoders on our drive system working since the start of the season.

Last edited by cbale2000 : 04-12-2015 at 10:32.
Reply With Quote
  #7   Spotlight this post!  
Unread 04-12-2015, 11:14
tr6scott's Avatar
tr6scott tr6scott is offline
Um, I smell Motor!
AKA: Scott McBride
FRC #2137 (TORC)
Team Role: Mentor
 
Join Date: Dec 2007
Rookie Year: 2005
Location: Oxford, MI
Posts: 520
tr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond repute
Re: How to use encoders

The example I listed does not deal with that application but there is an example called "CAN Talon Speed Control Encoder" that does address that. The front panel in the labview VI has the instructions.

Just a reminder, when you run these examples, even though you may not have a full robot hooked up, you still need to run a drivers station and enable teleop for them to work. It is in the instructions, but many people seem to overlook this step.

EDIT: this example can be found under the "CAN" sub-folder for the roborio.
__________________
The sooner we get behind schedule, the more time we have to catch up.


Last edited by tr6scott : 04-12-2015 at 11:59. Reason: Added location
Reply With Quote
  #8   Spotlight this post!  
Unread 04-12-2015, 14:43
pilleya's Avatar
pilleya pilleya is offline
Elec+Mech
AKA: Alastair Pilley
FRC #4613 (Barker Redbacks)
Team Role: Mechanical
 
Join Date: May 2015
Rookie Year: 2013
Location: Sydney, Australia
Posts: 454
pilleya has a reputation beyond reputepilleya has a reputation beyond reputepilleya has a reputation beyond reputepilleya has a reputation beyond reputepilleya has a reputation beyond reputepilleya has a reputation beyond reputepilleya has a reputation beyond reputepilleya has a reputation beyond reputepilleya has a reputation beyond reputepilleya has a reputation beyond reputepilleya has a reputation beyond repute
Re: How to use encoders

Thanks for you help, the broken link that I was referencing was actually on a post which has now vanished, it did seem suspicious (probably removed by the moderators)

Last edited by pilleya : 04-12-2015 at 14:46.
Reply With Quote
  #9   Spotlight this post!  
Unread 04-12-2015, 16:20
ozrien's Avatar
ozrien ozrien is offline
Omar Zrien
AKA: Omar
no team
Team Role: Mentor
 
Join Date: Sep 2006
Rookie Year: 2003
Location: Sterling Heights, MI
Posts: 523
ozrien has a reputation beyond reputeozrien has a reputation beyond reputeozrien has a reputation beyond reputeozrien has a reputation beyond reputeozrien has a reputation beyond reputeozrien has a reputation beyond reputeozrien has a reputation beyond reputeozrien has a reputation beyond reputeozrien has a reputation beyond reputeozrien has a reputation beyond reputeozrien has a reputation beyond repute
Re: How to use encoders

Hey Chris,
Since you are using the Talon's sensor features I would start by looking at our Talon SRX software reference manual...
http://www.ctr-electronics.com/talon...ical_resources

Section 2.4 goes over the roboRIO web-based config which is an easy way to get the sensor value so you can sanity check the position/velocity. This works even with no code deployed because the Talon is always decoding sensor signals. Also the web page lets you set settings without having to write code, which is great for getting started and quick tweaking. All the settings in the web page are persistent.

Section 5.1 has a LabVIEW example on un-bundling signals including Sensor Position and Sensor Velocity.

Section 7.1 has a LabVIEW example on selecting the sensor type, be sure to direct the sensor to be in phase with the motor if you want to use the internal closed-loop features (section 7.4).

Section 13 has examples for setting the sensor position, great for zero-ing all your sensors.

Section 16.9 has some good stuff on processing the sensor data yourself if you don't want to the Talon to closed-loop for you. You can control how fast the Talon sends sensor pos/velocity to the RIO so you can choose how much you want to offload to the Talon. This is neat because each Talon effectively gives you an additional 1x analog input, 1x quad input, 2 digital inputs (you can use limit switch inputs just for measurement if you want), and 1x pulse width decoder.

The sensor position and velocity were all in native-units last season, which is explained in section 17.

Scott's mentioned example is a good one too. Has the PIDF gains broken out in a VI for easy tweaking.
Reply With Quote
  #10   Spotlight this post!  
Unread 04-12-2015, 16:34
cbale2000's Avatar
cbale2000 cbale2000 is offline
Registered User
AKA: Chris Bale
FRC #5712 (Gray Matter)
Team Role: Mentor
 
Join Date: Apr 2006
Rookie Year: 2004
Location: Saginaw, MI
Posts: 947
cbale2000 has a reputation beyond reputecbale2000 has a reputation beyond reputecbale2000 has a reputation beyond reputecbale2000 has a reputation beyond reputecbale2000 has a reputation beyond reputecbale2000 has a reputation beyond reputecbale2000 has a reputation beyond reputecbale2000 has a reputation beyond reputecbale2000 has a reputation beyond reputecbale2000 has a reputation beyond reputecbale2000 has a reputation beyond repute
Re: How to use encoders

Quote:
Originally Posted by tr6scott View Post
The example I listed does not deal with that application but there is an example called "CAN Talon Speed Control Encoder" that does address that. The front panel in the labview VI has the instructions...
Quote:
Originally Posted by ozrien View Post
Hey Chris,
Since you are using the Talon's sensor features I would start by looking at our Talon SRX software reference manual...
http://www.ctr-electronics.com/talon...ical_resources...
Thanks both of you, all this information is very helpful

I believe our programming lead did look into running the encoders through the Talons directly, but she has been having some issues getting the web interface to actually come up for some reason (not sure if it's an issue with our computer, the CAN setup, or something else).

Programming is a bit outside of my area and my Labview is a bit rusty, but it seems like I may have to force myself to re-learn it to finally figure these things out, since our programmers have been unable to for the last 6 months.
Reply With Quote
  #11   Spotlight this post!  
Unread 04-12-2015, 16:43
ozrien's Avatar
ozrien ozrien is offline
Omar Zrien
AKA: Omar
no team
Team Role: Mentor
 
Join Date: Sep 2006
Rookie Year: 2003
Location: Sterling Heights, MI
Posts: 523
ozrien has a reputation beyond reputeozrien has a reputation beyond reputeozrien has a reputation beyond reputeozrien has a reputation beyond reputeozrien has a reputation beyond reputeozrien has a reputation beyond reputeozrien has a reputation beyond reputeozrien has a reputation beyond reputeozrien has a reputation beyond reputeozrien has a reputation beyond reputeozrien has a reputation beyond repute
Re: How to use encoders

If you can describe the symptoms we can likely help. One thought is that Chrome does not support Silverlight. I recommend using internet explorer or mozilla-firefox.
Reply With Quote
  #12   Spotlight this post!  
Unread 04-12-2015, 18:18
DonRotolo's Avatar
DonRotolo DonRotolo is offline
Back to humble
FRC #0832
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2005
Location: Atlanta GA
Posts: 7,007
DonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond repute
Re: How to use encoders

Quote:
Originally Posted by pribusin View Post
My team has never used encoders.
Encoders are scary at first, but really are not difficult. Basically, an encoder of the type I think you have (you don't state it, but connected to a TB is likely a US Encoder) gives out X number of pulses for each revolution, from 2 different outputs. You count pulses to determine movement, limited by the number of pulses per revolution*

2 outputs allow you to determine direction, not just movement.

Counting the pulses and comparing that to time allows you to determine speed.

It is possible to count the pulses, including the direction information, and know the absolute position of the arm. I think a Potentiometer may be a better choice, however, since it is better suited to position sensing because of its greater sensitivity to small movements and its lack of dependence upon counting (which, if fouled up, becomes inaccurate). Also, see the * note for a discussion of resolution. A potentiometer is also simpler to program, since it uses an analog input, the voltage being related to the arm position. The downside is you mount it on the arm, not the gearbox.

As for programming, there is sample code as others mentioned, but basically you count pulses and keep track it them. I can't help you with Talon programming; I suggest you use the Talons as motor controllers only until you get some experience, since LV is more easily troubleshot.

*If you have an encoder that delivers 128 pulses per revolution (PPR), the best you can get is to detect 1/128th of a revolution. This may limit what you can accomplish.
2 outputs are not in-phase with each other, but they are digital pulses, so if one output signals before the other, you are sure it is going in one direction, and if the other output signals before the first, then it is going in the other direction. This works pretty well, by the way.

Try things, explain the problems encountered here, we'll help.
__________________

I am N2IRZ - What's your callsign?
Reply With Quote
  #13   Spotlight this post!  
Unread 04-12-2015, 21:09
asid61's Avatar
asid61 asid61 is offline
Registered User
AKA: Anand Rajamani
FRC #0115 (MVRT)
Team Role: Mechanical
 
Join Date: Jan 2014
Rookie Year: 2013
Location: Cupertino, CA
Posts: 2,224
asid61 has a reputation beyond reputeasid61 has a reputation beyond reputeasid61 has a reputation beyond reputeasid61 has a reputation beyond reputeasid61 has a reputation beyond reputeasid61 has a reputation beyond reputeasid61 has a reputation beyond reputeasid61 has a reputation beyond reputeasid61 has a reputation beyond reputeasid61 has a reputation beyond reputeasid61 has a reputation beyond repute
Re: How to use encoders

Quote:
Originally Posted by DonRotolo View Post
Try things, explain the problems encountered here, we'll help.
I feel like I should mention the OP is from February 2014, almost two years ago. Your post is very helpful, but I'm not sure the OP will see it.
__________________
<Now accepting CAD requests and commissions>

Reply With Quote
  #14   Spotlight this post!  
Unread 06-12-2015, 19:41
tr6scott's Avatar
tr6scott tr6scott is offline
Um, I smell Motor!
AKA: Scott McBride
FRC #2137 (TORC)
Team Role: Mentor
 
Join Date: Dec 2007
Rookie Year: 2005
Location: Oxford, MI
Posts: 520
tr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond repute
Re: How to use encoders

Ha, Ha, oops, details..
__________________
The sooner we get behind schedule, the more time we have to catch up.

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 07:56.

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