From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

traction control

Solved!
Go to solution

 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

 

0 Kudos
Message 1 of 8
(3,364 Views)

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:

Target Location.png

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 2 of 8
(3,277 Views)
Solution
Accepted by topic author acacio

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

0 Kudos
Message 3 of 8
(3,249 Views)
Solution
Accepted by topic author acacio

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".


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 4 of 8
(3,238 Views)

Hello Mr Morris

I got the solution as I describid on the VI attached

Thank you so much

0 Kudos
Message 5 of 8
(3,230 Views)

@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.

Target Location2.png

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 6 of 8
(3,224 Views)

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

0 Kudos
Message 7 of 8
(3,214 Views)

Thank you so much, have a great week.

0 Kudos
Message 8 of 8
(3,212 Views)