Go to Post While [a college FIRST competition] would be pretty fun, I think that you'll see this build season that mentoring is a heck of a lot of fun too. (except when the kids pretend to cut their fingers off to see your reaction) - Beth Sweet [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 24-02-2016, 13:43
RoboPirate RoboPirate is offline
Registered User
FRC #1584
 
Join Date: Jan 2013
Location: Nederland, CO
Posts: 2
RoboPirate is an unknown quantity at this point
GRIP, Network Tables, and mutual exclusion

I've been trying to determine the cause of occasional crashes of our robot code. We are using GRIP running on the RoboRIO and access the network tables in our robot code.

I can't find any method in NetworkTable to ensure that we get a coherent set of information from the camera. We access multiple sub-tables in our target processing (width, height, X, and Y centers). However, there doesn't seem to be any guarantee that each table we fetch is referring to the same image. There is no mutual exclusion for the table so, in theory, GRIP could be updating the table at about the same time we are accessing it, giving us a set of sub-tables that don't go together.

Do the task priorities in RTLinux guarantee that this won't happen or is there some mutex mechanism I haven't found?
Reply With Quote
  #2   Spotlight this post!  
Unread 24-02-2016, 16:35
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, Network Tables, and mutual exclusion

NetworkTables guarantees individual reads and writes are atomic, so you should be good there.

It's possible that GRIP is writing, for example, the area array and the centerX array, and one in a while you happen to read both of them after only one has updated. In this case, the arrays could have different lengths, so you could get an error if you use the same loop counter for them.

The solution right now would be to check that the arrays have the same length, although in the future it would be good to support NetworkTables RPCs.

If you're only reading a single snapshot, you can also set "GRIP/run" to false and wait a little bit before reading anything.
__________________
GRIP (Graphically Represented Image Processing) - rapidly develop computer vision algorithms for FRC
Reply With Quote
Reply


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 10:01.

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