Go to Post Yes, machining a dog profile into a steel sprocket on a manual mill was an experience filled with pain and regret. - Joe G. [more]
Home
Go Back   Chief Delphi > FIRST > General Forum
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 03-12-2009, 09:07 PM
Eric Finn's Avatar
Eric Finn Eric Finn is offline
Registered User
FRC #0166 (Chop Shop)
Team Role: College Student
 
Join Date: May 2006
Rookie Year: 2005
Location: Merrimack, NH
Posts: 101
Eric Finn has a spectacular aura aboutEric Finn has a spectacular aura about
Send a message via AIM to Eric Finn
Lightbulb Simple Team Number to IP Address Utility

Ever wanted to set your computer's IP so that you would be able to communicate with your robot, but didn't want to hassle with all the dialogues required to do so in Windows? (Control Panel > Network Connections > Your Network Connection > Properties > Internet Protocol (TCP/IP) > Properties ...what a bore!)
Well, I have a solution! teamtoip takes your team # and your network interface name, and automatically sets your IP address and subnet mask!

Command line usage:
Code:
teamtoip [team] "Interface Name"
Where [team] is your team number and "Interface Name" is the name of the interface you want to change the IP of. Generally it is "Local Area Connection" or "Wireless Network Connection" for wired Ethernet or wireless, respectively.

This utility was created mainly for inspectors at competitions, who have to change their IP address for each individual robot they inspect, which is quite inconvenient.

I am posting it here for 2 reasons:
  1. More eyes looking can catch more issues. If you find anything wrong with my code, or even anything that can be improved upon, don't hesitate to email me.
  2. This will probably be useful to more than just inspectors. Team members who don't like screwing around with network interface configuration (and don't need the IP address to be set back to what it was before ;) as well as people who don't remember the IP address convention can use this.
So, without further ado, here is the program:

Source: http://goatsgomoo.arksaw.com/project...p/teamtoip.cpp
Binary [Windows]: http://goatsgomoo.arksaw.com/project...p/teamtoip.exe
__________________
It always takes longer than you expect, even when you take into account Hofstadter's Law.
--Hofstadter's Law

Reply With Quote
  #2   Spotlight this post!  
Unread 03-13-2009, 11:51 AM
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,112
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Simple Team Number to IP Address Utility

Simpler yet:
Code:
set /p teamnum=What is the team number?
set /a teamnumhigh=%teamnum%/100
set /a teamnumlow=%teamnum%-100*%high%
netsh interface ip set address 10.%high%.%low%.6 static 255.255.255.0 1
Put it in a batch file (e.g. teamip.bat) on your desktop, double-click, and enter the team number when prompted.

The netsh command is powerful. You can make single-line batch files to reconfigure the computer to talk to the Axis camera, or to make it easy to switch between 10.0.0.6/255.0.0.0 (which will let the computer talk to any team's WGA) and the WGA's factory default address.
Reply With Quote
  #3   Spotlight this post!  
Unread 03-13-2009, 02:01 PM
Eric Finn's Avatar
Eric Finn Eric Finn is offline
Registered User
FRC #0166 (Chop Shop)
Team Role: College Student
 
Join Date: May 2006
Rookie Year: 2005
Location: Merrimack, NH
Posts: 101
Eric Finn has a spectacular aura aboutEric Finn has a spectacular aura about
Send a message via AIM to Eric Finn
Re: Simple Team Number to IP Address Utility

Quote:
Originally Posted by Alan Anderson View Post
Simpler yet:
...
Aha! I knew there had to be an easier way!
I've made a batch file to perform the same task, with some improvements: after setting the IP address, you will be prompted for another team number and your old settings will be restored once you are finished.
Unfortunately it restores settings for all your network interfaces, not just the changed one. This takes quite a while for me (and my four network interfaces), but it will likely not take as long for others.

NOTE: Do *not* quit the batch file (by entering 0 as the team number) until you are ready to restore your settings. Also, if you quit using ctrl-c, the batch file will not restore your old settings if you run it again - It restores the settings from when the batch file was started.
EDIT: another note - don't delete ifcfg.txt while the batch file is running - it will be deleted after the batch file is exited normally (by entering 0 as the team number).

Team # to IP script [Windows batch]: http://goatsgomoo.arksaw.com/project...p/teamtoip.bat

Thanks for your help, Alan!
__________________
It always takes longer than you expect, even when you take into account Hofstadter's Law.
--Hofstadter's Law

Reply With Quote
  #4   Spotlight this post!  
Unread 03-13-2009, 04:21 PM
elfinn elfinn is offline
Team 166 Mentor
AKA: Beth Finn
FRC #0166 (Chopshop Team 166)
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 2004
Location: Merrimack, NH
Posts: 14
elfinn is an unknown quantity at this point
Re: Simple Team Number to IP Address Utility

To keep from setting ALL your network interfaces, add the name parameter.
Here's an example from team 67 and one that sets it back to dhcp for normal operations:

cRIO_Connection.bat
@netsh interface ip set address name="Local Area Connection" source=static
addr=10.0.67.6 mask=255.0.0.0
@pause

Normal_Connection.bat
@netsh interface ip set address name="Wireless Network Connection" dhcp
@netsh interface ip set address name="Local Area Connection" dhcp
@pause
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Team 229's Address Lord Xaphan General Forum 4 03-18-2007 02:08 AM
.mov or .swf to .DV utility? Ian Curtis Chit-Chat 2 05-27-2006 04:54 PM
Looking for a good file utility RIgnazio IT / Communications 1 10-20-2005 07:06 PM
Mailing Address for Team 271 BobC General Forum 5 03-21-2005 08:35 PM


All times are GMT -5. The time now is 11:46 AM.

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