Log in

View Full Version : Autonomous problem.


Code\\Pilot
09-02-2004, 19:41
Guys, I wanna know if is me or the original code that has a problem.
I tried this dead reckoning code con the user_routines part of the code and it work sooo good, the robot even did the cha-cha(no, not really, it was more like mambo). Anyway, I copied the code and pasted it in the user_routine_fast, build it, download it, it was fine, then came the time to test it.
I turn on the robot, turn on the OI, then plug a paper clip on the competition port for activating the autonomous, the autonomous light flashed blinking yellow telling me that the autonomous is on, but betty(that's how i call my bot) did not run :ahh: :ahh: . The controller showed no problem :confused: , it said it was fine, but it did not run, it was like if i had no code in there.

So I said, i will go and ask for the help form the incredible wise people :D in the chief delphi forum.
So please help me :) .
I been stuck with like for ever :( .
Thanks.

Code\\monkey.

Code\\Pilot
09-02-2004, 20:44
please somebody answer, i am gonna cry...

Code\\monkey.

Rickertsen2
09-02-2004, 20:52
What is the status of the program light on the RC? Also could you post the code? that might help a bit

ShadowKnight
09-02-2004, 20:57
aye, if we could see the code you tried running, that would be great. It is possible that you pasted the autonomous code into the wrong section of user_routine_fast.c

Ryan M.
10-02-2004, 08:59
Just as a suggestion, I don't know if you've tried resetting the controller or not, but that sometimes helps.

Post your code and maybe we can help. :)

Jeff_Rice
10-02-2004, 09:50
Your code might be missing the Generate_Pwms function, see this post:
http://www.chiefdelphi.com/forums/showpost.php?p=219286&postcount=2

I believe almost everyone using pwms 13-16 have had this problem. This post has the best example of what you need to do. They just call the default routine here, but just insert your code in between the get and put. Add in the Generate_Pwms function if you are missing it.

Code\\Pilot
10-02-2004, 17:57
Sorry, i forgot to paste the code. Here it is:

int count = 0;
short end_program = 0; /* will keep program from looping */

void User_Autonomous_Code(void)
{

while (autonomous_mode) /* DO NOT CHANGE! */
{
if (statusflag.NEW_SPI_DATA) /* 26.2ms loop area */
{
Getdata(&rxdata); /* DO NOT DELETE, or you will be stuck here forever! */
if (count < 100)
{
pwm14 = 2000;
pwm16 = 2000; /* supose to go forward while count <100*/
count++;
}



Putdata(&txdata); /* DO NOT DELETE, or you will get no PWM outputs! */
}
}
}


this is found in user_routines_fast, under the function name User_Autonomous_Code.

The LED on the RC says autonomous is activated (blinking yellow) when I initiate the mode on the OI.
So, basically what happens is that the autonomous initiate, but is like not reading the code i wrote.

Thanks.

deltacoder1020
10-02-2004, 18:18
first of all, the pwm values should only range from 0 (full reverse) to 254 (full forward)

second, if you are using pwms 13-16, you'll need to include the call to Generate_Pwms in the while(autonomous_mode) loop.

Code\\Pilot
10-02-2004, 19:40
Thank you, thank you, thank you.
I just figured it out.
It was the stupidiest thing there could be.
ADVICE : when you can't think clearly enough, take a break and double check.

I found out that the pwm cables were in pwm13 and pwm15, and i was using 14 an 16.
Isnt that dumb????? well, the good thing is that I have autonomous running and i am so happy.

Thanks guys for the help, i found some tips very useful. :D :) ;)
ok bye.

Code\\monkey