FOLLOWING the target using labview

Hello all!
I am the new programmer for Team 1592 “The Bionic Tigers”. I have been given the task of providing the brains for the robot this year. So far I have gotten the axis camera to search for and track both pink and green (both combinations). The trouble that I am having right now is that I cannot figure out how to get the robot to drive to the target. I have thought it out logically and come to the conclusion that I should use the servo positions combined with the gyro to correct position of the robot. My problem right now is that I don’t know how to create an If/Then statement in labview. For example: If x <90 drive right and if x >90 drive left. You get what I’m saying. This is the only thing hindering my progress. If somebody could do me a favor and send me a sample vi for following the target, that would be much appreciated. After that, I can make it shoot in autonomous.

P.S. This is my first year, so go easy on me.

You can certainly do that, but as you mentioned, LV doesn’t have an if/else, so it will look a bit different.

The easiest way to configure this is to wire the number to a case – The LV case switches on Booleans, integers, enumerations, and even strings. So you can wire up the number, and then specify which numbers map to which case diagram. For your usage, you’d click on the text on top of the case, and type in …90 for one, then switch to the other and set to default or 91… or some combination.

Greg McKaskle

Labview has a multitude of comparison VI’s which will compare 2 values and and provide a Boolean T/F depending on if x>y, x<y etc. See comparison template.

Thank you for your help. I still haven’t been able to successfully follow the target, but I’m still getting ideas. I have figured out how to write a global variable to use between the x axis of the camera in basic robot main vi and autonomous. I have also now decided that having a set number such as 90 degrees would be too specific for the bot and I should create a window for it to accept. I have put “In Range and Coerce” vi’s into my autonomous case structure. What I would like to know now is how to get it to turn until it is in the correct “window”. I could use a for loop, but that would require me to set a number of repetitions for the loop. What is the quickest way to correct my position? any sample vi’s would be of GREAT assistance, saying as I am a visual learner.

Use the Select function from the boolean pallete in the block diagram.

If the gyro/camera axis is in the range you specfied as “the correct window”, the “in range?” value will send a “true” value. You could send that the the select function. The Select function outputs the “false” input (talking about some kind of integer,double,cluster,array…) or “true” input. That is determend by the boolean value sent to the center input of the Select function(you’ll se it’s boolean).

Let’s assume that we’re controlling the right motor. The left motor is always “1”. If you’re in range, you’ll get a “true” and the select function will output, let’s say, the value of “1” to the right motor, so the robot will move straight.
If you’re not in range, you’ll ge a “false” and the select function will output “-1” which will spin the robot right on it’s own center axis.

If it’s not clear, I’ll give you a visual example.

Ok so in my copy of LabView, the Select vi was under comparison. Is this even the right vi? if so, I have wire the center boolean node to the “in range?” node of the in range vi. The output of this select vi yields a numeric value.
http://i67.photobucket.com/albums/h296/sailorsether/viscreenshot.jpg I have purposely left the two tank drive constants at 0 because I am not yet sure which direction it will need to turn in that case.

That will work, but it isn’t really necessary to take a Boolean, convert to a number containing two values, then switch on the number.

One way to clean it up is to wire the Boolean to the switch.

Greg McKaskle

Something else that labview has are the PID vi’s, which will get your robot from point a to point b much more quickly and accurately than the bang-bang control method than you are currently using

How do I find these PID vi’s?