Go to Post ...from my experience, it is really fun to play defense really well. - Andy Baker [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

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #8   Spotlight this post!  
Unread 08-03-2004, 22:40
mtrawls's Avatar
mtrawls mtrawls is offline
I am JVN! (John von Neumann)
#0122 (NASA Knights)
Team Role: Programmer
 
Join Date: Mar 2003
Location: Hampton, VA
Posts: 295
mtrawls is a splendid one to beholdmtrawls is a splendid one to beholdmtrawls is a splendid one to beholdmtrawls is a splendid one to beholdmtrawls is a splendid one to beholdmtrawls is a splendid one to beholdmtrawls is a splendid one to behold
Send a message via AIM to mtrawls
Re: Do you write functions for your code?

I reallly appreciate the new ability of C to give us not only real functions, but multiple files. I took full advantage of it. (Granted, during the "heat" of a coding session while working on the robot, the code often digressed into horrible slurs of barely legible mush ... I *did* clean it up a bit so others could understand it though )

An example you say? Well, we have an arm that picks up the 2x multiplier, but it tends to backdrive badly, making it difficult to control with the joystick. So, we put in some "antibackdrive" code to stop this, which I put in functions ... including a function to move the arm to a given setpoint (it has a pot on it), which proved useful for the auto ball-knock-down routine.

Oh, and as for the many files I had: obviously, a custom_defs file for all of the many constants a robot always seems to need (much quicker access than scrolling through pages of pbasic code!); and, something that proved particularly useful at vcu, a file named cond_comp.h. That is, conditional compilation. Everything in it is just commented out (shock!) -- there're just a bunch of tests to do in the pit; e.g., test acceptance angle of IR sensors/make sure they haven't broken (funny little things like to do that), we have a "harpoon" whose chain tends to break if we come in too hard, so power is limited in the code when it is too close (another pot on it) ... but when pot is removed and we redo limits, there's a test that debugs the pot values, removes the limit code and sets a low speed setting for the motor ... etc. You can imagine that this saves a lot of time having it all thought out ahead of time, just commenting/uncommenting and testing away. I know there's a thread saying just the opposite ... but I love C!
 


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

Similar Threads
Thread Thread Starter Forum Replies Last Post
What is your most prefered programming language? Hailfire Programming 156 19-01-2005 21:42
Interrupt timer, executing code asap? SeanCassidy Programming 10 07-03-2004 01:47
Inserting Naviagation code into Default code? actorindp Programming 3 28-01-2004 18:12
RC bootup sequence Venkatesh Programming 17 18-11-2003 20:56
Does your team use the Default code. Jeff McCune General Forum 2 09-01-2003 14:46


All times are GMT -5. The time now is 06:05.

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