rosjava network setup
I'm running roscore on a remote computer.
I created a modified RosRunClass to manually set master URI.
final String master = argv[argv.length - 1]; // http://10.159.1.24:11311
nodeConfiguration.setMasterUri(new URI(master));
I've also overridden Advertise URI as follows:
AdvertiseAddressFactory adress = new AdvertiseAddressFactory() {
String _master = master;
@Override
public AdvertiseAddress newDefault() {
String IPADDRESS_PATTERN = "(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)";
Pattern pattern = Pattern.compile(IPADDRESS_PATTERN);
Matcher matcher = pattern.matcher(_master);
if (matcher.find()) _master = matcher.group();
else _master = "localhost";
return new AdvertiseAddress(_master);
}
};
nodeConfiguration.setXmlRpcAdvertiseAddressFactory(adress);
nodeConfiguration.setTcpRosAdvertiseAddressFactory(adress);
However I still get following exception when I try to register a new Publisher.
org.ros.exception.RosRuntimeException: java.net.URISyntaxException: Illegal character in authority at index 7: http://10.159.1.24 192.168.56.1:60076/
I have no idea where "192.168.56.1" comes from as this is NOT my internal (nor external) IP.
I'm using newest rosjava available in Ubuntu repositories (for ros indigo).