![]() |
Code for Encoder isn't working
3 Attachment(s)
I need help programming the encoders. I provided some pictures of my code and I am hoping you can solve the problem. I am not really going to explain it that much because you already are going to understand it. But, code.jpg the VI called speed controller encoder contains the code fromthe picture below which I couldn't fit in an attachment. The Michael Fadaie PID VI is just like the PID loop you find under the VI that are already made for you. But, it was condenced. Also, I am opening two encoders in the begin VI for the right and left motors.
If you have any questions feel free you ask. Thanks. ![]() |
Re: Code for Encoder isn't working
While we can probably understand your code, it will take us a long time if we have to try to figure out what's going wrong. Let us know what it's doing wrong/what it's not doing and we'll be able to help you better and more expediently. :)
One thing I've noticed initially, though, is that in the code pasted into your post, the wires going between the loops probably won't do what you want, as values will only be propagated along them once, after the source (top) loop finishes. This also means that the bottom loop won't run until the top loop has been stopped, but then since the value wired to the stop terminal on the bottom loop will already be true, the bottom loop will only run once. --Ryan |
Re: Code for Encoder isn't working
The wire means that the bottom loop will not begin until the top loop is stopped.
Greg McKaskle |
Re: Code for Encoder isn't working
Well, when I start it all it says is watchdog not fed
|
Re: Code for Encoder isn't working
Quote:
--Ryan |
Re: Code for Encoder isn't working
Do I need to open two encoders in the begin VI because the open encoder VI has channel A and Channel B.
|
Re: Code for Encoder isn't working
Where do you think the watchdog is being fed? And there is no indication as to where the code you attached is from. If you are in teleop and the teleop doesn't feed the watchdog or doesn't feed often enough, you get the watchdog going off.
Greg McKaskle |
Re: Code for Encoder isn't working
Does any one have a sample of code that makes the encoders work and change the motor speed a contant. I know you have to use a PID loop.
|
Re: Code for Encoder isn't working
Quote:
~ |
Re: Code for Encoder isn't working
If that pair of while loops is the "Speed Control Encoder" SubVI, and you're using it in Teleop.vi, you will get a Watchdog error. The first loop never finishes, so the SubVI never returns a result, so anything that depends on it will not run. The code effectively halts at that point, doing nothing but reading the encoders.
Without a description of what you expect from the code I can't be sure, but I think if you just take out the While loops everything should work much better. |
| All times are GMT -5. The time now is 11:12. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi