For some reason I can’t edit my posts. I made another tool that just shows network interface information.(I hate manually checking the Network adapter every time I’m curious about my current IP status)
You could just go Start->Run->type ‘cmd’ (usually already typed in since I almost certainly used it last) -> ipconfig /all
Same thing for the config. I used to write Batch and Perl scripts to do it, then I got lazy and just remembered the command to type (‘netsh interface ipv4 set address “Local Area Connection” static 10.0.33.217 255.0.0.0’). Roughly the same number of mouse strokes (which are highly more time-consuming than keystrokes), especially if I don’t have the folder with the batch file open or I’m not on my computer.
My best solution is to just use WiFi only for real networks, and use wired Ethernet only for robot networks. But, in case I have to break this, then I can just type netsh and be done.
But, if you do still want to do it this way, it should be possible to do entirely in a shell script, reducing dependencies on a foreign machine to zero.
ipconfig /all shows interfaces I don’t care about. I really wanted a way to just show basic interface information that doesn’t make me hunt for the information.
With using script to toggle between static and DHCP, I remove any errors that I may make with signaling what static IP I want(which avoids IP address conflicts), and it saves time and patience for me.
Sometimes my team needs the robot to be using the wireless network for increased mobility(although I do generally use wired for the static internet-lacking network and wireless for internet access), and I use my personal computer to work on the robot, so, at the end of the day, I don’t want my wired interface to be set to a static IP.
I opted for python over solely batch(thus not reducing the dependencies to zero) because batch makes simple things like storing the output of a program into a variable painful. I honestly tried to use only batch, but I couldn’t bear using it after a point.
Using an environment variable sounds kind of hackish; the only way I could imagine being able to make a toggle of sorts would be to stuff practically a batch script into a variable that I execute. I really don’t want to use the command-line directly to execute my program because then I would have to worry about editing the path variable to where I store the batch files, and I would need to run the prompt as administrator to change my IP, and I would need to type in the program name, as to apposed to just hitting the windows key once, the down arrow key, and then enter as I have it now.
The driver station program should automatically set your computer’s IP for you when you start it up, as long as you’ve properly configured the team number and NIC. I don’t see the need for a different program to set the IP…
Our team decided it was easier to just have two network interfaces. We picked up cheap network cards (you can find them for ~$10 each) and simply added a second interface card to our lab computers. Set the static IP on the robot interface and DHCP on the other one.
Bonus tip: You can buy a short ethernet cable and a straight-through double female RJ45 connector to extend your ethernet jack out to the edge of our desk. Helps a lot if your computer sits back under the desk.