Go to Post Add a little more grease if you aren't sure exactly how much you need. - MrForbes [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 18-02-2007, 18:12
3dude_2231's Avatar
3dude_2231 3dude_2231 is offline
no one messes with a Thingy =|
AKA: Menscher,Ran Menscher =]
FRC #2231 (Onyxtronix)
Team Role: Leadership
 
Join Date: Feb 2007
Rookie Year: 2007
Location: Shoham, Israel
Posts: 233
3dude_2231 is a jewel in the rough3dude_2231 is a jewel in the rough3dude_2231 is a jewel in the rough
Send a message via MSN to 3dude_2231
changing main.c

Hi,
am I allowed to change main.c
so that when autonomous mode is on,
Process_Data_From_Master_uP won't execute?

I have things in my default_routine that shouldn't work during autonomous,
and I'm not sure whether the DISABLE function will disable them or not.

thanks,
Ran.
__________________
Redefining the word "Rookie". (for 2 years now..)


Israeli Off Season Games: WINNERS!
check out this cool project I'm into..

  #2   Spotlight this post!  
Unread 18-02-2007, 18:56
Shinigami2057 Shinigami2057 is offline
Slackware Is Your New God (Mentor)
AKA: Harry Bock
FRC #1350 (Rambots)
Team Role: Programmer
 
Join Date: Oct 2006
Rookie Year: 2006
Location: Johnston, RI
Posts: 106
Shinigami2057 is just really niceShinigami2057 is just really niceShinigami2057 is just really niceShinigami2057 is just really niceShinigami2057 is just really nice
Re: changing main.c

If you are in autonomous mode, Process_Data_From_Master_uP will never be called. User_Autonomous_Code() has its own fast/slow loops separate from Process_Data_xxx. If you don't want it to be called BEFORE it goes into autonomous code, you can move it after the if(autonomous_mode) check, or check for it at the beginning of Process_Data_xxx and return otherwise.
__________________
One of the main causes of the fall of the Roman Empire was that, lacking zero, they had no way to indicate successful termination of their C programs.
  #3   Spotlight this post!  
Unread 18-02-2007, 19:46
EHaskins EHaskins is offline
Needs to change his user title.
AKA: Eric Haskins
no team (CARD #6 (SCOE))
Team Role: College Student
 
Join Date: Jan 2006
Rookie Year: 2006
Location: Elkhorn, WI USA
Posts: 998
EHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond repute
Send a message via MSN to EHaskins
Re: changing main.c

Quote:
Originally Posted by Shinigami2057 View Post
If you are in autonomous mode, Process_Data_From_Master_uP will never be called. User_Autonomous_Code() has its own fast/slow loops separate from Process_Data_xxx. If you don't want it to be called BEFORE it goes into autonomous code, you can move it after the if(autonomous_mode) check, or check for it at the beginning of Process_Data_xxx and return otherwise.
Process_Data_From_Master_uP will be called while your robot is sitting disabled before a match. If you don't want to have it run before operator control you will need to setup a global variable that gets set to 1 once autonomous starts, and check the state of that variable before you run any code that can't run.
__________________
Eric Haskins KC9JVH
  #4   Spotlight this post!  
Unread 18-02-2007, 21:15
Astronouth7303's Avatar
Astronouth7303 Astronouth7303 is offline
Why did I come back?
AKA: Jamie Bliss
FRC #4967 (That ONE Team)
Team Role: Mentor
 
Join Date: Jan 2004
Rookie Year: 2004
Location: Grand Rapids, MI
Posts: 2,071
Astronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud of
Re: changing main.c

Quote:
Originally Posted by 3dude_2231 View Post
Hi,
am I allowed to change main.c
so that when autonomous mode is on,
Process_Data_From_Master_uP won't execute?
IMHO, if they don't want us to change it, they wouldn't give us the source. All the exciting stuff is on the master processor anyway.
  #5   Spotlight this post!  
Unread 18-02-2007, 23:48
Hieb Hieb is offline
Registered User
no team
Team Role: Teacher
 
Join Date: Mar 2004
Rookie Year: 2004
Location: St. Louis, MO
Posts: 125
Hieb is a splendid one to beholdHieb is a splendid one to beholdHieb is a splendid one to beholdHieb is a splendid one to beholdHieb is a splendid one to beholdHieb is a splendid one to beholdHieb is a splendid one to behold
Re: changing main.c

I'm not sure if you can change it. It's been a couple of years since I've even tried, but several of the files (those that say "Do Not Change" or something like that) used to be locked so you couldn't change them.
  #6   Spotlight this post!  
Unread 19-02-2007, 00:24
tdlrali tdlrali is offline
Registered User
FRC #0469 (Las Guerrillas)
Team Role: Programmer
 
Join Date: Sep 2006
Rookie Year: 2006
Location: MI
Posts: 377
tdlrali has much to be proud oftdlrali has much to be proud oftdlrali has much to be proud oftdlrali has much to be proud oftdlrali has much to be proud oftdlrali has much to be proud oftdlrali has much to be proud oftdlrali has much to be proud of
Re: changing main.c

Go ahead and change them. There is nothing wrong/illegal about that.
Just make sure you know what you are doing!

Quote:
I'm not sure if you can change it. It's been a couple of years since I've even tried, but several of the files (those that say "Do Not Change" or something like that) used to be locked so you couldn't change them
Who cares what the comments say
And if they are locked, just take out the write protection (right click in explorer)
  #7   Spotlight this post!  
Unread 19-02-2007, 07:05
3dude_2231's Avatar
3dude_2231 3dude_2231 is offline
no one messes with a Thingy =|
AKA: Menscher,Ran Menscher =]
FRC #2231 (Onyxtronix)
Team Role: Leadership
 
Join Date: Feb 2007
Rookie Year: 2007
Location: Shoham, Israel
Posts: 233
3dude_2231 is a jewel in the rough3dude_2231 is a jewel in the rough3dude_2231 is a jewel in the rough
Send a message via MSN to 3dude_2231
Re: changing main.c

OK, but is it right to add
if(!autonomous_mode) just before Process_Data_From_Master_uP()?
__________________
Redefining the word "Rookie". (for 2 years now..)


Israeli Off Season Games: WINNERS!
check out this cool project I'm into..

  #8   Spotlight this post!  
Unread 19-02-2007, 09:37
tdlrali tdlrali is offline
Registered User
FRC #0469 (Las Guerrillas)
Team Role: Programmer
 
Join Date: Sep 2006
Rookie Year: 2006
Location: MI
Posts: 377
tdlrali has much to be proud oftdlrali has much to be proud oftdlrali has much to be proud oftdlrali has much to be proud oftdlrali has much to be proud oftdlrali has much to be proud oftdlrali has much to be proud oftdlrali has much to be proud of
Re: changing main.c

If you do not want Process_Data_From_Master_uP() running while in auton, then, yes, the following would do it.

Code:
if (!autonomous_mode)

      {

        Process_Data_From_Master_uP();

      }
  #9   Spotlight this post!  
Unread 19-02-2007, 12:42
3dude_2231's Avatar
3dude_2231 3dude_2231 is offline
no one messes with a Thingy =|
AKA: Menscher,Ran Menscher =]
FRC #2231 (Onyxtronix)
Team Role: Leadership
 
Join Date: Feb 2007
Rookie Year: 2007
Location: Shoham, Israel
Posts: 233
3dude_2231 is a jewel in the rough3dude_2231 is a jewel in the rough3dude_2231 is a jewel in the rough
Send a message via MSN to 3dude_2231
Re: changing main.c

thanks,
BTW, you don't have to add the "{","}"s when you have only one function.
__________________
Redefining the word "Rookie". (for 2 years now..)


Israeli Off Season Games: WINNERS!
check out this cool project I'm into..

  #10   Spotlight this post!  
Unread 19-02-2007, 13:38
half geek's Avatar
half geek half geek is offline
For an extremely large value of 1/2
AKA: Greg R
None #0294 (Beach Cities Robotics)
Team Role: Student
 
Join Date: Feb 2004
Rookie Year: 2003
Location: Manhattan Beach, CA
Posts: 49
half geek will become famous soon enough
Send a message via AIM to half geek
Re: changing main.c

Correct me if I am wrong, but I think Process_Data_From_Master_uP() will never be called while in autonomous code since User_Autonomous_Code() has its own while loop:

Code:
void User_Autonomous_Code(void)
{
/**autonomous initialization....*/
  while (autonomous_mode)
  {
    /**autonomous routine..*/
  }
}
__________________
73 de W6DXN k

Parse this:
g r e g a ``n o s p a m" r o b i ``a t" d e v ``d o t" j a v a ``d o t" n e t
  #11   Spotlight this post!  
Unread 19-02-2007, 13:59
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,113
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: changing main.c

Quote:
Originally Posted by half geek View Post
Correct me if I am wrong, but I think Process_Data_From_Master_uP() will never be called while in autonomous code...
Consider yourself corrected. Take a look at the main() function in main.c and you'll see that it calls Process_Data_From_Master_uP() just before checking autonomous_mode. So it calls the "slow loop" code continuously before going autonomous, and then calls it one more time after autonomous is enabled and before calling User_Autonomous_Code().

Rather than modifying main() as 3dude_2231 is asking, it might be less traumatic to check for autonomous_mode inside Process_Data_From_Master_uP().
  #12   Spotlight this post!  
Unread 19-02-2007, 14:49
jdejoannis jdejoannis is offline
Registered User
FRC #1845
 
