Go to Post We may not build the best robots but we're building better students in the long run and means much much more. - Koko Ed [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 02-02-2011, 11:38
JohnFogarty's Avatar
JohnFogarty JohnFogarty is offline
Trapped under a pile of MECANUMS :P
AKA: @doctorfogarty
FTC #11444 (Garnet Squadron) & FRC#1102 (M'Aiken Magic)
Team Role: Mentor
 
Join Date: Aug 2009
Rookie Year: 2006
Location: Aiken, SC
Posts: 1,582
JohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond repute
Motor Encoder code. LabVIEW

So this year for FRC we are using an arm system with motors that are geared down so much they are non-back drivable meaning when there is no power applied to them the won't move. What I want to accomplish in LabVIEW is to be able to push a button and have a motor go to a certain position. and in reality a button would be able to move several motors simultaneously to certain predefined positions. I've been told that the encoders we use are relative encoders and so that changes how this can be accomplished a bit. Any help would be appreciated.

John Fogarty
__________________
John Fogarty
2010 FTC World Championship Winner & 2013-2014 FRC Orlando Regional Winner
Mentor FRC Team 1102 M'Aiken Magic
"Head Bot Coach" FTC Team 11444 Garnet Squadron
Former Student & Mentor FLL 1102, FTC 1102 & FTC 3864, FRC 1772, FRC 5632, FRC 4901
2013 FTC World Championship Guest Speaker
  #2   Spotlight this post!  
Unread 02-02-2011, 11:45
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: Motor Encoder code. LabVIEW

1. Potentiometers are better than encoders because the are absolute, so you don't loose your position when you reboot (and if you happen to die during a match, you won't have to return to home before using your robot)

2. You would probably want to use P or PID control. Wikipedia has a great article about it - http://en.wikipedia.org/wiki/PID_controller.

