Go to Post If you always do what you’ve always done, you’ll always get what you’ve always gotten. - rourke [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

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 07-04-2004, 22:40
wun's Avatar
wun wun is offline
Registered User
AKA: David Wolever
#0865 (Warp7)
Team Role: Programmer
 
Join Date: Dec 2003
Rookie Year: 2001
Location: Toronto
Posts: 84
wun will become famous soon enough
Send a message via AIM to wun Send a message via MSN to wun
Tweaking constants: any good way?

This year I was told that we would need some code to ramp up the speed, so if the driver jams the sticks forward or backward, the robot wont flip (as we are really top heavy). The actual code was easy, but what made it take forever was the tweaking.
Every time I would want to make a change, I would have to first change the #define statement, compile the code, then download the code.
Am I just ignorant, and there is an easy way to tweak constants in the code without having to compile/download it each time? (I know you cant change values of #define statements with out re-compiling... but you know what I mean).
The best thing I could think of was change the #define statements to variables, then assigning a button to increase/decrease them, but I never got around to coding it.
__________________
Help Microsoft stop piracy. Use Linux!

I have three gmail invitations, message me if you want one
  #2   Spotlight this post!  
Unread 07-04-2004, 22:44
10intheCrunch's Avatar
10intheCrunch 10intheCrunch is offline
Who's John V-Neun?
AKA: Alex Baxter
None #0254 (Cheesy Poofs)
Team Role: College Student
 
Join Date: Feb 2004
Rookie Year: 2004
Location: San Jose, CA
Posts: 129
10intheCrunch is a jewel in the rough10intheCrunch is a jewel in the rough10intheCrunch is a jewel in the rough10intheCrunch is a jewel in the rough
Send a message via AIM to 10intheCrunch
Re: Tweaking constants: any good way?

That's pretty much all you can do. For more flexibility, maybe, you could use a steady analog input like the joystick wheel, or use buttons to switch between different constants that you want to test. Compile + download isn't *that* long, even if you have a bad computer. I would recommend, though, if you do have a slow comp, that you put the numbers into variables in the .c file instead of define's in the .h file, as changing a .h makes the MPLab recompile everything (otherwise f10 just recompiles files you have changed).
__________________
~Alex Baxter
Programming, Arms operation, Team 254
  #3   Spotlight this post!  
Unread 07-04-2004, 22:46
Bduggan04's Avatar
Bduggan04 Bduggan04 is offline
I bent my wookie...
AKA: Bryan Duggan
#0027 (Team Rush)
Team Role: College Student
 
Join Date: Mar 2002
Location: Clarkston, MI
Posts: 290
Bduggan04 will become famous soon enoughBduggan04 will become famous soon enough
Re: Tweaking constants: any good way?

If you have one of the old joysticks, use one of the analog wheels as an input for the constant. You can adjust it so that its domain is less than 255. Use a dashboard to view the value of that wheel and change it permanently in the code. We use this to determine the position of our servos and pots for servo emulation.
  #4   Spotlight this post!  
Unread 07-04-2004, 22:51
wun's Avatar
wun wun is offline
Registered User
AKA: David Wolever
#0865 (Warp7)
Team Role: Programmer
 
Join Date: Dec 2003
Rookie Year: 2001
Location: Toronto
Posts: 84
wun will become famous soon enough
Send a message via AIM to wun Send a message via MSN to wun
Re: Tweaking constants: any good way?

Quote:
Originally Posted by 10intheCrunch
I would recommend, though, if you do have a slow comp, that you put the numbers into variables in the .c file instead of define's in the .h file, as changing a .h makes the MPLab recompile everything (otherwise f10 just recompiles files you have changed).
I am on a slow computer, but im also using gnu make with a custom makefile, so it never compiles more than it needs to.
I think I will get one of the grade 9ns who I am teaching to program to write something that uses the wheel...
__________________
Help Microsoft stop piracy. Use Linux!

I have three gmail invitations, message me if you want one
  #5   Spotlight this post!  
Unread 07-04-2004, 22:53
10intheCrunch's Avatar
10intheCrunch 10intheCrunch is offline
Who's John V-Neun?
AKA: Alex Baxter
None #0254 (Cheesy Poofs)
Team Role: College Student
 
Join Date: Feb 2004
Rookie Year: 2004
Location: San Jose, CA
Posts: 129
10intheCrunch is a jewel in the rough10intheCrunch is a jewel in the rough10intheCrunch is a jewel in the rough10intheCrunch is a jewel in the rough
Send a message via AIM to 10intheCrunch
Re: Tweaking constants: any good way?

Would be pretty easy to do, just divide the wheel value by something decently large, or enough parts to test as many constants as you want, and run a switch statement on that number (or just plug it in to your variable) for testing. Use the program port + console window or the dashboard port for output.
__________________
~Alex Baxter
Programming, Arms operation, Team 254
  #6   Spotlight this post!  
Unread 08-04-2004, 10:44
Dave Scheck's Avatar
Dave Scheck Dave Scheck is offline
Registered User
FRC #0111 (WildStang)
Team Role: Engineer
 
Join Date: Feb 2003
Rookie Year: 2002
Location: Arlington Heights, IL
Posts: 574
Dave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond repute
Re: Tweaking constants: any good way?

If you have two spare buttons (or two buttons that aren't needed to drive), map them so that one increments your parameter and the other decrements it. You could send that value to the OI through the user bytes so that you know what value you're using.

Be careful to put upper and lower bounds on the parameter so that you don't go from a value of 0 to 255 when decremented.
Closed Thread


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
Why letting FIRST know your opinions is a good idea archiver 2001 5 24-06-2002 04:13
A good way to meet new teams? archiver 2001 5 24-06-2002 02:52
ChiefDelphi on Good Morning America archiver 2001 1 24-06-2002 02:36
IT to be revealed on Good Morning America Joe Ross Dean Kamen's Inventions 50 13-12-2001 09:53
New site looks good Dave... CD Forum Support 8 07-08-2001 16:35


All times are GMT -5. The time now is 21:19.

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