View Single Post
  #1   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