getting distance from camera

the title explains it all. how would you use the reflective tape to find the distance from the camera to it

If you unbundle the target info global variable, you will see that one of the variables calculated is distance

Hi,

Our team is having trouble integrating the target info into our main teleop.vi. We tried copying the Rectangular Processing example vi into our main project (the vi that only runs on the computer) and then placing it in our main code. However, whenever I try to run the code with this vi placed anywhere in it, the code doesn’t work. I tried removing the vi and the code worked normally. Has anybody figured out the best way to actually use the target info?

There is a tutorial, available on the launch screen that walks you through the basics of the Rectangle example.

There are actually two different implementations, one targets the laptop, and one targets the cRIO. The cRIO one already has some amount of Robot Main and a Vision Processing.vi that incorporates the rectangle processing. As the tutorial explains, you open the vision processing and do a Save As and include dependencies to save it to your robot project. This will overwrite the Vision Processing VI and the Robot Globals, which should be what you want, but if you have added your own globals, you need to merge them.

Greg McKaskle

Wow, can’t believe I didn’t see that tutorial a long time ago. Thank you very much! I had copied our current project from another computer, and it turns out I was having some path issues, but once I got those sorted out it worked fine!

Also, I apologize for hi-jacking this thread…

where is target info global?

the target info global is written to in the Vision Processing VI and defined in the Robot Global VI. By default, no code in your project is reading it. You should copy/paste the global node or drag it from the project and select the right variable.

Greg McKaskle

If you have followed the instructions for integrating the rectangular vision target code into your project, the Target info global variable should be with all the other global variables, in the Robot Global Data vi.

ummmmm…is the global variable supposed to be there?

If by “the global variable” you mean “Target info” and if by “there” you mean “in Robot Global Data.vi”, then yes. If you mean something else, please ask again with more specific words.

its not there. There is only enable vision, image size, and LED Toggle Rate.

Did you follow the instructions for adding the rectangular target processing code to your robot project? Doing that properly will replace the robot globals vi file with one that has the target info included.

can you post a link of where to find that tutorial?

It’s Tutorial 8—Integrating Vision into Robot Code. Find it, and all the other LabVIEW Getting Started Tutorials, on the Tutorials tab in LabVIEW.

is there anywhere else i can find it, my computer is stupid and won’t update the labview home screen with the frc update

You really do have to install the LabVIEW update. If you haven’t done that, you’re missing much more than the tutorials. You’re also not in compliance with the rules.

What does “won’t update the LabVIEW home screen” mean? What happens when you try to run the update?

i install that, and everything gets installed, but the start screen for labview doesn’t change.

What all does the unchanged start screen say? Does it have the “LabVIEW FRC 2012” text at the top and the FIRST logo at the bottom?

You might need to reinstall LabVIEW. I’m wondering if it got loaded properly in the first place. How did you install it?

i installed it from the flash drive. all of the wpi robotics vis are in there, but the home screen doesn’t change.

when you click on one of the tutorials, is it a webpage, a pdf, what is it?