OCCRA
Go to Post In most cases on FIRST robots, we have more material than in we need in some places and less than we need in others. That single phenomenon is the leading cause of robot failures. - Paul Copioli [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

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 06-25-2018, 08:08 PM
Scott L.'s Avatar
Scott L. Scott L. is offline
Registered User
FRC #0222 (Tigertrons)
Team Role: Engineer
 
Join Date: Sep 2003
Rookie Year: 1998
Location: Tunkhannock PA
Posts: 303
Scott L. is just really niceScott L. is just really niceScott L. is just really niceScott L. is just really niceScott L. is just really nice
Send a message via AIM to Scott L.
Lightbulb Team IP address

I'm looking for vb.net code to convert a team number to the ip network
__________________
You can do anything, if you put your mind to it!!!
http://asp.shinraikon.com
Reply With Quote
  #2   Spotlight this post!  
Unread 06-25-2018, 09:18 PM
bdaroz's Avatar
bdaroz bdaroz is offline
Programming Mentor
AKA: Brian Rozmierski
FRC #5881 (TVHS Dragons)
Team Role: Mentor
 
Join Date: Jan 2016
Rookie Year: 2016
Location: Albany, NY
Posts: 833
bdaroz has a reputation beyond reputebdaroz has a reputation beyond reputebdaroz has a reputation beyond reputebdaroz has a reputation beyond reputebdaroz has a reputation beyond reputebdaroz has a reputation beyond reputebdaroz has a reputation beyond reputebdaroz has a reputation beyond reputebdaroz has a reputation beyond reputebdaroz has a reputation beyond reputebdaroz has a reputation beyond repute
Re: Team IP address

vb.net? Yikes...

In general, it's not difficult.
  1. Convert the team number to a string
  2. If length <= 2, the 2nd octet is "0" and the entirely of the string is the 3rd octet.
  3. If length > 2, take the last 2 characters into the 3rd octet, and the remaining first characters into the 2nd octet.

(Edit)
If you don't know an IPv4 address in the form aaa.bbb.ccc.ddd is broken up into 4 octets. (aaa is the 1st octet, bbb the 2nd and so on), so for team 222, 10.2.22.1 (your radio address) the 10 is the first octet, and 2 the 2nd, 22 the 3rd and 1 the 4th. Separate each octet by a period.
__________________

Last edited by bdaroz : 06-25-2018 at 09:20 PM.
Reply With Quote
  #3   Spotlight this post!  
Unread 06-25-2018, 11:04 PM
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,984
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: Team IP address

Here's a way to do it without conditionals: https://github.com/wpilibsuite/ntcor...atcher.cpp#L60
Reply With Quote
  #4   Spotlight this post!  
Unread 06-25-2018, 11:32 PM
CarlosGJ CarlosGJ is online now
418 alumnus, 696 mentor
AKA: Carlos Gross Jones
FRC #0696 (Circuit Breakers)
Team Role: Mentor
 
Join Date: Feb 2011
Rookie Year: 2009
Location: La Canada Flintridge, CA
Posts: 81
CarlosGJ has much to be proud ofCarlosGJ has much to be proud ofCarlosGJ has much to be proud ofCarlosGJ has much to be proud ofCarlosGJ has much to be proud ofCarlosGJ has much to be proud ofCarlosGJ has much to be proud ofCarlosGJ has much to be proud ofCarlosGJ has much to be proud ofCarlosGJ has much to be proud of
Re: Team IP address

Recognizing that IPs are more conveniently manipulated as integers than dotted-quads:

Code:
Function TeamNetwork(TeamNumber As Long) As Long
        TeamNetwork = &HA000000 Or (((TeamNumber \ 100) << &O20) Or ((TeamNumber Mod 100) << &O10))
End Function
Note: This function doesn't check that team numbers are less than 10000, because the current IP addressing scheme doesn't handle team numbers greater than 9999 anyway.

Note 2: I may have learned the rudiments of VB.NET to create this function.

Note 3: No one should ever use VB.NET.

Note 4: I also learned that vb.net is a perfectly valid domain, and seems like a place to get good deals on computers and accessories in, possibly, Holland.
Reply With Quote
  #5   Spotlight this post!  
Unread 06-26-2018, 10:59 AM
bdaroz's Avatar
bdaroz bdaroz is offline
Programming Mentor
AKA: Brian Rozmierski
FRC #5881 (TVHS Dragons)
Team Role: Mentor
 
Join Date: Jan 2016
Rookie Year: 2016
Location: Albany, NY
Posts: 833
bdaroz has a reputation beyond reputebdaroz has a reputation beyond reputebdaroz has a reputation beyond reputebdaroz has a reputation beyond reputebdaroz has a reputation beyond reputebdaroz has a reputation beyond reputebdaroz has a reputation beyond reputebdaroz has a reputation beyond reputebdaroz has a reputation beyond reputebdaroz has a reputation beyond reputebdaroz has a reputation beyond repute
Re: Team IP address

/agree Carlos

I figured I would go the string route given the request for vb.net and not knowing the level of programming knowledge. Using modulo math might add complexity the op might not be ready for.
__________________
Reply With Quote
  #6   Spotlight this post!  
Unread 06-26-2018, 11:18 AM
Scott L.'s Avatar
Scott L. Scott L. is offline
Registered User
FRC #0222 (Tigertrons)
Team Role: Engineer
 
Join Date: Sep 2003
Rookie Year: 1998
Location: Tunkhannock PA
Posts: 303
Scott L. is just really niceScott L. is just really niceScott L. is just really niceScott L. is just really niceScott L. is just really nice
Send a message via AIM to Scott L.
Re: Team IP address

Quote:
Originally Posted by bdaroz View Post
vb.net? Yikes...

In general, it's not difficult.
  1. Convert the team number to a string
  2. If length <= 2, the 2nd octet is "0" and the entirely of the string is the 3rd octet.
  3. If length > 2, take the last 2 characters into the 3rd octet, and the remaining first characters into the 2nd octet.

(Edit)
If you don't know an IPv4 address in the form aaa.bbb.ccc.ddd is broken up into 4 octets. (aaa is the 1st octet, bbb the 2nd and so on), so for team 222, 10.2.22.1 (your radio address) the 10 is the first octet, and 2 the 2nd, 22 the 3rd and 1 the 4th. Separate each octet by a period.
Thanks. I am working on an off season fms and needed a way to get driver station and robot IP so they could be pinged to verify connection before match start. Vb.net is what I know best having used it for the coding on asp.net websites.
__________________
You can do anything, if you put your mind to it!!!
http://asp.shinraikon.com
Reply With Quote
  #7   Spotlight this post!  
Unread 06-26-2018, 02:06 PM
seg9585's Avatar
seg9585 seg9585 is offline
Registered User
AKA: Eric
FRC #0612 (Chantilly Robotics)
Team Role: Engineer
 
Join Date: Feb 2006
Rookie Year: 2001
Location: Chantilly, VA (Harris Corp)
Posts: 635
seg9585 has a reputation beyond reputeseg9585 has a reputation beyond reputeseg9585 has a reputation beyond reputeseg9585 has a reputation beyond reputeseg9585 has a reputation beyond reputeseg9585 has a reputation beyond reputeseg9585 has a reputation beyond reputeseg9585 has a reputation beyond reputeseg9585 has a reputation beyond reputeseg9585 has a reputation beyond reputeseg9585 has a reputation beyond repute
Re: Team IP address

Quote:
Originally Posted by CarlosGJ View Post

Note 2: I may have learned the rudiments of VB.NET to create this function.
Plz...Can you post code that performs the same function but in Befunge?

I'm trying to build an FMS over the summer but only with an esoteric language. Thx!
__________________
My FIRST legacy:

Team 204 Student 2001, 2002 (Voorhees, NJ)
Team 1493 College Mentor 2006 - 2008 (Troy, NY)
Team 2150 Intern/Professional Mentor 2007, 2009 (Palos Verdes)
Team 4123 Lead Engineering Mentor 2012 (Bellflower, CA)
Team 4276 Engineering Mentor 2012-Present (Huntington Beach, CA)
Team 612 Engineering Mentor (Chantilly, VA) Present
Reply With Quote
  #8   Spotlight this post!  
Unread 06-26-2018, 03:30 PM
CarlosGJ CarlosGJ is online now
418 alumnus, 696 mentor
AKA: Carlos Gross Jones
FRC #0696 (Circuit Breakers)
Team Role: Mentor
 
Join Date: Feb 2011
Rookie Year: 2009
Location: La Canada Flintridge, CA
Posts: 81
CarlosGJ has much to be proud ofCarlosGJ has much to be proud ofCarlosGJ has much to be proud ofCarlosGJ has much to be proud ofCarlosGJ has much to be proud ofCarlosGJ has much to be proud ofCarlosGJ has much to be proud ofCarlosGJ has much to be proud ofCarlosGJ has much to be proud ofCarlosGJ has much to be proud of
Re: Team IP address

Quote:
Originally Posted by seg9585 View Post
Plz...Can you post code that performs the same function but in Befunge?

I'm trying to build an FMS over the summer but only with an esoteric language. Thx!
Code:
>"P"8888888*******51g"0"-25**61g"0"-+28"@@"****71g"0"-25**81g"0"-+4"@"**+++.@
Team:1234
Although there are probably more concise ways to do it.

Note: Make sure team number is padded with zeroes, if less than four digits. E.g., 696 should be input as 0696.

Last edited by CarlosGJ : 06-26-2018 at 03:36 PM.
Reply With Quote
  #9   Spotlight this post!  
Unread 06-26-2018, 04:43 PM
cgmv123's Avatar
cgmv123 cgmv123 is offline
FRC RI/FLL Field Manager
AKA: Max Vrany
FRC #1306 (BadgerBOTS)
Team Role: College Student
 
Join Date: Jan 2011
Rookie Year: 2011
Location: Madison, WI
Posts: 2,283
cgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond repute
Re: Team IP address

Left shift and right shift might help.
__________________
BadgerBOTS Robotics|@team1306|Facebook: BadgerBOTS
2017 FIRST Championship Daly Division | 2017 Seven Rivers Regional Chairman's Award | 2017 Wisconsin Regional Dean's List Finalist (Grace Fanson)

2016 FIRST Championship Tesla Division | 2016 Wisconsin Regional Engineering Inspiration Award

2015 FIRST Championship Carson Division | 2015 Wisconsin Regional Chairman's Award

2013 FIRST Championship Curie Division | 2013 Wisconsin Regional Chairman's Award

2012 FIRST Championship Archimedes Division | 2012 Wisconsin Regional Engineering Inspiration Award, Woodie Flowers Finalist Award (Lead Mentor Ben Senson)

Reply With Quote
  #10   Spotlight this post!  
Unread 06-27-2018, 12:54 PM
JamieSinn's Avatar
JamieSinn JamieSinn is offline
Mentor - 1334/1374
FRC #1334 (OT Robotics)
Team Role: Mentor
 
Join Date: Mar 2013
Rookie Year: 2009
Location: Canada
Posts: 80
JamieSinn has a reputation beyond reputeJamieSinn has a reputation beyond reputeJamieSinn has a reputation beyond reputeJamieSinn has a reputation beyond reputeJamieSinn has a reputation beyond reputeJamieSinn has a reputation beyond reputeJamieSinn has a reputation beyond reputeJamieSinn has a reputation beyond reputeJamieSinn has a reputation beyond reputeJamieSinn has a reputation beyond reputeJamieSinn has a reputation beyond repute
Re: Team IP address

Quote:
Originally Posted by CarlosGJ View Post
...

Note: This function doesn't check that team numbers are less than 10000, because the current IP addressing scheme doesn't handle team numbers greater than 9999 anyway.

...
It actually does, for team 10000 it's 10.100.0.1 - The addressing breaks once you pass team 25599. (10.255.99.1)

25599/100=255
25599%100=99

Though I do admit that past 10k, it's worth investigating IPV6, or a different addressing scheme.
__________________


1334/1374 Control Systems Mentor
Reply With Quote
  #11   Spotlight this post!  
Unread 06-27-2018, 01:01 PM
marshall's Avatar
marshall marshall is offline
Online Stripe & Drape Sales
FRC #0900 (The Zebracorns)
Team Role: Mentor
 
Join Date: Jan 2012
Rookie Year: 2003
Location: North Carolina
Posts: 2,940
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: Team IP address

Quote:
Originally Posted by JamieSinn View Post
It actually does, for team 10000 it's 10.100.0.1 - The addressing breaks once you pass team 25599. (10.255.99.1)

25599/100=255
25599%100=99

Though I do admit that past 10k, it's worth investigating IPV6, or a different addressing scheme.
IPSec VPNs for everyone!

I'm kidding.... or am I?
__________________
"La mejor salsa del mundo es la hambre" - Miguel de Cervantes
"The future is unwritten" - Joe Strummer
"Simplify, then add lightness" - Colin Chapman
Clarke's Laws
Reply With Quote
  #12   Spotlight this post!  
Unread 06-27-2018, 01:04 PM
JamieSinn's Avatar
JamieSinn JamieSinn is offline
Mentor - 1334/1374
FRC #1334 (OT Robotics)
Team Role: Mentor
 
Join Date: Mar 2013
Rookie Year: 2009
Location: Canada
Posts: 80
JamieSinn has a reputation beyond reputeJamieSinn has a reputation beyond reputeJamieSinn has a reputation beyond reputeJamieSinn has a reputation beyond reputeJamieSinn has a reputation beyond reputeJamieSinn has a reputation beyond reputeJamieSinn has a reputation beyond reputeJamieSinn has a reputation beyond reputeJamieSinn has a reputation beyond reputeJamieSinn has a reputation beyond reputeJamieSinn has a reputation beyond repute
Re: Team IP address

Quote:
Originally Posted by marshall View Post
IPSec VPNs for everyone!

I'm kidding.... or am I?
I can never tell with you
__________________


1334/1374 Control Systems Mentor
Reply With Quote
  #13   Spotlight this post!  
Unread 06-27-2018, 01:34 PM
CarlosGJ CarlosGJ is online now
418 alumnus, 696 mentor
AKA: Carlos Gross Jones
FRC #0696 (Circuit Breakers)
Team Role: Mentor
 
Join Date: Feb 2011
Rookie Year: 2009
Location: La Canada Flintridge, CA
Posts: 81
CarlosGJ has much to be proud ofCarlosGJ has much to be proud ofCarlosGJ has much to be proud ofCarlosGJ has much to be proud ofCarlosGJ has much to be proud ofCarlosGJ has much to be proud ofCarlosGJ has much to be proud ofCarlosGJ has much to be proud ofCarlosGJ has much to be proud ofCarlosGJ has much to be proud of
Re: Team IP address

Quote:
Originally Posted by JamieSinn View Post
It actually does, for team 10000 it's 10.100.0.1 - The addressing breaks once you pass team 25599. (10.255.99.1)

25599/100=255
25599%100=99

Though I do admit that past 10k, it's worth investigating IPV6, or a different addressing scheme.
Hmm, fair point. Although I believe the reason FRC is pushing hard on mDNS is to decrease IP addressing problems when we finally get 5-digit teams. For my part, I don't see why they don't just let each team's network be a 192.168/24, with NAT between each driver station and the FMS.
Reply With Quote
  #14   Spotlight this post!  
Unread 06-27-2018, 02:31 PM
bdaroz's Avatar
bdaroz bdaroz is offline
Programming Mentor
AKA: Brian Rozmierski
FRC #5881 (TVHS Dragons)
Team Role: Mentor
 
Join Date: Jan 2016
Rookie Year: 2016
Location: Albany, NY
Posts: 833
bdaroz has a reputation beyond reputebdaroz has a reputation beyond reputebdaroz has a reputation beyond reputebdaroz has a reputation beyond reputebdaroz has a reputation beyond reputebdaroz has a reputation beyond reputebdaroz has a reputation beyond reputebdaroz has a reputation beyond reputebdaroz has a reputation beyond reputebdaroz has a reputation beyond reputebdaroz has a reputation beyond repute
Re: Team IP address

Quote:
Originally Posted by CarlosGJ View Post
Hmm, fair point. Although I believe the reason FRC is pushing hard on mDNS is to decrease IP addressing problems when we finally get 5-digit teams. For my part, I don't see why they don't just let each team's network be a 192.168/24, with NAT between each driver station and the FMS.
mDNS is the devil. It was bad in 2007, and sketchy in 2006. We opted to go static in 2007 after having problems and never looked back. For us, we're a 1:1 student:computer school, and the computers are generally locked down. Robotics programming kids do get some restrictions lifted, but mDNS has never been reliable on those machines making troubleshooting difficult.

10.TE.AM.xx allows teams to simulate the addressing of competition fairly closely and reduces complexities. If it goes away to something completely dynamic it would not be good.
__________________
Reply With Quote
  #15   Spotlight this post!  
Unread 06-28-2018, 08:32 AM
aryker's Avatar
aryker aryker is offline
Registered User
FRC #0868 (TechHOUNDS)
Team Role: Mentor
 
Join Date: Jan 2013
Rookie Year: 2008
Location: Carmel, IN
Posts: 105
aryker is a jewel in the rougharyker is a jewel in the rougharyker is a jewel in the rough
Re: Team IP address

Quote:
Originally Posted by bdaroz View Post
mDNS is the devil. It was bad in 2007, and sketchy in 2006. We opted to go static in 2007 after having problems and never looked back.
2006 and 2007 used crystal radios for robot communications. Did you mean 2016 and 2017?
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 03:47 PM.

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


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