![]() |
Help Autonomous code not working
Quote:
any help or suggestions is greatly appriciated |
Re: Help Autonomous code not working
1: You say it doesn't work, but that isn't enough information. Tell us what you expect it to do, and tell us what it's doing instead.
2: Put code between [ code ] and [ /code ] tags when you post it here. It will preserve the formatting. 3: Don't use delay loops the way it looks like you're trying to. If you take too long before calling the Putdata() function, the master CPU assumes your code is hung and signals a code error. You'll need to figure out how to execute the complete while (autonomous_mode) loop without pausing in the middle. |
Re: Help Autonomous code not working
we are trying to make the bot go forward constantly but have the ir have control over the autonomus code
|
Re: Help Autonomous code not working
I'm a little confused, or possibly you are. All of your cases in your big switch statement there are appropriately written to let the robot framework do your looping and timing.... Except the very first case, FORWARD. You have a do-while loop there that will process in about 1ms and then kick you straight into the right turn. If you change this first case from using a fruitless do-while to the proper if(delay == 0) structure of all your other cases, I think your code might work. At the very least the FORWARD case would work.
|
Re: Help Autonomous code not working
you cant do the delay like that it would delay the 26 ms. loop time which in turn would cause a code error on the robot. i figured that out in the summer. the only way you could pull off a delay is by adding a global vaiable that counts the number of iterations of the while loop in the autonomous code.
1. declare a variable at the top 2. put a (variable)++ in the loop 3. use the variable as a counter for your delay. |
Re: Help Autonomous code not working
i thank you we moved the initial if statement above the while and that fixed the code
|
| All times are GMT -5. The time now is 09:59. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi