Measuring Field Latency

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.

import edu.wpi.first.wpilibj.command.Subsystem;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;

/**
*
*/
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?

Thanks,
The SOTABots

Update: Pinging the robot itself was an obvious problem, but even when switched to the driver station’s address, this error showed up:

Error: Timeout reached after 5010 msecs

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.

The Driver Station will show the roboRIO IP to ping on the Diagnostic tab (which is itself actually just doing a ping of the roboRIO).

In the attached example the roboRIO IP is 10.3.58.90

roboRIOIP.jpg

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.

I just tried pinging the ENet address and had essentially the same issue. The ping timed out with no response.

As long as the device you are pinging is up and responds to that type of packet, it’s fine to test with.

You may have to initialize a network socket that you would then send the packet across.

D

I’m not sure that I understand.