Thread: Autonomous Help
View Single Post
  #14   Spotlight this post!  
Unread 10-03-2004, 20:30
NotQuiteFree's Avatar
NotQuiteFree NotQuiteFree is offline
Do the WAAAAVE!!
#0957 (Watson)
Team Role: Programmer
 
Join Date: Dec 2003
Location: Albany, Oregon
Posts: 22
NotQuiteFree will become famous soon enough
Send a message via MSN to NotQuiteFree
Re: Autonomous Help

Woah...That is some interesting code . One of my suggestions, just to make things easier, would be to place those sensor readings in variables, and name them things like line_sensor_center, or whatever. That way, you, and anyone else looking at your code can read it easier. Another thing that someone else said was something about switch statements and nested-ifs. Personally, I think the switch would be easier to use. Do you know how to code that? If not, there is a great website for C: (http://www.cplusplus.com/)

Well, actually, it is for C++, but the concepts discussed in the lessons is applicable in both languages. Also, something you should look into is maybe forming some extra functions at the bottom of "user_routines_fast.c". The way we did it was to create seperate functions for turning left, turning right, going straight, and recorrecting . Whenever we would go off the line and hit the right sensor, we would "veer right" until the center sensor would read the line, then tell it to "recorrect" and adjust it's angle back to its initial value. That takes some thought to sort through, but it seems to work for us. If you would like to see an example of that code, I would be happy to provide it for you. Good luck at competition.

--Nick.


error C2143: syntax error : missing ';' before '}'

^^^---Single most common programming error in ANY language---^^^
__________________
Yo.