|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
Re: Autonomous code issue :(
Quote:
Quote:
2. How much ms would be the best choice? is 10ms enough? 3. I dont write to the same motor at one time. on the left I give both the same value and on the right the upper controls the left motor and the lower controls the right motor. Is it still might be connected to the problem? And thx for the code I'll try it ! BTW what is the "Reset Encoder" global variable? I know only about the encoder reset vi, is that the same? Thx agian !! ![]() |
|
#2
|
||||
|
||||
|
Re: Autonomous code issue :(
Quote:
1. Good catch - I wasn't considering my own advice about nested loops. 2. I would suggest something like 30 or 40ms. You can go lower, but it will eat up more CPU usage. 3. I think it will still be problematic because each iteration of the larger while loop contains two commands to each set of drive train motors. The Reset Encoder global variable may have been more out of habit. I normally put the encoder code in periodic tasks, and you can use a global variable to reset the encoder from any other VI (in your case, autonomous). Using the Reset Encoder VI and a inputting a constant in autonomous will achieve the same result. |
|
#3
|
|||||
|
|||||
|
Re: Autonomous code issue :(
Your problem is almost certainly the motor safety. A tenth of a second after you enter the inner While loop, the drive motors will shut off because they're not being commanded. Moving the first Tank Drive inside the loop should correct that.
Quote:
If you want to do things the way it looks like you're trying to, then you should have only a single inner While loop instead of the two parallel ones. Inside that loop, set the Left input to Tank Drive to either .5 or 0 depending on whether the left encoder has reached its target. Simultaneously set the Right input to either .5 or 0 depending on whether the right encoder has reached its target. If both encoders are at or above their set point, exit the While loop. |
|
#4
|
||||
|
||||
|
Solved !
Thx to all of you ! I got some great tips here and I finally got this to work..
![]() The saftey config was the main problem, putting the drive command in the loops made it move - but it didn't move smoothly. The second problem which I encountered was that the Crio couldn't handle both of the loops so it gave the right a value, stopped it, gave the other side a value and so on... Finally I made one loop (to rule them all!) simiilar to Stephen's (propionate) idea, thanks alot ! I might be uploading an image of the correct code soon ![]() |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|