Finding angles using potentiometers

Hello,

I’m new to Labview, so be easy on me and my programming hack job. Thanks already for all of your previous posts, they have been helpful.

I’m using 2 - 10 turn potentiometers with slope of 1.33mV/degree to find the angles of two joints on our robot. I’m able to acquire the voltage and move the arms fine, but I would like to have preset heights that correspond to certain buttons.

A couple weeks ago I put together some code and verified that it worked. It compared the voltage and turned the motor a direction whether it was greater than or less than the desired voltage. After I got further along I converted buttons on the controller to an array, then array to number, and finally to a case. There I wanted to put different voltages in there for the different positions.

I then migrated all of the arm code to periodic tasks because I read that it is the preferred location for the robot tasks.

As of now, if I press a button to go to a location it will move in that direction, but pass it up. I might add that I implemented the voltage averaging of 5 bits, which seems to give a rather steady voltage. I’ve tried two different >, <, etc (case 1 & 2) sequences with no avail.

I then tried a PID.vi which seemed promising, but once again passed the desired location.

I probe the voltage in the vi and watch as the arm passes by the location, so theres definitely a valid voltage position being passed.

I assume that the case will repeat constantly until the button is released correct? Since its in periodic tasks does it reset every 1ms? Should this be done outside a timed structure?

Any help would be greatly appreciated. Thank you.

Periodic Tasks.vi (58.8 KB)


Periodic Tasks.vi (58.8 KB)