Skip to content

Commit f2047a4

Browse files
committed
MasterServer operational, cleanup
1 parent cc5a5ab commit f2047a4

File tree

12 files changed

+50
-39
lines changed

12 files changed

+50
-39
lines changed

README.md

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ and 'assert' keyword. Also added additional logic in onNodeReplacement to attemp
99
new node replaces a previous one. None of the tools of ROS are within scope of this, but Core, that being Master and
1010
Parameter server and supporting messages and their plumbing. The intent was to reduce the codebase rather than address
1111
any other issues. Also removed are the test harnesses and other tooling regarding generation of Catkin and Gradle-based
12-
packages to produce executable JARs which are ROS 'packages'. Ant is used in each of the subprojects to do builds.
12+
packages to produce executable JARs which are ROS 'packages'. Ant is used in each of the subprojects to do builds and typically a build.xml file
13+
can be found in each target project.
1314
Eclipse was the development environment used. The original project was broken down into several subprojects for
1415
easier handling:
1516
ROSJava - this.
@@ -23,10 +24,19 @@ The dynamic proxy invocation using the generated interfaces was removed in favor
2324
concrete serializable classes vs interfaces and dynamic proxy invocations.
2425
This version will not interop with XML-RPC, yet.
2526
A simple intermediary to translate serialzable to XML-RPC would need constructed.
27+
The mechanism for remote calls is a simple serialized class of 'package, method name, and parameters'. On the remote side the server classes are
28+
reflected and the methods matched to the incoming message and invoked with the parameters supplied in the message. The result is returned
29+
as lists of objects, as in the original version, but the only requirement is that the objects in request and result all serialize.
30+
To this end the Standard ROS message files can be generated as concrete serializable classes with the GenerateClasses class mentioned earlier.
2631

32+
Addresses are now expressed in InetSocketAddress rather than URI since the primary servers are simple socket servers and can use Java serialization instead
33+
of the heavyweight XML-RPC protocols with their associated 'schemes'.
2734

28-
Addresses are now expressed in InetSocketAddress rather than URI as the primary servers are simple socket servers using Java serialization instead
29-
of the heavyweight XML-RPC protocols.
35+
The MasterServer and ParameterServer are now organized as distinct servers on 2 different ports, although the reflected methods available
36+
to remotely call both are encapsulated in the MasterServer class. The default ports for the master and parameter server are port and port+1
37+
starting at 8090., so initially the default master is at 127.0.0.1:8090 and default parameter server is at 127.0.0.1:8091
3038

31-
The original incarnation was simply too unnecessarily massive to get good performance from SBC's like the Odroid and RPi.
32-
Eventually, a cohesive Relatrix/ROSJavaLite robot bus will combine all the NeoCoreTechs robotics projects.
39+
The original incarnation was simply too unnecessarily massive to get good performance from SBC's like the Odroid and RPi. Bringing up the associated full web
40+
server and XML RPC endpoints was a performance death sentence.
41+
Eventually, a cohesive Relatrix/ROSJavaLite robot bus will combine all the NeoCoreTechs robotics projects into a true general purpose
42+
Robot Operating System usable for field robotics.

