|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
Auto won't run
Can anyone tell me why my code won't work?
When I enable the robot, the motors output like they are supposed to for a half second, then seems to hang. The probes stop updating and the motors stop running. Can anyone tell me why this is? ![]() |
|
#2
|
||||
|
||||
|
Re: Auto won't run
Update: This is not specific to this auto mode, this is happening in all my auto modes.
![]() |
|
#3
|
||||
|
||||
|
Re: Auto won't run
Update: I dropped a bit of sample code in the auto mode selector, and it worked perfectly, so it must be an issue with my code
![]() |
|
#4
|
|||||
|
|||||
|
Re: Auto won't run
Your drive motors are being commanded only once. Things will work better if you add a While around the drive code, with a Wait of 10 or 20 ms to keep the loop from eating up all the CPU time.
The Gyro Get Angle will have to be duplicated inside the loop for the 90 degree turn. (You can't communicate time-varying values into or out of a loop; they take their inputs once when the loop first begins, and produce an output once the loop finally finishes.) |
|
#5
|
|||
|
|||
|
Re: Auto won't run
The motor stopping is probably the safety config kicking in. I am guessing you enabled it in begin. You could either turn it off for auto, or make the the calls less than 100 ms apart.
|
|
#6
|
|||
|
|||
|
Re: Auto won't run
If you message me I will give you the code that we use for Auto. I think you will find that it is very straight forward and easy to use.
|
|
#7
|
||||
|
||||
|
Re: Auto won't run
Quote:
I have another problem, if its not a bother: ![]() After the pistons clamp, it doesn't move to the next part of the flat sequence structure. Can anyone spot the problem? I've been looking at it for the past hour. |
|
#8
|
|||||
|
|||||
|
Re: Auto won't run
Quote:
(I suggest that you move the frame labels from above the flat sequence to actually inside the frames they are labeling. That way they will stay connected to the code they are describing if you ever rearrange things.) |
|
#9
|
|||
|
|||
|
Re: Auto won't run
Here is the example code. Let me know if you have any questions.
|
|
#10
|
|||
|
|||
|
Re: Auto won't run
How do I attach a zip file?
|
|
#11
|
|||
|
|||
|
Re: Auto won't run
Another try at it.
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|