LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Labview segway using PID control and Light intensity sensor ???

Hi guys i have bought and built a Nxt Lego Segway for a college project which uses the light intensity sensor as a way to balance itself through Labview


Bellow is the programme i have so far which beside maybe neading a bit more fine tunning is working with the P & I side of PID

 

I side LV 1.jpg

 

And P side
LV 2.jpg

 

 

So i am finally on the Derivative side now from what i understand  Derivative = ( the current error) – ( the previous error)  But

 

If the current error it s worse than the previous error then the Derivative term should correct the Error, But if the error is better than the previous error the Derivative term should stop the correction of the error as it is getting close to the zero error line (robot balanced) and the point where their should be no error correction.

SO what i am wondering if anyone can help me set this up is their a function on labview which you can set that if a number is less than previous do nothing but if higher (worse error ) allow it to go through ???

 

hopefully what im asking makes sence if not fire away with questions.

 

Thanks in advance

Matt

 

 

 

0 Kudos
Message 1 of 3
(3,923 Views)

Hi Matt-p

 

I think what you are looking for may be along these lines.

 

Greater than.png

 

Essentially, by using the shift register we are always able to reada the previous error back in at the beginning of the loop after filling it from the previous operation. The case structure then allows the comparison functions output to be acted upon.

 

I hope this helps.

 

Cheers

Liam A.
National Instruments
Applications Engineer
0 Kudos
Message 2 of 3
(3,890 Views)

 

 

Hi Liam

 

Thank you for the reply so the above will act in .. if the "latest error" is greater than "previous error" it will allow it to go through to the case structure but if smaller it will not,

 

So do i make my calculation before above is done so, ""current error - previous error = derivative"" , then use above to see if its greater or less than last ""derivative""

 

how do i then send that signal number gotten if its bigger and true out of the case structure up to my formula node marked Ed(derivative error) ???

 

if that makes sense

 

Thanks again

 

Matt

0 Kudos
Message 3 of 3
(3,880 Views)