Go to Post If you want to prove your worth, prove it by creation, not destruction. - DanL [more]
Home
Go Back   Chief Delphi > Technical > Programming > Python
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 19-02-2013, 13:18
sparkytwd's Avatar
sparkytwd sparkytwd is offline
Registered User
FRC #3574
Team Role: Mentor
 
Join Date: Feb 2012
Rookie Year: 2012
Location: Seattle
Posts: 96
sparkytwd will become famous soon enough
Pure Python NetworkTables 2 client

For this year, I've been working with Team 3574 on doing vision processing on an embedded ARM board (Odroid U2). As part of that work I implemented a NetworkTables client in Python.

There is some roughness to it, it's not pythonic, it has no support for array types (couldn't create those in either Python or Java), has some weirdness about reading your writes (sometimes you won't, sometimes you will, you could read invalid data), and makes liberal use of sleeps to make sure events happen in sequence rather than explicit checking.

If that hasn't scared you off, the nice things about it are; its dead simple with a single constructor that takes your team number, and just 2 methods, getValue, setValue. Types are enforced through exceptions (so be careful in non test code).

If you use this only to read values, or be the only client updating another value, it should work just fine.

https://github.com/Team3574/2013Visi...c/nt_client.py
Reply With Quote
  #2   Spotlight this post!  
Unread 19-02-2013, 23:59
PaulDavis1968's Avatar
PaulDavis1968 PaulDavis1968 is offline
Embedded Software/Systems Engineer
AKA: Master of Complexity
FRC #2053 (TigerTronics)
Team Role: Mentor
 
Join Date: Jan 2012
Rookie Year: 2012
Location: Endicot NY
Posts: 91
PaulDavis1968 is just really nicePaulDavis1968 is just really nicePaulDavis1968 is just really nicePaulDavis1968 is just really nicePaulDavis1968 is just really nice
Re: Pure Python NetworkTables 2 client

Quote:
Originally Posted by sparkytwd View Post
For this year, I've been working with Team 3574 on doing vision processing on an embedded ARM board (Odroid U2). As part of that work I implemented a NetworkTables client in Python.

There is some roughness to it, it's not pythonic, it has no support for array types (couldn't create those in either Python or Java), has some weirdness about reading your writes (sometimes you won't, sometimes you will, you could read invalid data), and makes liberal use of sleeps to make sure events happen in sequence rather than explicit checking.

If that hasn't scared you off, the nice things about it are; its dead simple with a single constructor that takes your team number, and just 2 methods, getValue, setValue. Types are enforced through exceptions (so be careful in non test code).

If you use this only to read values, or be the only client updating another value, it should work just fine.

https://github.com/Team3574/2013Visi...c/nt_client.py

WOW ... I hope this works. I am using the ODRIOD-U2 as well. Need it for vision. I tried to SIP the c++ network tables per instruction I could not get it to work. I posted in that thread as to why. Thanks for this. Though I do want to get SIP working. If you find any bugs please update! I will let you know if I make any improvements or fix any problems.
Reply With Quote
  #3   Spotlight this post!  
Unread 20-02-2013, 13:20
sparkytwd's Avatar
sparkytwd sparkytwd is offline
Registered User
FRC #3574
Team Role: Mentor
 
Join Date: Feb 2012
Rookie Year: 2012
Location: Seattle
Posts: 96
sparkytwd will become famous soon enough
Re: Pure Python NetworkTables 2 client

Will do. Kids were able to test updating the network tables from their vision processing script running on a laptop.

I've got a kernel compiled for the Odroid U2 with PS3 Eye drivers, if you need that.
Reply With Quote
  #4   Spotlight this post!  
Unread 21-02-2013, 03:37
PaulDavis1968's Avatar
PaulDavis1968 PaulDavis1968 is offline
Embedded Software/Systems Engineer
AKA: Master of Complexity
FRC #2053 (TigerTronics)
Team Role: Mentor
 
Join Date: Jan 2012
Rookie Year: 2012
Location: Endicot NY
Posts: 91
PaulDavis1968 is just really nicePaulDavis1968 is just really nicePaulDavis1968 is just really nicePaulDavis1968 is just really nicePaulDavis1968 is just really nice
Re: Pure Python NetworkTables 2 client

Quote:
Originally Posted by sparkytwd View Post
Will do. Kids were able to test updating the network tables from their vision processing script running on a laptop.

I've got a kernel compiled for the Odroid U2 with PS3 Eye drivers, if you need that.
No thanks I have logitech270 cam running on /dev/04 just fine.
Reply With Quote
  #5   Spotlight this post!  
Unread 21-02-2013, 13:49
sparkytwd's Avatar
sparkytwd sparkytwd is offline
Registered User
FRC #3574
Team Role: Mentor
 
Join Date: Feb 2012
Rookie Year: 2012
Location: Seattle
Posts: 96
sparkytwd will become famous soon enough
Re: Pure Python NetworkTables 2 client

Awesome. The shipped kernel was missing the ov534 drivers, but I was able to compile a new version on the board.

We like the Eye camera as it has custom lens assemblies available, and after an event last year where they had stadium lighting directly behind the vision targets we decided to switch over to infrared.
Reply With Quote
  #6   Spotlight this post!  
Unread 22-02-2013, 00:57
PaulDavis1968's Avatar
PaulDavis1968 PaulDavis1968 is offline
Embedded Software/Systems Engineer
AKA: Master of Complexity
FRC #2053 (TigerTronics)
Team Role: Mentor
 
Join Date: Jan 2012
Rookie Year: 2012
Location: Endicot NY
Posts: 91
PaulDavis1968 is just really nicePaulDavis1968 is just really nicePaulDavis1968 is just really nicePaulDavis1968 is just really nicePaulDavis1968 is just really nice
Re: Pure Python NetworkTables 2 client

Quote:
Originally Posted by sparkytwd View Post
Awesome. The shipped kernel was missing the ov534 drivers, but I was able to compile a new version on the board.

We like the Eye camera as it has custom lens assemblies available, and after an event last year where they had stadium lighting directly behind the vision targets we decided to switch over to infrared.
That is very cool idea!
Reply With Quote
  #7   Spotlight this post!  
Unread 03-09-2013, 14:27
Toa Circuit's Avatar
Toa Circuit Toa Circuit is offline
Thaddeus Maximus
AKA: Thad Hughes
FRC #4213 (MetalCow Robotics)
Team Role: Leadership
 
Join Date: Nov 2012
Rookie Year: 2012
Location: Shirley, IL
Posts: 131
Toa Circuit is an unknown quantity at this point
Cool Re: Pure Python NetworkTables 2 client

Awesome! I like. I had to do some modifying to the code to get it to work on the receiving end though... (Not 100% following some of your code.)
I replaced the getValue with:
Code:
    def getValue(self, name):
        for i in self.tableValues:
            if self.tableValues[i].name == "/SmartDashboard/"+name:
                return self.tableValues[i].value
        return None
Which works for floats and strings, at least. setValue doesn't work, and I can't quite figure out how or why...
Definitely gonna use this in my Tk dashboard, though.
__________________

2012 Head of Programming and Electrical
2013-14 Overall Team Captain and Programming Head
2012-14 Mentor of FLL Team Power Surge
2014 Dean's List Finalist
2014 CIR Xerox Creativity Award
Webpage
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 19:52.

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