|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
Re: !HELP! IM STUCK IN A SUBROUTINE!!! !HELP!
After running it in my head (which may not be accurate), I think time is the problem. You're incrementing time, so that after 49, it reaches 50, but at it, you do not define what it does with it (ie Left() or Stop(), etc), so it will keep repeating left.
Daisy Last edited by Daisy : 02-11-2006 at 10:29. Reason: grammar |
|
#2
|
||||
|
||||
|
Re: !HELP! IM STUCK IN A SUBROUTINE!!! !HELP!
Quote:
I agree with what was said above. Most likely the time variable isn't global or statically defined. Debug prints should make this apparent rather quickly if this is the case. |
|
#3
|
||||
|
||||
|
Re: !HELP! IM STUCK IN A SUBROUTINE!!! !HELP!
Time is not the problem, that part works great. All i need to know is did i code the subroutines wrong or am i calling them wrong? If im doing those right then why is the code stuck in Left() when i run the robot in autonomous mode?
|
|
#4
|
|||||
|
|||||
|
Re: !HELP! IM STUCK IN A SUBROUTINE!!! !HELP!
Post a zip of your user_routines_fast.c here and we'll tell you.
Right now it looks like you're taking something for granted when you post the problem and not bothering to tell us about some seemingly unimportant detail. In programming all details are important. If you weren't overlooking something your code would be working. As with most bugs you don't know what the important detail is yet.Last edited by Mark McLeod : 02-11-2006 at 15:46. |
|
#5
|
|||||
|
|||||
|
Re: !HELP! IM STUCK IN A SUBROUTINE!!! !HELP!
Quote:
Speaking of "the loop", what is causing it to run 26 times per second? We definitely need to see more of the code in order to help you. |
|
#6
|
||||
|
||||
|
Re: !HELP! IM STUCK IN A SUBROUTINE!!! !HELP!
ok its now 5pm and Im awake
ok 50% chance your resetting time to be = to 0 every time you loop. 30% chance that that loop isnt happening every 26 secs(I know it says "im fast I run every 26.1 secs" but its a liar liar pants on fire) 20% chance its something else |
|
#7
|
||||
|
||||
|
Re: !HELP! IM STUCK IN A SUBROUTINE!!! !HELP!
I know it works because it works in all the other modes, just not the one with the subroutines, we have a dip switch to choose autonomous modes. but here are the user_routines_fast.c and user_routines.h files (attached)
|
|
#8
|
|||||
|
|||||
|
Re: !HELP! IM STUCK IN A SUBROUTINE!!! !HELP!
Code:
if (rc_dig_in11 = 1) /* 1st Autonomy code */ The code you posted will always run the BASH routine. You need to change all those single = to double == in your if and else if statements. |
|
#9
|
||||
|
||||
|
Re: !HELP! IM STUCK IN A SUBROUTINE!!! !HELP!
Quote:
As a note to any one else who ever needs help the more code you post the better we can help, don't worry about people stealing it, it wont work on our robots anyway. James |
|
#10
|
||||
|
||||
|
Re: !HELP! IM STUCK IN A SUBROUTINE!!! !HELP!
I agree with Alan and James that a problem exists in the use of the assignment operator, but the initial problem stated that the code was stuck in Left. I don't see how this could be reached. How was it determined that it was getting stuck in Left?
|
|
#11
|
||||
|
||||
|
Re: !HELP! IM STUCK IN A SUBROUTINE!!! !HELP!
i had a student telling me what directions the wheels were turning and i took his word for it instead of double checking, but thank you all for the help
|
|
#12
|
||||
|
||||
|
Re: !HELP! IM STUCK IN A SUBROUTINE!!! !HELP!
I still think we need to see the rest of the code, or at least how the time variable is defined. If it isn't defined static, the variable will be re-initialized everytime its host entity is restarted. So if it's at the top of your function, and this function runs over and over every loop, it will be reinitialized every loop to 0, no matter how much you increment it. Or, time can be a global and it will retain its value, but if you're assigning 0 to it every loop that will also ruin your day. I think you have a pretty simple (and somewhat hard to notice) problem that I'm unfortunately very familiar with, as Mark McLeod can tell you, how many times did I hit Chris with the robot again?
![]() |
|
#13
|
||||
|
||||
|
Re: !HELP! IM STUCK IN A SUBROUTINE!!! !HELP!
the .c file is attached above, but i know for a fact thats not the problem because ive defined "time" and incrimented it the same way for 3 years now and i have had no problem with that at all.
|
|
#14
|
||||
|
||||
|
Re: !HELP! IM STUCK IN A SUBROUTINE!!! !HELP!
Quote:
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| RC Controller Stuck | bhk88 | Programming | 1 | 31-01-2006 17:46 |
| Stuck on Camera Mount | busterblade16 | Programming | 2 | 14-02-2005 22:07 |
| stuck in programming mode | Shu Song | Control System | 2 | 29-04-2004 16:44 |
| help! Am really stuck!!!! | pagemauck | Programming | 8 | 29-01-2004 12:38 |
| guy stuck in toilet! | robot180 | Chit-Chat | 8 | 14-11-2003 22:27 |