View Single Post
  #26   Spotlight this post!  
Unread 27-11-2015, 23:33
Skyehawk's Avatar
Skyehawk Skyehawk is online now
Nuts N' Bolts
AKA: Skye Leake
FRC #0876 (Thunder Robotics)
Team Role: Mentor
 
Join Date: Nov 2012
Rookie Year: 2011
Location: Northwood, ND
Posts: 203
Skyehawk is a name known to allSkyehawk is a name known to allSkyehawk is a name known to allSkyehawk is a name known to allSkyehawk is a name known to allSkyehawk is a name known to all
Re: Driving Straight

Here is a comparison based "drive straight" code example that doesn't use PIDs. It is handy for demonstrations, programming practice, etc. where you need to be able to follow along without getting wrapped up in more advanced functions (such as PIDs) useful, like it was said before, if the user hasn't taken basic calculus. Works like a charm, it may be a little sparsely commented, but just PM me if you have any questions.

FYI: Top encoder is left side, bottom is right side. This code makes the robot REVERSE at 50% speed. (I just pulled it out of one of our autonomous routines).

The .06125 constant is "inches traveled/encoder tick" (you will need to update this to accommodate for your drive train reduction between the encoder shaft and the wheels).
The 85 constant is the desired distance in inches.

You can import this vi code snippet into Labview.

Cheers,
Skye
Attached Thumbnails
Click image for larger version

Name:	Auto_Straight_Line_reverse_encoder.png
Views:	31
Size:	31.7 KB
ID:	19507  
__________________
My time in FIRST has made me a better person, frankly I don't know where I'd be without it.



2011 Lake Superior Regional Champs
2015 Central Illinois Regional Engineering Inspiration Award recipients
2016 Central Illinois Regional Champs
Reply With Quote