Quote:
Originally Posted by bvisness
It could be a motor safety problem, since you're only commanding the tank drive output once, and then entering your two loops. You should probably put the tank drive at 0.5 block inside the loop to avoid that problem.
Besides that, your code looks quite good! I'm not sure what your problem would be.
|
It might be the problem, I'll report as soon as I try to fix it agian. Thx.
Quote:
Originally Posted by propionate
A few potential problems I see with the overall structure:
1. Your "Wheel Distance" VI's are both inside of a while loop. They will be constantly updating, so the drive motors will never actually reach their goal of 50cm.
2. There is no wait timer in the while loop. You may want to add one to avoid any potential cRIO lag issues.
3. You are writing to the drive motors in 3 separate places that I can see. This is generally not a good idea, as LabVIEW gets confused pretty quick if multiple VI's are giving commands to the same motor.
Number 3 is what is most likely causing the problem. Here is some code that should do what you want:
http://i.imgur.com/R1Ukf8Y.png
Instead of your custom VI, I just created a case structure as a placeholder. It works on the same principle as yours, except there is no need to add the 50cm and then subtract off. Simply reset the encoders using the "Reset Encoder" global variable *before* you enter the while loop/first case, and that way you can be sure they will start at 0. It advances to the next case if both encoders have reached 50cm.
|
1. I checked it, and the comparison is performed on the value before the loop + 50 and the current value so it can reach it (I moved the robot manually and it worked).
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 !!
