Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   GRIP - Vision Processing (http://www.chiefdelphi.com/forums/showthread.php?t=141283)

tomy 09-01-2016 23:59

GRIP - Vision Processing
 
I was just messing around with GRIP and it is a very powerful tool. Does anyone know how to use the data it outputs. I've never messed with the networks table at all which is where it seems to output the data. Any help would be awesome!

Fauge7 10-01-2016 10:56

Re: GRIP - Vision Processing
 
What language? i have messed around with network tables, specifically for vision actually...They are pretty simple to use...essentially if your robot is deciding if it should do ____ based on a value from a table it would look similar to this

Code:

table visiontable = NetworkTable.getTable("vision")
boolean shouldFire = visiontable.getvalue()
//rest of code

so while grip is powerful, its still in development...

RufflesRidge 10-01-2016 11:01

Re: GRIP - Vision Processing
 
Quote:

Originally Posted by tomy (Post 1519794)
I was just messing around with GRIP and it is a very powerful tool. Does anyone know how to use the data it outputs. I've never messed with the networks table at all which is where it seems to output the data. Any help would be awesome!

The GRIP manual on Screensteps has an article for that:
http://wpilib.screenstepslive.com/s/...-networktables

tomy 10-01-2016 14:41

Re: GRIP - Vision Processing
 
Ok so that's how you access the data from grip but what can you do with that information?

Also would you have to have grip running on your computer with the driver station?

Fauge7 10-01-2016 14:51

Re: GRIP - Vision Processing
 
Since its java, it can be run anywhere! thats the beauty of it! It can run on your driverstaion, the rio or even a coprocessor, such an an odroid c1 (way better then raspi)

tomy 10-01-2016 15:00

Re: GRIP - Vision Processing
 
So I could take an ip camera from the robot and input that data into GRIP then output the data to the robot? If I had it running with the driver station. Also how do I use the information back

ThomasClark 12-01-2016 21:51

Re: GRIP - Vision Processing
 
Quote:

Originally Posted by tomy (Post 1520263)
Also how do I use the information back

The C++ example on this page shows how to print the area and x/y coordinates of each target.

Assuming you're able to get this far, exactly how you use this data depends on your robot and your strategy. For example, if you're trying to like the robot up horizontally with the biggest target, you might do something like this. (This is a really oversimplified example, but hopefully it serves as a good starting point)

PHP Code:

const double CENTER_X 320.0;
const 
double TOLERANCE_X 20.0;

void AutoShoot() {
    while (
true) {
        
auto areas grip->GetNumberArray("myContoursReport/area"llvm::ArrayRef<double>()),
             
xs    grip->GetNumberArray("myContoursReport/x",    llvm::ArrayRef<double>());

        
// Pick whatever target has the biggest area
        
double targetArea = -1.0targetX 0.0;
        for (
int i 0areas.size(); i++) {
            if (
areas[i] > targetArea) {
                
targetArea areas[i];
                
targetX xs[i];
            }
        }
        
        
// If we didn't find a target, return control to the operator
        
if (targetArea 0.0) {
            return;
        }

        
// If we're too far to the left to shoot, move right.  If we're too far
        // to the right, move left.  If we're spot on, shoot and return.
        
if (targetX CENTER_X TOLERANCE_X) {
            
MoveRobotRight();
        } else if (
targetX CENTER_X TOLERANCE_X) {
            
MoveRobotLeft();
        } else {
            
ShootBoulder();
            return;
        }
    }



hewittalec 14-01-2016 21:02

Re: GRIP - Vision Processing
 
Hello. Just started using GRIP. Is it possible to run grip from my drivers station PC by getting the robot USB camera feed? If so how do I send the Network Table data back to the roboRio for my program?

Thanks


All times are GMT -5. The time now is 02:57.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi