Go to Post I'm glad to be on the same team as smart people. - Andy Baker [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 31-01-2016, 17:23
mlyhoops mlyhoops is offline
Registered User
AKA: Matthew Yamamoto
FRC #1197 (TorBots)
Team Role: Alumni
 
Join Date: Dec 2012
Rookie Year: 2012
Location: Torrance
Posts: 16
mlyhoops is an unknown quantity at this point
GRIP Axis Camera feed too slow

Does anyone know how we can get the values from the network table to update faster? Our problem is that our code gets the centerX value from the NetworkTables in GRIP but the values update too slowly (takes about 2 seconds) so we cannot use these values to track the target. Right now we are also using a gyro to get values and know how far we need to turn to the target but it requires us to use another button to get the target value first and then add that to the gyro to be able to find the target. We want to make it as quick as possible and only use one button for finding and tracking the target. If you have any answers or questions about our setup, just email me at mlyhoops@gmail.com
  #2   Spotlight this post!  
Unread 31-01-2016, 17:48
ThomasClark's Avatar
ThomasClark ThomasClark is offline
Registered User
FRC #0237
 
Join Date: Dec 2012
Location: Watertown, CT
Posts: 146
ThomasClark has much to be proud ofThomasClark has much to be proud ofThomasClark has much to be proud ofThomasClark has much to be proud ofThomasClark has much to be proud ofThomasClark has much to be proud ofThomasClark has much to be proud ofThomasClark has much to be proud ofThomasClark has much to be proud ofThomasClark has much to be proud of
Re: GRIP Axis Camera feed too slow

Is it 2 seconds latency, or is it only getting one frame every two seconds?

Also, are you running on the RIO, or another processor?

Quote:
Right now we are also using a gyro to get values and know how far we need to turn to the target but it requires us to use another button to get the target value first and then add that to the gyro to be able to find the target
I think this is actually a good way to track the targets. Using the target positions directly as the input to a feedback loop will result in a lot of overshooting, since reading gyro values has a lot less lag than real-time computer vision. Maybe you can just make the process more automated, so the driver can hit a single button and set the whole thing off?
__________________
GRIP (Graphically Represented Image Processing) - rapidly develop computer vision algorithms for FRC

Last edited by ThomasClark : 31-01-2016 at 18:42.
  #3   Spotlight this post!  
Unread 31-01-2016, 18:36
mlyhoops mlyhoops is offline
Registered User
AKA: Matthew Yamamoto
FRC #1197 (TorBots)
Team Role: Alumni
 
Join Date: Dec 2012
Rookie Year: 2012
Location: Torrance
Posts: 16
mlyhoops is an unknown quantity at this point
Re: GRIP Axis Camera feed too slow

Quote:
Originally Posted by ThomasClark View Post
Is it a seconds second latency, or is it only getting one frame every two seconds?

Also, are you running on the RIO, or another processor?



I think this is actually a good way to track the targets. Using the target positions directly as the input to a feedback loop will result in a lot of overshooting, since reading gyro values has a lot less lag than real-time computer vision. Maybe you can just make the process more automated, so the driver can hit a single button and set the whole thing off?
What is a seconds second latency? It gets anywhere from 13-29 fps.

We are running it on the roboRIO.

How would we adjust for overshooting? We had it working pretty well but it would always end up past the point where we want it and it wouldn't be very accurate.
  #4   Spotlight this post!  
Unread 31-01-2016, 18:47
ThomasClark's Avatar
ThomasClark ThomasClark is offline
Registered User
FRC #0237
 
Join Date: Dec 2012
Location: Watertown, CT
Posts: 146
ThomasClark has much to be proud ofThomasClark has much to be proud ofThomasClark has much to be proud ofThomasClark has much to be proud ofThomasClark has much to be proud ofThomasClark has much to be proud ofThomasClark has much to be proud ofThomasClark has much to be proud ofThomasClark has much to be proud ofThomasClark has much to be proud of
Re: GRIP Axis Camera feed too slow

Quote:
Originally Posted by mlyhoops View Post
What is a seconds second latency?
A typo. If you're getting a decent framerate but some latency, that's normal. It's just that by the time you get images from the camera and process them, they're out of date, although 2 seconds does seem particularly high. Maybe try lowering the resolution.

Quote:
Originally Posted by mlyhoops View Post
How would we adjust for overshooting? We had it working pretty well but it would always end up past the point where we want it and it wouldn't be very accurate.
  1. Stop the robot for two seconds
  2. Read the current position of the target and calculate the change in rotation you need
  3. Use the calculated rotation as the setpoint for a PID loop with the gyro as the input
__________________
GRIP (Graphically Represented Image Processing) - rapidly develop computer vision algorithms for FRC
  #5   Spotlight this post!  
