So I’m having trouble with my autonomous code. It does everything correct and then it finishes before the whole code is ran through. Like it doesn’t follow the code to the end. Also another problem is that sometimes when I start autonomous, it’s a whole different autonomous but if I run it through completely then my normal autonomous will proceed after I turn it back onto driver then autonomous.
this is a stupid question but does your auton fit within the 15 seconds? That may be why it stops.
I thought the same thing but it wasn’t that. Give or take, The autonomous is 10 seconds long.
I don’t use text but could it be the “vex::task::sleep(500);”?
I don’t think so because when I was testing everything out, it still follows even with the sleep task in between almost every line of code
What does the sleep task do anyways?
It just stops the robot for how many milliseconds you tell it to. We use it as a way to reset it.
Is there any way to convert that to vex blocks?
Our school don’t want us to use vexblocks. They think it’s too easy and they are right.
That is true but I am basically a solo and I am not good at coding but I understand the blocks. What part of the aton does it stop at?
It stops at the last task sleep and does nothing afterwards.
Try just having it “Wait” instead of sleep.
I don’t know how to code a wait in V5 text
This is also my first year of coding
Please post your full code to either the forums or a third party service like github or pastebin. We can not properly help you if we don’t have access to the full problem.
If it stops at the last sleep method, then I would try commenting out the sleep statement and seeing what happens.
Also a sleep statement is just a more technical word for a wait statement. They are the same thing.
to code a wait, use wait(500, msec) ;
Like @PortalStorm4000 said we need access to your full code.
One thing to look for is that you use non-block functions when you want to accomplish something in parallel, but you need either a subsequent blocking function or a while loop that tests if the operation(s) have completed before continuing.
see
https://help.vexcodingstudio.com/#cpp/namespacevex/classvex_1_1motor/rotateTo
and
here
https://help.vexcodingstudio.com/#cpp/namespacevex/classvex_1_1motor/startRotateFor
So like I’m typing on a phone and not my actual laptop so… anyway the autonomous does different autonomous’s and I don’t know why. It does different stuff every time. One time, one side of the wheels just stop moving at the wrong time and then the next the arm goes way up than coded to. Pls help
Check this post by JP.
Also make sure you are not just hitting a different program when starting the aton.
It stops the previous task and prepares for the next one