src/main/java/build.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
<!-- Compiles the java code (including the usage of library for JUnit -->
2828
<target name="compile" depends="makedir">
29-
<javac srcdir="${src.dir}" destdir="${build.dir}" classpath="${lib.dir}/netty-3.2.0.Final.jar:${lib.dir}/commons-pool-1.6.jar:${lib.dir}/commons-lang-2.6.jar:${lib.dir}/ws-commons-util-1.0.1.jar:${lib.dir}/commons-httpclient-3.1.jar:${lib.dir}/en_us.jar:${lib.dir}/commons-digester-1.8.1.jar:${lib.dir}/xmlrpc-common-3.1.3.jar:${lib.dir}/xmlrpc-server.jar:${lib.dir}/commons-logging-1.1.2.jar:${lib.dir}/commons-io-2.4.jar:${lib.dir}/RosBase.jar:${lib.dir}/xmlrpc-client-3.1.3.jar:${lib.dir}/commons-net-1.4.1.jar:${lib.dir}/RosMsgs.jar">
29+
<javac srcdir="${src.dir}" destdir="${build.dir}" classpath="${lib.dir}/netty-3.2.0.Final.jar:${lib.dir}/commons-pool-1.6.jar:${lib.dir}/commons-lang-2.6.jar:${lib.dir}/ws-commons-util-1.0.1.jar:${lib.dir}/en_us.jar:${lib.dir}/commons-digester-1.8.1.jar:${lib.dir}/commons-logging-1.1.2.jar:${lib.dir}/commons-io-2.4.jar:${lib.dir}/RosBase.jar:${lib.dir}/commons-net-1.4.1.jar:${lib.dir}/RosMsgs.jar">
3030
</javac>
3131

3232
</target>

src/main/java/org/ros/RosCore.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import org.ros.internal.node.server.master.MasterServer;
2323

2424
import java.io.IOException;
25-
2625
import java.net.InetSocketAddress;
2726
import java.util.concurrent.TimeUnit;
2827

@@ -109,4 +108,11 @@ public ParameterServer getParameterServer() {
109108
public MasterServer getMasterServer() {
110109
return masterServer;
111110
}
111+
112+
public static void main(String[] args) throws Exception {
113+
RosCore rosCore = RosCore.newPublic(8090);
114+
rosCore.start();
115+
rosCore.awaitStart(1, TimeUnit.SECONDS);
116+
System.out.println("RosLite Master started @ address "+rosCore.getUri());
117+
}
112118
}

src/main/java/org/ros/internal/node/DefaultNode.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,10 @@
6565
import org.ros.time.TimeProvider;
6666

6767
import java.io.IOException;
68-
import java.net.InetAddress;
68+
6969
import java.net.InetSocketAddress;
7070
import java.net.URI;
71-
import java.net.UnknownHostException;
71+
7272
import java.util.Collection;
7373
import java.util.concurrent.CountDownLatch;
7474
import java.util.concurrent.ScheduledExecutorService;

src/main/java/org/ros/internal/node/client/Registrar.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public Registrar(MasterClient masterClient, ScheduledExecutorService executorSer
7777
nodeIdentifier = null;
7878
running = false;
7979
if (DEBUG) {
80-
log.info("MasterXmlRpcEndpoint URI: " + masterClient.getRemoteUri());
80+
log.info("MasterRpcEndpoint Address: " + masterClient.getRemoteUri());
8181
}
8282
}
8383

src/main/java/org/ros/internal/node/rpc/MasterRpcEndpoint.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,9 @@ public interface MasterRpcEndpoint extends RpcEndpoint {
6464
* @param callerApi
6565
* API URI of subscriber to register. Will be used for new publisher
6666
* notifications
67-
* @return publishers as a list of XMLRPC API URIs for nodes currently
67+
* @param port
68+
* port the server is running on
69+
* @return publishers as a list of InetSocketAddresses for nodes currently
6870
* publishing the specified topic
6971
*/
7072
List<Object> registerSubscriber(String callerId, String topicName, String topicType,

src/main/java/org/ros/internal/node/server/NodeIdentifier.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,17 @@
1616

1717
package org.ros.internal.node.server;
1818

19-
import org.ros.exception.RosRuntimeException;
2019
import org.ros.internal.transport.ConnectionHeader;
2120
import org.ros.internal.transport.ConnectionHeaderFields;
2221
import org.ros.namespace.GraphName;
2322
import org.ros.node.Node;
2423

25-
import java.net.InetAddress;
2624
import java.net.InetSocketAddress;
2725
import java.net.URI;
28-
import java.net.URISyntaxException;
29-
import java.net.UnknownHostException;
3026

3127
/**
32-
* A node slave identifier which combines the node name of a node with the URI
33-
* for contacting the node's XMLRPC server.
28+
* A node slave identifier which combines the node name of a node with the Address
29+
* for contacting the node's RPC server.
3430
*
3531
* @author damonkohler@google.com (Damon Kohler)
3632
*/

src/main/java/org/ros/internal/node/server/SlaveServer.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,7 @@
3535
import org.ros.namespace.GraphName;
3636

3737
import java.io.IOException;
38-
import java.net.InetAddress;
3938
import java.net.InetSocketAddress;
40-
import java.net.URI;
4139
import java.util.ArrayList;
4240
import java.util.Collection;
4341
import java.util.List;

src/main/java/org/ros/internal/node/server/master/MasterServer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,14 +159,14 @@ public boolean unregisterService(GraphName nodeName, GraphName serviceName, Inet
159159
* the {@link GraphName} of the subscribed {@link TopicParticipant}
160160
* @param topicMessageType
161161
* the message type of the topic
162-
* @return A {@link List} of XMLRPC API {@link URI}s for nodes currently
162+
* @return A {@link List} of addresses {@link InetSocketAddress}s for nodes currently
163163
* publishing the specified topic
164164
*/
165165
public List<InetSocketAddress> registerSubscriber(GraphName nodeName, InetSocketAddress nodeSlaveUri, GraphName topicName,
166166
String topicMessageType) {
167167
if (DEBUG) {
168168
log.info(String.format(
169-
"Registering subscriber %s with message type %s on node %s with URI %s", topicName,
169+
"Registering subscriber %s with message type %s on node %s with Address %s", topicName,
170170
topicMessageType, nodeName, nodeSlaveUri));
171171
}
172172

src/main/java/org/ros/node/NodeConfiguration.java

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,9 @@
3636
import org.ros.time.WallTimeProvider;
3737

3838
import java.io.File;
39-
import java.net.InetAddress;
4039
import java.net.InetSocketAddress;
4140
import java.net.URI;
42-
import java.net.URISyntaxException;
43-
import java.net.UnknownHostException;
41+
4442
import java.util.List;
4543
import java.util.concurrent.ScheduledExecutorService;
4644

@@ -475,8 +473,8 @@ public BindAddress getRpcBindAddress() {
475473
* @see <a href="http://www.ros.org/wiki/ROS/Technical%20Overview#Node">Node
476474
* documentation</a>
477475
*
478-
* @param xmlRpcBindAddress
479-
* the {@link BindAddress} for the {@link Node}'s XML-RPC server
476+
* @param RpcBindAddress
477+
* the {@link BindAddress} for the {@link Node}'s RPC server
480478
*/
481479
public NodeConfiguration setRpcBindAddress(BindAddress rpcBindAddress) {
482480
this.rpcBindAddress = rpcBindAddress;
@@ -490,7 +488,7 @@ public NodeConfiguration setRpcBindAddress(BindAddress rpcBindAddress) {
490488
* @return the {@link AdvertiseAddress} for the {@link Node}'s RPC server
491489
*/
492490
public AdvertiseAddress getRpcAdvertiseAddress() {
493-
return rpcAdvertiseAddressFactory.newDefault(0);
491+
return rpcAdvertiseAddressFactory.newDefault(8200);
494492
}
495493

496494
/**
@@ -513,8 +511,8 @@ public AdvertiseAddressFactory getRpcAdvertiseAddressFactory() {
513511
* server
514512
*/
515513
public NodeConfiguration setRpcAdvertiseAddressFactory(
516-
AdvertiseAddressFactory xmlRpcAdvertiseAddressFactory) {
517-
this.rpcAdvertiseAddressFactory = xmlRpcAdvertiseAddressFactory;
514+
AdvertiseAddressFactory rpcAdvertiseAddressFactory) {
515+
this.rpcAdvertiseAddressFactory = rpcAdvertiseAddressFactory;
518516
return this;
519517
}
520518

0 commit comments

Comments
 (0)