View Single Post
  #2   Spotlight this post!  
Unread 22-03-2012, 00:51
blackflame2996's Avatar
blackflame2996 blackflame2996 is offline
Alumni
AKA: David Donahue
FRC #2996 (Cougars Gone Wired)
Team Role: Alumni
 
Join Date: Nov 2011
Rookie Year: 2011
Location: Colorado springs, CO
Posts: 67
blackflame2996 is a name known to allblackflame2996 is a name known to allblackflame2996 is a name known to allblackflame2996 is a name known to allblackflame2996 is a name known to allblackflame2996 is a name known to all
Re: Variables, Cameras, and Wait

Quote:
Originally Posted by dfu1234 View Post
So, I like programming in things that are text based. This is my first time using labview. I wouldn't be using it is the vast majority of the team didn't require it. So, I am totally lost in it. No one seems to know how to use a variable. Such a quintessential part of programming, and I can't use it.

Question two. I have the vision processing vi incorporated and (I think) working. What I want to know is how to get the distance data out of it. I tried google. A lot. I failed. Please help.

Question 3: Data lookup table: how could I go about making and using one? This would be for the distance processing as our launcher changes speed based on distance.

Question 4: How would I, for example, make it so that a motor spins a certain way thereby turning a camera and stops when the camera looks at the target "dead on"?

And Question 5: How do I use a "wait" command? I just want to delay a t/f signal all of 1 second. I cannot for the life of me find a wait command that seems like it will do this job.


Thank you in advanced.

Ok, let's start with variables. Go to the data communications palette. drag and drop the Global Variable. double click this to access its contents. on this front panel, drop whatever elements you want; for example, use an LED for a boolean, and a numeric indicator for a number. Now back to the Icon on the block diagram of your code. By default, the variable is set to wright. copy and paste, creating a write block for each element of the variable set. click on the icon to select the element. plug in whatever info here. Now, where you are sending the info, paste the variable, and right click. click "change to read", and select the element. wire the output to whatever needs the info.

now, for the rest of this. There is a real danger of choking the RIO's CPU when running vision on it. we found this problematic, and learned from another team at our first regional how to run image processing on the Driver's station. I would highly recommend offloading vision processing to the DS, so as to free up CPU. here is a sample code that runs the distance and position processing that you need on the driver station. http://dl.dropbox.com/u/42324681/Distance%20Get.zip


We have had a great deal of success with this code. what you do is get the value from the processing, and put it through UDP (I included a UDP example), and write the signal read by the RIO to a variable. Now, I would recommend that instead of sending the distance and processing it, process the distance on the station, and just send motor values to the RIO.

Now, for positioning the camera, I will assume that you have encoders of some sort on the motor that moves the camera. In the included processing, one of the outputs is the position, as an x,y value. you can take this, and again process this into a position shift on the station, and send the position to the RIO. I cannot help with specific values, but unbundle the position into the x and y, and find the appropriate position shift.

If you don't have encoders, have it find which direction the camera is off, and send a (LOW) motor value, and a 0 when it is in the tolerable range. NOTE: the UDP example that i provided will need adjustment if a 0 is supposed to be read. at the moment, there is a feedback node to return the last "good" value if the UDP value is 0, but this will need to be taken out in order to receive a "0".

for any values going through UDP, I would cluster them all, and unbundle them on the RIO to prevent problems with the channel. on the RIO's end, do the UDP receiving in timed tasks, and write all values to global variables.

for question 5, it depends on where in the code this is located. more info would help.

I sincerely hope that this helps.
--David Donahue.
__________________
2009 Regional Winners
2011 Regional Chairman's Award
2012 Regional Winners
2013 Regional Chairman's Award
Reply With Quote