Go to Post We learn from our failures, but our successes reinforce what we've learned. - Mike Ciance [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

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 19-01-2015, 14:15
Jasmine11197 Jasmine11197 is offline
Registered User
FRC #1946 (Mishka Monsters)
Team Role: Programmer
 
Join Date: Jan 2013
Rookie Year: 2012
Location: Israel
Posts: 6
Jasmine11197 is an unknown quantity at this point
How to Program the encoder?

Hi
I need some information about connecting encoder to the drive system
by that I mean how to basic programing it

actually this is the first year we attemp to use it , and i need some basic information about it / about programing it / about connecting it as well.

and i'd be really thankful.
  #2   Spotlight this post!  
Unread 19-01-2015, 14:19
thatprogrammer's Avatar
thatprogrammer thatprogrammer is offline
Registered User
AKA: Ahad Bawany
no team (None)
Team Role: Programmer
 
Join Date: Apr 2014
Rookie Year: 2014
Location: Florida
Posts: 610
thatprogrammer has a reputation beyond reputethatprogrammer has a reputation beyond reputethatprogrammer has a reputation beyond reputethatprogrammer has a reputation beyond reputethatprogrammer has a reputation beyond reputethatprogrammer has a reputation beyond reputethatprogrammer has a reputation beyond reputethatprogrammer has a reputation beyond reputethatprogrammer has a reputation beyond reputethatprogrammer has a reputation beyond reputethatprogrammer has a reputation beyond repute
Re: How to Program the encoder?

Some questions to improve the quality of responses:
1. What language?
2. Intended usage?
3. Kind of Encoder
4. Teleop or Auto?
  #3   Spotlight this post!  
Unread 19-01-2015, 14:23
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: How to Program the encoder?

What programming language are you using?

LabVIEW has detailed examples for many things, including wiring and programming quadrature encoders.
  #4   Spotlight this post!  
Unread 20-01-2015, 00:27
nandeeka's Avatar
nandeeka nandeeka is offline
Registered User
FRC #1868
Team Role: Programmer
 
Join Date: May 2014
Rookie Year: 2013
Location: United States
Posts: 53
nandeeka is on a distinguished road
Re: How to Program the encoder?

Some resources if you are using C++ or Java:

C++ - http://first.wpi.edu/FRC/roborio/rel...ssEncoder.html

Java - http://first.wpi.edu/FRC/roborio/release/docs/java/classedu_1_1wpi_1_1first_1_1wpilibj_1_1Encoder.htm l

C++ and Java - http://wpilib.screenstepslive.com/s/...or-other-shaft
  #5   Spotlight this post!  
Unread 20-01-2015, 07:26
Qbot2640's Avatar
Qbot2640 Qbot2640 is offline
Registered User
AKA: Terry McHugh
FRC #2640 (Hotbotz)
Team Role: Mentor
 
Join Date: Sep 2012
Rookie Year: 2012
Location: Reidsville, NC
Posts: 473
Qbot2640 has a reputation beyond reputeQbot2640 has a reputation beyond reputeQbot2640 has a reputation beyond reputeQbot2640 has a reputation beyond reputeQbot2640 has a reputation beyond reputeQbot2640 has a reputation beyond reputeQbot2640 has a reputation beyond reputeQbot2640 has a reputation beyond reputeQbot2640 has a reputation beyond reputeQbot2640 has a reputation beyond reputeQbot2640 has a reputation beyond repute
Re: How to Program the encoder?

Quote:
Originally Posted by Alan Anderson View Post
What programming language are you using?

LabVIEW has detailed examples for many things, including wiring and programming quadrature encoders.
Could you point me to these examples?....I have found examples of how to set them up, but no examples that actually do anything with them...

For example, how do I actually take data from the encoders and use it to set distance, or monitor straight traveling.
__________________

