07-20-2015 12:19 PM
I am building a personal Project that the traction system is my problem...
The main idea is: I set the desired distance, it moves till there, than it moves back at the same point where it have started (no need to be precisly at the same point.. some inches far or before doesnt matter) and get stopped
The problem is: if I set for example 100 feet, it travel to 100 feet, when it gets 100 feet it changes the digital output that control the relay ( arduino 5v relay board) to make it moves backward, but when it get any number smaller tham 100 feet, it changes again and try to travel to 100 feet than it try to go reverse, kind of redundance.
I am using Ni myRio and a quadrature encoder with A and B channel and 360 pulses per revolution
I have attached a VI that runs like on the software but I have set a knob that works like a encoder
Solved! Go to Solution.
07-21-2015 11:37 AM - edited 07-21-2015 11:41 AM
I'm not sure exactly what part you're asking for help with. Are you having trouble with the logic for the booleans? I see that shows Forward until you get above 500, then shows true Reverse, but then switches back to Forward once you go below 500 again. I think you want to have a changing target once it reaches it's destination because currently the target location is always 500 (or whatever you put for the input).
You need to add a little more information to the logic, so that it doesn't try to go back the way it just came. This can be done by changing the target from 500 once it reaches its destination. Like this:
Cheers
--------, Unofficial Forum Rules and Guidelines ,--------
'--- >The shortest distance between two nodes is a straight wire> ---'
07-21-2015 01:30 PM - edited 07-21-2015 01:32 PM
Hello Mr Morris
Yesterday after some tests I got the solution for my problem.
The problem got solved after I add some local variable to the VI. attached is the idea of the software
Thank you for the attention
Acacio
07-21-2015 01:39 PM - edited 07-21-2015 01:40 PM
1. Instead of using a local variable, you should use a Shift Register. They are faster, use less memory, and avoid race conditions.
2. One of your case structures should be replaced with a Select function. It makes the code a little easier to read.
3. Multiply by 1 does nothing. You can remove that.
4. You can right-click on the knob and select Visible Items->Digital Display. This will eliminate the need for the "Numeric Indicator".
07-21-2015 01:42 PM
Hello Mr Morris
I got the solution as I describid on the VI attached
Thank you so much
07-21-2015 01:48 PM - edited 07-21-2015 01:48 PM
@acacio wrote:
Hello Mr Morris
I got the solution as I describid on the VI attached
Thank you so much
Uh huh... really, you should use the code crossrulz or I gave. Crossrulz's code is nice because it is the same as your new code, but it uses a boolean shift register and is simplified.
Cheers
--------, Unofficial Forum Rules and Guidelines ,--------
'--- >The shortest distance between two nodes is a straight wire> ---'
07-21-2015 01:58 PM
Oh yes I will, more simple and clean.
I am just adding to the entire VI I have of my drone. It was the last issue of my system.
Anyway, thank you so much by the help
07-21-2015 01:59 PM
Thank you so much, have a great week.