Unread 31-01-2016, 21:16
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,756
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: GRIP Axis Camera feed too slow

Vision processing is not easy. On an FRC field, it is even more not-easy. Realtime vision processing is really not-easy. And real time on an FRC field is downright hard.

GRIP and other tools make it easy to get some initial success and make progress, but be sure to try alternate processing techniques that are better or simpler. Be sure to measure how long your various processing steps take, and determine what they add.

There are also techniques for speeding up network tables. The LV version, and I'm assuming the others, let you set the update rate and flush when time-sensitive updates are made.

So, think about how you can measure and control what is going on, and keep improving it.

Greg McKaskle
  #6   Spotlight this post!  
Unread 31-01-2016, 23:10
mlyhoops mlyhoops is offline
Registered User
AKA: Matthew Yamamoto
FRC #1197 (TorBots)
Team Role: Alumni
 
Join Date: Dec 2012
Rookie Year: 2012
Location: Torrance
Posts: 16
mlyhoops is an unknown quantity at this point
Re: GRIP Axis Camera feed too slow

Thanks!
  #7   Spotlight this post!  
Unread 31-01-2016, 23:13
Fauge7 Fauge7 is offline
Head programmer
FRC #3019 (firebird robotics)
Team Role: Programmer
 
Join Date: Jan 2013
Rookie Year: 2012
Location: Scottsdale
Posts: 195
Fauge7 is a name known to allFauge7 is a name known to allFauge7 is a name known to allFauge7 is a name known to allFauge7 is a name known to allFauge7 is a name known to all
Re: GRIP Axis Camera feed too slow

Also, on the field, any image packet gets a low priority meaning that there is a semi decent lag time from on the field and what you see.
  #8   Spotlight this post!  
Unread 31-01-2016, 23:43
Justin Buist Justin Buist is offline
Registered User
FRC #4003 (TriSonics)
Team Role: Mentor
 
Join Date: Feb 2015
Rookie Year: 2015
Location: Allendale, MI
Posts: 27
Justin Buist is an unknown quantity at this point
Re: GRIP Axis Camera feed too slow

Personally I'm doubting anybody is going to find GRIP useful on the actual robot. Running GRIP on one of our mentor's Core i7 laptop had it hot to the touch and we were just doing an HSV filter and contour finder. On my own at home it was pegging me at 30% usage which is an awful lot for the given task.

When we actually deployed that pipeline to the RoboRIO we saw something like 75% CPU usage just from GRIP and the actual robot code wanted the other 75%. Load average was 3.3ish which on a dual core machine that's not being I/O bound means you're hitting the CPU too hard and starving the robot process. We quickly ditched the idea of GRIP on the robot and went with just hitting OpenCV directly, borrowing from a lot of work done by team 2168. That's working out quite well.

That said there's a purpose to GRIP yet in that it's really easy to experiment with the provided transformations even on a student computer. Familiarity with that makes it easier to muck with OpenCV directly which also runs splendid on a student computer and doesn't require a RoboRIO.
  #9   Spotlight this post!  
Unread 31-01-2016, 23:46
ThomasClark's Avatar
ThomasClark ThomasClark is offline
Registered User
FRC #0237
 
Join Date: Dec 2012
Location: Watertown, CT
Posts: 146
ThomasClark has much to be proud ofThomasClark has much to be proud ofThomasClark has much to be proud ofThomasClark has much to be proud ofThomasClark has much to be proud ofThomasClark has much to be proud ofThomasClark has much to be proud ofThomasClark has much to be proud ofThomasClark has much to be proud ofThomasClark has much to be proud of
Re: GRIP Axis Camera feed too slow

Quote:
Originally Posted by Justin Buist View Post
That said there's a purpose to GRIP yet in that it's really easy to experiment with the provided transformations even on a student computer. Familiarity with that makes it easier to muck with OpenCV directly which also runs splendid on a student computer and doesn't require a RoboRIO.
That's true. Another good use of GRIP is on a dedicated vision coprocessor.
__________________
GRIP (Graphically Represented Image Processing) - rapidly develop computer vision algorithms for FRC
  #10   Spotlight this post!  
Unread 31-01-2016, 23:49
Turing'sEgo Turing'sEgo is offline
Registered User
no team
 
Join Date: Jan 2016
Rookie Year: 2010
Location: Boulder
Posts: 48
Turing'sEgo is on a distinguished road
Re: GRIP Axis Camera feed too slow

Quote:
Originally Posted by Justin Buist View Post
That said there's a purpose to GRIP yet in that it's really easy to experiment with the provided transformations even on a student computer. Familiarity with that makes it easier to muck with OpenCV directly which also runs splendid on a student computer and doesn't require a RoboRIO.
Exactly. Perhaps someone, or rather a group of people, could work on a code generator of sorts for GRIP. I'd help contribute to that, but sadly I do not know where to start with code generation, alas it is not my area of expertise.
  #11   Spotlight this post!  
