Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Placement of Navigate () (http://www.chiefdelphi.com/forums/showthread.php?t=24066)

Ian W. 18-01-2004 23:50

Placement of Navigate ()
 
Ok, I'm not sure if this is my sleep-deprivation (yes, already), or I actually picked something up, but I can't make sense of this.

In user_routines_fast.c, Navigate() is called from Process_Data_From_Local_IO. Navigate however, needs to output it's data somewhere, and from my understanding, you need to excute putdata(&txdata) to output data, but I can't find a putdata(&txdata) after Navigate() is called.

So, does this mean I'm blind and unable to see lines of code, or that it's just not put in the right place?

I'd test myself, but I want to make sure before I put the code into the robot that it's not going to kill it.

Kevin Watson 19-01-2004 00:50

Re: Placement of Navigate ()
 
Quote:

Originally Posted by Ian W.
In user_routines_fast.c, Navigate() is called from Process_Data_From_Local_IO. Navigate however, needs to output it's data somewhere, and from my understanding, you need to excute putdata(&txdata) to output data, but I can't find a putdata(&txdata) after Navigate() is called.

The pwmxx variables are global, so they'll be updated the next time putdata() is called in user_routines.c/Process_Data_From_Master_uP().



Quote:

Originally Posted by Ian W.
So, does this mean I'm blind and unable to see lines of code, or that it's just not put in the right place?

Navigate() will need to be called from User_Autonomous_Code() instead of Process_Data_From_Local_IO() if you want to use it during autonomous period. It was placed where it is now so that we could start the demo by pulling the trigger on the joystick.

-Kevin

Adam Shapiro 19-01-2004 00:52

Re: Placement of Navigate ()
 
I haven't worked too much with the new code as of yet as I've been doing electrical systems so far but from my understanding the Process_Data_From_Local_IO() function is called with every program loop. Is there any reason for putting your Navigate() function in this rather than the time-controlled process function?

Second, the Putdata() function is declared in the IFI_default.h file, making it global to all functions in files including this file. The function should be usable within your Navigate() function or any other function you declare.

Ian W. 19-01-2004 01:06

Re: Placement of Navigate ()
 
Quote:

Originally Posted by Adam Shapiro
I haven't worked too much with the new code as of yet as I've been doing electrical systems so far but from my understanding the Process_Data_From_Local_IO() function is called with every program loop. Is there any reason for putting your Navigate() function in this rather than the time-controlled process function?

Second, the Putdata() function is declared in the IFI_default.h file, making it global to all functions in files including this file. The function should be usable within your Navigate() function or any other function you declare.

Yeah, I was aware that you could call Putdata() anywhere, but I saw references to the fact that this code was used in the Kickoff demo, so I figured either I accidentally deleted something, or it did something I didn't understand.

I still don't see any reason for putting Navigate() in the user_routines_fast.c file though.

Ian W. 19-01-2004 01:07

Re: Placement of Navigate ()
 
Quote:

Originally Posted by Kevin Watson
The pwmxx variables are global, so they'll be updated the next time putdata() is called in user_routines.c/Process_Data_From_Master_uP().

Ah, ok, I wasn't sure if the GetData() call would overwrite them at all, as I haven't looked through absolutely everything yet.

Kevin Watson 19-01-2004 01:08

Re: Placement of Navigate ()
 
Quote:

Originally Posted by Adam Shapiro
I haven't worked too much with the new code as of yet as I've been doing electrical systems so far but from my understanding the Process_Data_From_Local_IO() function is called with every program loop. Is there any reason for putting your Navigate() function in this rather than the time-controlled process function?

Yes, to minimize latency between clock (and beacon data) updates and when Navigate() is called.

Quote:

Originally Posted by Adam Shapiro
Second, the Putdata() function is declared in the IFI_default.h file, making it global to all functions in files including this file. The function should be usable within your Navigate() function or any other function you declare.

I suspect sprinkling calls to Putdata() throughout your code is asking for trouble.

-Kevin

Adam Shapiro 19-01-2004 01:13

Re: Placement of Navigate ()
 
Quote:

Originally Posted by Kevin Watson
I suspect sprinkling calls to Putdata() throughout your code is asking for trouble.

Yea, I could see where it might cause some issues :D

Kevin Watson 19-01-2004 01:23

Re: Placement of Navigate ()
 
Quote:

Originally Posted by Ian W.
Ah, ok, I wasn't sure if the GetData() call would overwrite them at all, as I haven't looked through absolutely everything yet.

Getdata() doesn't overwrite the pwmxx variables.

-Kevin

deltacoder1020 19-01-2004 03:24

Re: Placement of Navigate ()
 
Getdata does just that, it gets input data, and putdata puts output data - the output values are never overwritten (except by your code), just processed.

Astronouth7303 19-01-2004 14:16

Re: Placement of Navigate ()
 
Quote:

Originally Posted by Ian W.
Yeah, I was aware that you could call Putdata() anywhere, but I saw references to the fact that this code was used in the Kickoff demo, so I figured either I accidentally deleted something, or it did something I didn't understand.

I still don't see any reason for putting Navigate() in the user_routines_fast.c file though.

Because YOU edit it. the only things you NEED to edit are User_Routines.h, User_Routines.c, and User_Routines_Fast.c

PuiChi 19-01-2004 14:37

Re: Placement of Navigate ()
 
I'm new and know nothing about the IR navigation code. So where would you edit the navigation code? =o___O;;=

Adam Shapiro 19-01-2004 19:50

Re: Placement of Navigate ()
 
Quote:

Originally Posted by PuiChi
I'm new and know nothing about the IR navigation code. So where would you edit the navigation code?

That depends on what you want to do with it. Most likely you want to use it during the autonomous mode, in which case I believe it would go in the User_Routines_Fast.c in the User_Autonomous_Code() function (although you could create your own functions/names and move thing around).

Teh Kaj 20-01-2004 18:41

Re: Placement of Navigate ()
 
How would you point out in the area to the nav code in that area? I get that's the place you would edit, but how would add it in? Would you simply make a duplicate copy of the code in that area?


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

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi