Go to Post Vex has helped to shape me into what I am today. - thefro526 [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 02-11-2006, 09:00
KenWittlief KenWittlief is offline
.
no team
Team Role: Engineer
 
Join Date: Mar 2003
Location: Rochester, NY
Posts: 4,213
KenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond repute
Re: !HELP! IM STUCK IN A SUBROUTINE!!! !HELP!

printf is your best debug friend

computers have a nasty habit of doing exactly what you tell them to do

instead of what you want them to do

whenever a program is not doing what you expected, printf the variables to see whats going on inside the SW

in fact, you should get in the habit of checking SW modules this way, to make sure it is doing exactly what you thought it would do (module level testing). Then if its working correctly take the debug (printf...) statements out, or have a debug variable that you set to 0 to disable them.
  #2   Spotlight this post!  
Unread 02-11-2006, 09:42
JamesBrown JamesBrown is offline
Back after 4 years off
FRC #5279
Team Role: Engineer
 
Join Date: Nov 2004
Rookie Year: 2005
Location: Lynchburg VA
Posts: 1,260
JamesBrown has a reputation beyond reputeJamesBrown has a reputation beyond reputeJamesBrown has a reputation beyond reputeJamesBrown has a reputation beyond reputeJamesBrown has a reputation beyond reputeJamesBrown has a reputation beyond reputeJamesBrown has a reputation beyond reputeJamesBrown has a reputation beyond reputeJamesBrown has a reputation beyond reputeJamesBrown has a reputation beyond reputeJamesBrown has a reputation beyond repute
Re: !HELP! IM STUCK IN A SUBROUTINE!!! !HELP!

Assuming he didn't change the comment at the beginning of the code (which I am guessing he didn't because other wise the line numbers don't do much good) then he initialized time in the right place.

The only problem I could see there is if you just declared time and didn't initialize it. Assuming you initialized it as 0 I don't see that as being your problem. I am not sure if it is enough to cause the problem you have but at the very least it is sloppy to return a value through the function if you aren't assigning it to anything.

If you still can't figure out the problem, post all of your user_routine_fast.c and we can probably help more.

James
__________________
I'm Back


5279 (2015-Present)
3594 (2011)
3280 (2010)
1665 (2009)
1350 (2008-2009)
1493 (2007-2008)
1568 (2005-2007)
  #3   Spotlight this post!  
Unread 02-11-2006, 10:27
Daisy Daisy is offline
Registered User
AKA: my real name
FRC #0173 (RAGE)
Team Role: Alumni
 
Join Date: Apr 2006
Rookie Year: 2006
Location: Connecticut
Posts: 207
Daisy has a brilliant futureDaisy has a brilliant futureDaisy has a brilliant futureDaisy has a brilliant futureDaisy has a brilliant futureDaisy has a brilliant futureDaisy has a brilliant futureDaisy has a brilliant futureDaisy has a brilliant futureDaisy has a brilliant futureDaisy has a brilliant future
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
  #4   Spotlight this post!  
Unread 02-11-2006, 10:34
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: !HELP! IM STUCK IN A SUBROUTINE!!! !HELP!

Quote:
Originally Posted by Daisy
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
Yeah, but time gets incremented outside of the if statements. Unless he is clearing the PWM values somewhere, whatever was set in Left will still be sent to the motors for an additional cycle. If he is clearing the values, there would be a 1 cycle pause in the PWM output.

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.
  #5   Spotlight this post!  
Unread 02-11-2006, 15:11
cdennisxlx2's Avatar
cdennisxlx2 cdennisxlx2 is offline
Team San Diego Web Liaison
AKA: Cameron Dennis
FRC #1266 (The Devil Duckies)
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2005
Location: San Diego
Posts: 188
cdennisxlx2 is a splendid one to beholdcdennisxlx2 is a splendid one to beholdcdennisxlx2 is a splendid one to beholdcdennisxlx2 is a splendid one to beholdcdennisxlx2 is a splendid one to beholdcdennisxlx2 is a splendid one to beholdcdennisxlx2 is a splendid one to behold
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?
__________________
Team San Diego Robotics Web Liaison
Webmaster and Technical Advisor for the San Diego Regional Planning Committee.
Official Score Keeper for the San Diego Regional
www.sandiegoregional.com
www.frc1266.com
  #6   Spotlight this post!  
Unread 02-11-2006, 15:18
Mark McLeod's Avatar
Mark McLeod Mark McLeod is online now
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,684
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
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.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle

Last edited by Mark McLeod : 02-11-2006 at 15:46.
  #7   Spotlight this post!  
Unread 02-11-2006, 15:55
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,112
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: !HELP! IM STUCK IN A SUBROUTINE!!! !HELP!

Quote:
Originally Posted by ghhs_1527
Time is not the problem, that part works great.
How do you know that? My first guess is that you're "initializing" the time variable every time through the loop, so it is always equal to zero when you hit the if statement.

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.
  #8   Spotlight this post!  
Unread 02-11-2006, 17:50
Stuart's Avatar
Stuart Stuart is offline
#include coffee.h
FRC #1745 (P51- Mustangs)
Team Role: Mentor
 
Join Date: Jan 2006
Rookie Year: 2004
Location: Dallas, TX
Posts: 413
Stuart has a reputation beyond reputeStuart has a reputation beyond reputeStuart has a reputation beyond reputeStuart has a reputation beyond reputeStuart has a reputation beyond reputeStuart has a reputation beyond reputeStuart has a reputation beyond reputeStuart has a reputation beyond reputeStuart has a reputation beyond reputeStuart has a reputation beyond reputeStuart has a reputation beyond repute
Send a message via AIM to Stuart
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
__________________
Proud mentor of Team #1745 the P-51 Mustangs

If at first it doesn't work, use a hammer.
If that doesn't work, use a bigger hammer.
  #9   Spotlight this post!  
Unread 02-11-2006, 19:08
cdennisxlx2's Avatar
cdennisxlx2 cdennisxlx2 is offline
Team San Diego Web Liaison
AKA: Cameron Dennis
FRC #1266 (The Devil Duckies)
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2005
Location: San Diego
Posts: 188
cdennisxlx2 is a splendid one to beholdcdennisxlx2 is a splendid one to beholdcdennisxlx2 is a splendid one to beholdcdennisxlx2 is a splendid one to beholdcdennisxlx2 is a splendid one to beholdcdennisxlx2 is a splendid one to beholdcdennisxlx2 is a splendid one to behold
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)
Attached Files
File Type: c user_routines_fast.c (9.7 KB, 126 views)
File Type: h user_routines.h (3.2 KB, 98 views)
__________________
Team San Diego Robotics Web Liaison
Webmaster and Technical Advisor for the San Diego Regional Planning Committee.
Official Score Keeper for the San Diego Regional
www.sandiegoregional.com
www.frc1266.com
  #10   Spotlight this post!  
