Our team is having a kind of strange issue. Our goal is to publish the latency between the robot and the driver station into the Smart Dashboard. We’re doing this through the icmp4j Java libraries. The sample code is down below.
/**
*
*/
public class GetLatency extends Subsystem {
public void getDriverStation(){
final IcmpPingRequest request = IcmpPingUtil.createIcmpPingRequest ();
request.setHost ("10.25.57.1");
final IcmpPingResponse response = IcmpPingUtil.executePingRequest (request);
final String formattedResponse = IcmpPingUtil.formatResponse (response);
SmartDashboard.putString("firstResponse",formattedResponse);
}
// Put methods for controlling this subsystem
// here. Call these from Commands.
public void initDefaultCommand() {
// Set the default command for a subsystem here.
//setDefaultCommand(new MySpecialCommand());
}
}
The trouble is that the execution results in the following error:
Error: PING 10.25.57.1 (10.25.57.1): 32 data bytes
Does anyone have any idea what might be causing this?
You are pinging the Robot Radio. To establish ping with your robot, I would ping the DNS address of the robot which is roboRIO-####-FRC.local (where #### is your team number with no leading zeroes). You cant ping a direct IP in this case because the RIO can move from match to match. You can though, ping the RIO at an address by assigning it a static IP.
I get this in reference to the RoboRIO, but what about when it goes the other way. Why would the ping fail when the robot tries to contact the driver station?
You can tether the Driver Station to the robot radio (with the robot radio connected to the roboRIO).
Then the Enet IP address shown in the Driver Station Diagnostics tab display shows the IP you need to us to ping from the robot code.