Join Date: Feb 2006
Location: Atlanta,GA
Posts: 48
jdejoannis will become famous soon enoughjdejoannis will become famous soon enough
Re: changing main.c

Quote:
Originally Posted by 3dude_2231 View Post
I have things in my default_routine that shouldn't work during autonomous,
and I'm not sure whether the DISABLE function will disable them or not.
What "things"? Once the autonomous loop is entered, the ordinary "things" (e.g. joystick inputs) in Process_Data_From_Master_uP will be overwritten.

Jason
  #13   Spotlight this post!  
Unread 20-02-2007, 01:26
half geek's Avatar
half geek half geek is offline
For an extremely large value of 1/2
AKA: Greg R
None #0294 (Beach Cities Robotics)
Team Role: Student
 
Join Date: Feb 2004
Rookie Year: 2003
Location: Manhattan Beach, CA
Posts: 49
half geek will become famous soon enough
Send a message via AIM to half geek
Re: changing main.c

Quote:
Originally Posted by Alan Anderson View Post
Consider yourself corrected. ... it calls the "slow loop" code continuously before going autonomous, and then calls it one more time after autonomous is enabled and before calling User_Autonomous_Code().
Thanks, I didn't notice that.

Quote:
Originally Posted by Alan Anderson View Post
Rather than modifying main() as 3dude_2231 is asking, it might be less traumatic to check for autonomous_mode inside Process_Data_From_Master_uP().
That makes sense as an option; but I am not sure why it would be a problem to add an if(!autonomous_mode) in main(). With what might this cause trouble?
__________________
73 de W6DXN k

Parse this:
g r e g a ``n o s p a m" r o b i ``a t" d e v ``d o t" j a v a ``d o t" n e t
  #14   Spotlight this post!  
Unread 21-02-2007, 00:15
Astronouth7303's Avatar
Astronouth7303 Astronouth7303 is offline
Why did I come back?
AKA: Jamie Bliss
FRC #4967 (That ONE Team)
Team Role: Mentor
 
Join Date: Jan 2004
Rookie Year: 2004
Location: Grand Rapids, MI
Posts: 2,071
Astronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud of
Re: changing main.c

There is nothing illegal or wrong with modifying any of the code to suit your needs. The only requirement is that you call IFI's functions as appropriate. You may modify main.c, ifi_utils.c, ifi_startup.c , or any other source file.

Now, your skill level is more likely a hinderence. I would imagine that 99% of the people here wouldn't dare touch ifi_startup.c. (The other 1% is Kevin Watson. ) Why? It involves initializing clib, clearing memory, and a few other low-level things. Half of it is written in inline assembly. I've only perused it a few times, nevermind modifying it.

As for the original question: modify main.c until you turn blue! Just be ready to post a lot of code when it doesn't work.
  #15   Spotlight this post!  
Unread 21-02-2007, 01:11
Kevin Sevcik's Avatar
Kevin Sevcik Kevin Sevcik is offline
(Insert witty comment here)
FRC #0057 (The Leopards)
Team Role: Mentor
 
Join Date: Jun 2001
Rookie Year: 1998
Location: Houston, Texas
Posts: 3,721
Kevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond repute
Send a message via AIM to Kevin Sevcik Send a message via Yahoo to Kevin Sevcik
Re: changing main.c

On the other hand, you can learn a lot by looking through all the files. For instance, ifi_aliases.h tells me that there's a flag called disabled_mode that will tell you if the robot is disabled. Much much easier and safer than setting some random variable after you've been in autonomous mode.

Second, I have a strong suspicion that Process_Data_From_Master_uP MUST be called atleast once. I'm pretty sure the GetData(&rxdata) call is what updates ALL of the information on the processor. Including whether or not you are in autonomous mode. If you don't call it while you're disabled and waiting for autonomous mode, you'll never enter autonomous mode. I believe you can get around these restrictions, but you're going to have to be a lot more clever than anything I've seen in this thread so far. Something on the order of swapping the order of the two calls as suggested above AND setting autonomous_mode=1 in your user initialization and also making sure you stay there while you're waiting for the initial disabled period to end and the actual autonomous mode to begin. Probably plus some other clever things I'm not thinking of at midnight. The point being, if you want to play with these files, you can. But you'll have a lot more fun at it if you actually know what's going on.
__________________
The difficult we do today; the impossible we do tomorrow. Miracles by appointment only.

Lone Star Regional Troubleshooter
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
main.c 6600gt Programming 3 29-08-2006 02:19
Main Battery Cables maclaren Electrical 14 26-07-2006 12:37
Editing Main.c Astronouth7303 Programming 22 20-02-2004 16:45
Main Stage archiver 2001 3 24-06-2002 03:06
main driver Kaitlin Palmer Off-Season Events 0 09-04-2002 21:26


All times are GMT -5. The time now is 00:26.

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