Unread 02-11-2006, 21:27
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,112
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: !HELP! IM STUCK IN A SUBROUTINE!!! !HELP!

Code:
	if (rc_dig_in11 = 1) /* 1st Autonomy code */
There's your problem right there. You just tried to assign the value 1 to the variable rc_dig_in11. To test for equality, you must use the == symbol, with two equal signs.

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.
  #11   Spotlight this post!  
Unread 02-11-2006, 22:43
JamesBrown JamesBrown is offline
Back after 4 years off
FRC #5279
Team Role: Engineer
 
Join Date: Nov 2004
Rookie Year: 2005
Location: Lynchburg VA
Posts: 1,260
JamesBrown has a reputation beyond reputeJamesBrown has a reputation beyond reputeJamesBrown has a reputation beyond reputeJamesBrown has a reputation beyond reputeJamesBrown has a reputation beyond reputeJamesBrown has a reputation beyond reputeJamesBrown has a reputation beyond reputeJamesBrown has a reputation beyond reputeJamesBrown has a reputation beyond reputeJamesBrown has a reputation beyond reputeJamesBrown has a reputation beyond repute
Re: !HELP! IM STUCK IN A SUBROUTINE!!! !HELP!

Quote:
Originally Posted by Alan Anderson
Code:
	if (rc_dig_in11 = 1) /* 1st Autonomy code */
There's your problem right there. You just tried to assign the value 1 to the variable rc_dig_in11. To test for equality, you must use the == symbol, with two equal signs.

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.
Yep, that would be it.

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
__________________
I'm Back


5279 (2015-Present)
3594 (2011)
3280 (2010)
1665 (2009)
1350 (2008-2009)
1493 (2007-2008)
1568 (2005-2007)
  #12   Spotlight this post!  
Unread 02-11-2006, 23:06
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: !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?
  #13   Spotlight this post!  
Unread 03-11-2006, 02:25
cdennisxlx2's Avatar
cdennisxlx2 cdennisxlx2 is offline
Team San Diego Web Liaison
AKA: Cameron Dennis
FRC #1266 (The Devil Duckies)
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2005
Location: San Diego
Posts: 188
cdennisxlx2 is a splendid one to beholdcdennisxlx2 is a splendid one to beholdcdennisxlx2 is a splendid one to beholdcdennisxlx2 is a splendid one to beholdcdennisxlx2 is a splendid one to beholdcdennisxlx2 is a splendid one to beholdcdennisxlx2 is a splendid one to behold
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
__________________
Team San Diego Robotics Web Liaison
Webmaster and Technical Advisor for the San Diego Regional Planning Committee.
Official Score Keeper for the San Diego Regional
www.sandiegoregional.com
www.frc1266.com
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
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


All times are GMT -5. The time now is 13:11.

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