3. Start with P. If it has issues (which generally only happens if it moves very fast, which yours dosen't seem like it does), then you can add D. I might be necessary, but probably not.

4. You would probably have a controller for each joint, and feed the setpoints from an array.

Here's how I would write the code:
1. Create an enumerated type to define the state. In LabVIEW, create an enum and edit the items in the list.
2. Create a cluster (in C++, it's a structure), defining the setpoints for all controllers. For example, you would have a Dbl for each joint, then hit the "align horizontal" button for LabVIEW to make them all nice and neat
3. Create an array of the clusters. Each line in the array will represent one item in the state.
4. Since an enumerated type can be used as a uint8, find the numeric representation of each and label each item in the list. Then, use the Index Array block (just index in C, with an array[item]) and get the item in the array that goes with the state.
5. Drive the arm with the newly aquired cluster of positions
6. Set the state whenever a button is pressed.
Make sense?
__________________
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
  #3   Spotlight this post!  
Unread 02-02-2011, 12:42
Mark McLeod's Avatar
Mark McLeod Mark McLeod is offline
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,906
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: Motor Encoder code. LabVIEW

Here's a generic example of using PID to drive a motor to a desired position.
Attached Thumbnails
Click image for larger version

Name:	Generic PID.jpg
Views:	1229
Size:	32.5 KB
ID:	9928  
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle
  #4   Spotlight this post!  
Unread 03-02-2011, 15:59
Wicked Wicked is offline
Registered User
FRC #0354 (G-House Pirates)
Team Role: Programmer
 
Join Date: Dec 2008
Rookie Year: 2008
Location: New York
Posts: 46
Wicked is an unknown quantity at this point
Re: Motor Encoder code. LabVIEW

Quote:
Originally Posted by apalrd View Post
1. Potentiometers are better than encoders because the are absolute, so you don't loose your position when you reboot (and if you happen to die during a match, you won't have to return to home before using your robot)
Couldn't you just use the absolute encoder to get around this?
  #5   Spotlight this post!  
Unread 03-02-2011, 17:34
JohnFogarty's Avatar
JohnFogarty JohnFogarty is offline
Trapped under a pile of MECANUMS :P
AKA: @doctorfogarty
FTC #11444 (Garnet Squadron) & FRC#1102 (M'Aiken Magic)
Team Role: Mentor
 
Join Date: Aug 2009
Rookie Year: 2006
Location: Aiken, SC
Posts: 1,582
JohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond repute
Re: Motor Encoder code. LabVIEW

Quote:
Originally Posted by Wicked View Post
Couldn't you just use the absolute encoder to get around this?
expensiveeeeeeeee.
__________________
John Fogarty
2010 FTC World Championship Winner & 2013-2014 FRC Orlando Regional Winner
Mentor FRC Team 1102 M'Aiken Magic
"Head Bot Coach" FTC Team 11444 Garnet Squadron
Former Student & Mentor FLL 1102, FTC 1102 & FTC 3864, FRC 1772, FRC 5632, FRC 4901
2013 FTC World Championship Guest Speaker
  #6   Spotlight this post!  
Unread 03-02-2011, 17:46
Wicked Wicked is offline
Registered User
FRC #0354 (G-House Pirates)
Team Role: Programmer
 
Join Date: Dec 2008
Rookie Year: 2008
Location: New York
Posts: 46
Wicked is an unknown quantity at this point
Re: Motor Encoder code. LabVIEW

...It's included in the KOP, what other expenses are there?
  #7   Spotlight this post!  
Unread 03-02-2011, 18:13
Dkt01's Avatar
Dkt01 Dkt01 is offline
Programming Mentor
AKA: David
FRC #1756 (Argos)
Team Role: Mentor
 
Join Date: Jan 2010
Rookie Year: 2009
Location: Peoria, Il
Posts: 145
Dkt01 will become famous soon enough
Re: Motor Encoder code. LabVIEW

We're using 3 potentiometers on our robot this year and they work great. We'll also have encoders, but so far they don't work as easily. Plus, it's really easy to convert a potentiometer's voltage to an angle or distance (even changing where your base position is).
  #8   Spotlight this post!  
Unread 04-02-2011, 12:41
JohnFogarty's Avatar
JohnFogarty JohnFogarty is offline
Trapped under a pile of MECANUMS :P
AKA: @doctorfogarty
FTC #11444 (Garnet Squadron) & FRC#1102 (M'Aiken Magic)
Team Role: Mentor
 
Join Date: Aug 2009
Rookie Year: 2006
Location: Aiken, SC
Posts: 1,582
JohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond repute
Re: Motor Encoder code. LabVIEW

Soo It sounds like Pots are alot more common and easier to use, and the only encoders we found in the KOP are a optical disk type of encoder that are relative encoders. There are small boards for rotary and linear encoders but the encoders themselves aren't included. We plan on going to radioshack and getting some pots to use.
__________________
John Fogarty
2010 FTC World Championship Winner & 2013-2014 FRC Orlando Regional Winner
Mentor FRC Team 1102 M'Aiken Magic
"Head Bot Coach" FTC Team 11444 Garnet Squadron
Former Student & Mentor FLL 1102, FTC 1102 & FTC 3864, FRC 1772, FRC 5632, FRC 4901
2013 FTC World Championship Guest Speaker
  #9   Spotlight this post!  
Unread 04-02-2011, 13: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: Motor Encoder code. LabVIEW

Quote:
Originally Posted by John_1102 View Post
There are small boards for rotary and linear encoders but the encoders themselves aren't included.
"The encoders themselves" are embedded in the larger black integrated circuit devices on those boards. The two magnetic rotary encoders came with the small round magnets that are used with them. The magnetic linear encoder came with the thin flexible magnetic strip that is used with it.

Look at the Kit of Parts web page to find the Parts Data Sheets for the AS5030 - Rotary Magnetic Encoder and AS5304 - Linear Magnetic Encoder devices.
  #10   Spotlight this post!  
Unread 05-02-2011, 09:55
Dustin Shadbolt's Avatar
Dustin Shadbolt Dustin Shadbolt is offline
In a server room somewhere...
AKA: Dustin Shadbolt
FRC #1555 (Team PULSE)
Team Role: Alumni
 
Join Date: Jan 2010
Rookie Year: 2010
Location: Monticello,Indiana
Posts: 320
Dustin Shadbolt is on a distinguished road
Re: Motor Encoder code. LabVIEW

Hey guys I had a quick question, where do we hook up the Potentiometers? I'm begining to branch out and learn some electronics to help some freshmen but the example vi on lv didn't help much.
  #11   Spotlight this post!  
Unread 05-02-2011, 10:01
Mark McLeod's Avatar
Mark McLeod Mark McLeod is offline
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,906
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: Motor Encoder code. LabVIEW

They are analog inputs, so use the Analog Breakout.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle
  #12   Spotlight this post!  
Unread 05-02-2011, 10:15
Dustin Shadbolt's Avatar
Dustin Shadbolt Dustin Shadbolt is offline
In a server room somewhere...
AKA: Dustin Shadbolt
FRC #1555 (Team PULSE)
Team Role: Alumni
 
Join Date: Jan 2010
Rookie Year: 2010
Location: Monticello,Indiana
Posts: 320
Dustin Shadbolt is on a distinguished road
Re: Motor Encoder code. LabVIEW

Thanks Mark!
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:51.

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