Unread 01-02-2016, 00:13
ThomasClark's Avatar
ThomasClark ThomasClark is offline
Registered User
FRC #0237
 
Join Date: Dec 2012
Location: Watertown, CT
Posts: 146
ThomasClark has much to be proud ofThomasClark has much to be proud ofThomasClark has much to be proud ofThomasClark has much to be proud ofThomasClark has much to be proud ofThomasClark has much to be proud ofThomasClark has much to be proud ofThomasClark has much to be proud ofThomasClark has much to be proud ofThomasClark has much to be proud of
Re: GRIP Axis Camera feed too slow

Quote:
Originally Posted by Turing'sEgo View Post
Exactly. Perhaps someone, or rather a group of people, could work on a code generator of sorts for GRIP. I'd help contribute to that, but sadly I do not know where to start with code generation, alas it is not my area of expertise.
Sounds like a good idea. Code generation is something we considered a while ago, but we decided to focus on other things because NetworkTables was an easy solution, and code generation would require extra effort for each new language we support. If people are willing to put in that effort, that would be pretty cool.

Maybe check out RobotBuilder and see how it does it. Also, if you need help figuring out GRIP's internal structures, feel free to ask some questions in the gitter
__________________
GRIP (Graphically Represented Image Processing) - rapidly develop computer vision algorithms for FRC
  #12   Spotlight this post!  
Unread 01-02-2016, 08:32
1024Programming 1024Programming is offline
Registered User
FRC #1024
 
Join Date: Jan 2014
Location: Indiana
Posts: 43
1024Programming is an unknown quantity at this point
Re: GRIP Axis Camera feed too slow

Quote:
Originally Posted by mlyhoops View Post
Does anyone know how we can get the values from the network table to update faster? Our problem is that our code gets the centerX value from the NetworkTables in GRIP but the values update too slowly (takes about 2 seconds) so we cannot use these values to track the target. Right now we are also using a gyro to get values and know how far we need to turn to the target but it requires us to use another button to get the target value first and then add that to the gyro to be able to find the target. We want to make it as quick as possible and only use one button for finding and tracking the target. If you have any answers or questions about our setup, just email me at mlyhoops@gmail.com
Can you please post your code that actually gets the values? Our team has been trying to do this and it doesn't matter if it lags.
  #13   Spotlight this post!  
Unread 01-02-2016, 12:26
ThomasClark's Avatar
ThomasClark ThomasClark is offline
Registered User
FRC #0237
 
Join Date: Dec 2012
Location: Watertown, CT
Posts: 146
ThomasClark has much to be proud ofThomasClark has much to be proud ofThomasClark has much to be proud ofThomasClark has much to be proud ofThomasClark has much to be proud ofThomasClark has much to be proud ofThomasClark has much to be proud ofThomasClark has much to be proud ofThomasClark has much to be proud ofThomasClark has much to be proud of
Re: GRIP Axis Camera feed too slow

Quote:
Originally Posted by 1024Programming View Post
Can you please post your code that actually gets the values? Our team has been trying to do this and it doesn't matter if it lags.
https://github.com/WPIRoboticsProjec...C-program#java

tl;dr

PHP Code:
NetworkTable grip NetworkTable.getTable("grip");
double[] centers grip.getNumberArray("targets/centerX", new double[0]); 
__________________
GRIP (Graphically Represented Image Processing) - rapidly develop computer vision algorithms for FRC
  #14   Spotlight this post!  
Unread 01-02-2016, 15:29
marshall's Avatar
marshall marshall is offline
My pants are louder than yours.
FRC #0900 (The Zebracorns)
Team Role: Mentor
 
Join Date: Jan 2012
Rookie Year: 2003
Location: North Carolina
Posts: 1,337
marshall has a reputation beyond reputemarshall has a reputation beyond reputemarshall has a reputation beyond reputemarshall has a reputation beyond reputemarshall has a reputation beyond reputemarshall has a reputation beyond reputemarshall has a reputation beyond reputemarshall has a reputation beyond reputemarshall has a reputation beyond reputemarshall has a reputation beyond reputemarshall has a reputation beyond repute
Re: GRIP Axis Camera feed too slow

Quote:
Originally Posted by Greg McKaskle View Post
Vision processing is not easy. On an FRC field, it is even more not-easy. Realtime vision processing is really not-easy. And real time on an FRC field is downright hard.
QFT.
__________________
"La mejor salsa del mundo es la hambre" - Miguel de Cervantes
"The future is unwritten" - Joe Strummer
"Simplify, then add lightness" - Colin Chapman
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 01:32.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


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