2012 Palmetto Regional Winners (Thanks 2059, 2815, and 287).
2012 Newton 14th Seed
2013 Chesapeake Regional Imagery Award Winners
2014 North Carolina Regional Imagery Award Winners
2014 Greater DC Regional Team Spirit Award Winners
2015 North Carolina Regional Finalists (Thanks 3971 and 587)
  #6   Spotlight this post!  
Unread 21-01-2015, 00:08
Optimism's Avatar
Optimism Optimism is offline
Registered User
AKA: Calvin Ly
FRC #2468 (Team Appreciate)
Team Role: Programmer
 
Join Date: Jul 2014
Rookie Year: 2012
Location: Austin
Posts: 13
Optimism is an unknown quantity at this point
Re: How to Program the encoder?

Quote:
Originally Posted by Qbot2640 View Post
Could you point me to these examples?....I have found examples of how to set them up, but no examples that actually do anything with them...

For example, how do I actually take data from the encoders and use it to set distance, or monitor straight traveling.
Go to the LabVIEW Getting Started Window, click on Support, and click on Find FRC examples. There are examples for encoders under "Robot and Motor" and "Sensors."
  #7   Spotlight this post!  
Unread 21-01-2015, 07:16
Qbot2640's Avatar
Qbot2640 Qbot2640 is offline
Registered User
AKA: Terry McHugh
FRC #2640 (Hotbotz)
Team Role: Mentor
 
Join Date: Sep 2012
Rookie Year: 2012
Location: Reidsville, NC
Posts: 473
Qbot2640 has a reputation beyond reputeQbot2640 has a reputation beyond reputeQbot2640 has a reputation beyond reputeQbot2640 has a reputation beyond reputeQbot2640 has a reputation beyond reputeQbot2640 has a reputation beyond reputeQbot2640 has a reputation beyond reputeQbot2640 has a reputation beyond reputeQbot2640 has a reputation beyond reputeQbot2640 has a reputation beyond reputeQbot2640 has a reputation beyond repute
Re: How to Program the encoder?

Quote:
Originally Posted by Optimism View Post
Go to the LabVIEW Getting Started Window, click on Support, and click on Find FRC examples. There are examples for encoders under "Robot and Motor" and "Sensors."
Been there....these are the examples I refer to, that show how to set it up, but not how to actually do anything with it.
__________________

2012 Palmetto Regional Winners (Thanks 2059, 2815, and 287).
2012 Newton 14th Seed
2013 Chesapeake Regional Imagery Award Winners
2014 North Carolina Regional Imagery Award Winners
2014 Greater DC Regional Team Spirit Award Winners
2015 North Carolina Regional Finalists (Thanks 3971 and 587)
  #8   Spotlight this post!  
Unread 21-01-2015, 07:38
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: How to Program the encoder?

The examples do show you how to read the sensor values. What you do with the results is up to you.

So what do you want to do with them? That's the question you need to answer in detail before you can get advice on how to do it. "Set distance" and "monitor travel" are too vague. You need to give much more detail on how your robot is designed, where you plan your sensors to be, and exactly what your goal is.
  #9   Spotlight this post!  
Unread 21-01-2015, 08:54
Qbot2640's Avatar
Qbot2640 Qbot2640 is offline
Registered User
AKA: Terry McHugh
FRC #2640 (Hotbotz)
Team Role: Mentor
 
Join Date: Sep 2012
Rookie Year: 2012
Location: Reidsville, NC
Posts: 473
Qbot2640 has a reputation beyond reputeQbot2640 has a reputation beyond reputeQbot2640 has a reputation beyond reputeQbot2640 has a reputation beyond reputeQbot2640 has a reputation beyond reputeQbot2640 has a reputation beyond reputeQbot2640 has a reputation beyond reputeQbot2640 has a reputation beyond reputeQbot2640 has a reputation beyond reputeQbot2640 has a reputation beyond reputeQbot2640 has a reputation beyond repute
Re: How to Program the encoder?

