Go to Post I, for one, refused to be railroaded down this train of thought so easily! Geeze, one lousy game hint just builds up steam for any old picture to come through and go two pages in a matter of hours. - Billfred [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Spotlight this post!  
Unread 03-08-2015, 17: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,006
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: Help an old dog w/ new tricks

I'm not a programmer, but I can offer some advice. Let's start with the encoders:

RPM doesn't help much, but the number of "counts" does. If you determine, empirically if necessary, the number of inches that, say, 1,000 counts equals, you can measure distance. If for example 1,000 counts equals 75 inches, then each count is 0.75 (3/4) inch. If you want to go xx feet, just run the motors until you're 'close' to xx feet, then slow down more and more until you stop at xx feet (which is nn,nnn counts). The key here: Make sure that you are counting consistently. If you are not, nothing gets done until you are counting consistently. This becomes a mechanical or sensor thing.

Now the Gyro: You can turn 90 degrees, that's HUGE. The 'staying on track after" is not a trivial problem, but the basic idea is to set the direction after the turn (that means, read the gyro and make that youer "set point" or "goal"). Then track your direction and, if the path deviates from the goal, make corrections.
The key to this is tracking the deviation in a reasonable way. A difference of 0.01 degree would be impossible, from a mechanical view, to correct. So you average a reading every 1/4 second and, if after 8 readings the average is more than, say, 2 degrees to one side, you go to a subroutine that tweaks the power to the other side by reducing it slightly. Now, 'tweaks slightly' can be related to the number of degrees error: Bigger tweak for 5 degrees, smaller tweak for 2 degrees, huge tweak for 15 degrees.
Just don't do this too fast: a change every 1/2 to 2 seconds is on the order of magnitude for what you want.

Many years ago I posted a few posts on PID; if you find them they'll explain in a more logical way the concepts of error, corrections, and how often you apply corrections.

But doing all this in theory is not going to teach you what you need: get the robot, and focus on ONE thing at a time. Get that thing nailed flat and fully understood - fool with it to see what happens - and write down what you learned (your memory will not suffice. The faintest ink is superior to the strongest memory). Then move to the next thing.

And keep asking us here.
__________________

I am N2IRZ - What's your callsign?
Reply With Quote
 


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 11:59.

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