Quote:
Originally Posted by Alan Anderson View Post
The examples do show you how to read the sensor values. What you do with the results is up to you.

So what do you want to do with them? That's the question you need to answer in detail before you can get advice on how to do it. "Set distance" and "monitor travel" are too vague. You need to give much more detail on how your robot is designed, where you plan your sensors to be, and exactly what your goal is.
First - thanks for the responses, Second - please be patient!

We have never used encoders. Our method has always been to run the motors for a specific amount of time to get where we're trying to go. Obviously conditions change and our results can vary.

We want to use the encoders to "measure" a specific distance, so we can program the robot to move "x...feet" and then stop (or do "whatever"). We also want to use the encoder output to compare movement from left and right and correct drift. We largely got lucky last year with our "run the motor for this long" method...but were burned by drift in several matches - having our auto shot miss because the robot turned slightly.

Please understand...I agree that the examples provide information, but I have to believe that there are many users like me who have tried hard to fill in the blanks and just can't figure it out. A simple example of one of these "blanks" is where to put the code given in the examples....begin?....periodic tasks?....The examples are not at all "beginner friendly."

This will be a new thing for us, and I really need to understand how to do it because I feel like I need to sell the idea to others on my team who think our programming is sophisticated enough...I really thing we need to master this if we expect to grow at all.
__________________

2012 Palmetto Regional Winners (Thanks 2059, 2815, and 287).
2012 Newton 14th Seed
2013 Chesapeake Regional Imagery Award Winners
2014 North Carolina Regional Imagery Award Winners
2014 Greater DC Regional Team Spirit Award Winners
2015 North Carolina Regional Finalists (Thanks 3971 and 587)
  #10   Spotlight this post!  
Unread 21-01-2015, 10:38
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: How to Program the encoder?

Quote:
Originally Posted by Qbot2640 View Post
We want to use the encoders to "measure" a specific distance, so we can program the robot to move "x...feet" and then stop (or do "whatever"). We also want to use the encoder output to compare movement from left and right and correct drift.
That's a good high-level goal. Do you have any thoughts about how you would go about doing it? The encoder value is essentially the distance measurement you're looking for, so that part is already available to you.

Comparing the encoder outputs is a simple matter of subtracting one from the other. When the values are the same, both sides of the robot have gone the same distance. When they differ, the robot has turned. You can use the difference to control the "X" input of an Arcade Drive function, so that the robot turns toward the direction of making the values the same again.

Quote:
Please understand...I agree that the examples provide information, but I have to believe that there are many users like me who have tried hard to fill in the blanks and just can't figure it out. A simple example of one of these "blanks" is where to put the code given in the examples....begin?....periodic tasks?....The examples are not at all "beginner friendly."
Have you looked at the LabVIEW Tutorials? You want Tutorial 7, which tells you how to integrate examples into your robot code.
  #11   Spotlight this post!  
Unread 21-01-2015, 13:23
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,756
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: How to Program the encoder?

It is true that the example programs tend to focus on getting the encoders connected properly and getting valid readings from them. This is fundamental, and if not done correctly, it simply won't work. Integrating this code into the framework is pretty straightforward once you get your bearings. Hopefully the integration tutorial will help. If not, please ask additional questions.

Doing something with motors and encoders quickly gets very specific to the mechanism being controlled. It is practically impossible for the framework code or game specific code to do much in the way of control because it doesn't know what wheels, what gear ratios, the weight, weight distribution, or anything else about the robot. But luckily many teams each year do this code, and publish their code. If you find a team that works similar to you, builds similar robots, etc. Not only will you have something to read, but someone to contact.

I did a Google search for "LabVIEW FRC Drive Straight". The top link was Team 27, and the doc on page 17 shows how they use a "by half" adjustment in order to straighten their robot. This is simple to implement and test and sounds like a good place to start.

I'm sure there are many others.

Greg McKaskle
Closed Thread


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 03:00.

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