public class DefaultNode extends java.lang.Object implements ConnectedNode
Node.| Constructor and Description |
|---|
DefaultNode(NodeConfiguration nodeConfiguration,
java.util.Collection<NodeListener> nodeListeners,
java.util.concurrent.ScheduledExecutorService scheduledExecutorService)
DefaultNodes should only be constructed using the
DefaultNodeFactory. |
| Modifier and Type | Method and Description |
|---|---|
void |
addListener(NodeListener listener)
Add a new
NodeListener to the Node. |
void |
executeCancellableLoop(CancellableLoop cancellableLoop)
|
org.ros.message.Time |
getCurrentTime()
In ROS, time can be wallclock (actual) or simulated, so it is important to
use
ConnectedNode.getCurrentTime() instead of using the standard
Java routines for determining the current time. |
org.apache.commons.logging.Log |
getLog() |
java.net.URI |
getMasterUri() |
org.ros.message.MessageSerializationFactory |
getMessageSerializationFactory() |
GraphName |
getName() |
ParameterTree |
getParameterTree()
Create a
ParameterTree to query and set parameters on the ROS
parameter server. |
NodeNameResolver |
getResolver() |
java.util.concurrent.ScheduledExecutorService |
getScheduledExecutorService() |
org.ros.message.MessageFactory |
getServiceRequestMessageFactory() |
org.ros.message.MessageFactory |
getServiceResponseMessageFactory() |
<T,S> ServiceServer<T,S> |
getServiceServer(GraphName serviceName) |
<T,S> ServiceServer<T,S> |
getServiceServer(java.lang.String serviceName) |
org.ros.message.MessageFactory |
getTopicMessageFactory() |
java.net.URI |
getUri() |
java.net.URI |
lookupServiceUri(GraphName serviceName) |
java.net.URI |
lookupServiceUri(java.lang.String serviceName) |
<T> Publisher<T> |
newPublisher(GraphName topicName,
java.lang.String messageType) |
<T> Publisher<T> |
newPublisher(java.lang.String topicName,
java.lang.String messageType) |
<T,S> ServiceClient<T,S> |
newServiceClient(GraphName serviceName,
java.lang.String serviceType)
Create a
ServiceClient. |
<T,S> ServiceClient<T,S> |
newServiceClient(java.lang.String serviceName,
java.lang.String serviceType) |
<T,S> ServiceServer<T,S> |
newServiceServer(GraphName serviceName,
java.lang.String serviceType,
ServiceResponseBuilder<T,S> responseBuilder)
Create a new
ServiceServer. |
<T,S> ServiceServer<T,S> |
newServiceServer(java.lang.String serviceName,
java.lang.String serviceType,
ServiceResponseBuilder<T,S> responseBuilder) |
<T> Subscriber<T> |
newSubscriber(GraphName topicName,
java.lang.String messageType) |
<T> Subscriber<T> |
newSubscriber(java.lang.String topicName,
java.lang.String messageType) |
GraphName |
resolveName(GraphName name)
Resolve the given name, using ROS conventions, into a full ROS namespace
name.
|
GraphName |
resolveName(java.lang.String name) |
void |
shutdown()
Shut the node down.
|
public DefaultNode(NodeConfiguration nodeConfiguration, java.util.Collection<NodeListener> nodeListeners, java.util.concurrent.ScheduledExecutorService scheduledExecutorService)
DefaultNodes should only be constructed using the
DefaultNodeFactory.nodeConfiguration - the NodeConfiguration for this NodenodeListeners - a Collection of NodeListeners that will be added
to this Node before it startspublic <T> Publisher<T> newPublisher(GraphName topicName, java.lang.String messageType)
newPublisher in interface ConnectedNodeT - the message type to create the publisher fortopicName - the topic name, will be pushed down under this namespace unless
'/' is prepended.messageType - the message data type (e.g. "std_msgs/String")Publisher for the specified topicpublic <T> Publisher<T> newPublisher(java.lang.String topicName, java.lang.String messageType)
newPublisher in interface ConnectedNodeConnectedNode.newPublisher(GraphName, String)public <T> Subscriber<T> newSubscriber(GraphName topicName, java.lang.String messageType)
newSubscriber in interface ConnectedNodeT - the message type to create the Subscriber fortopicName - the topic name to be subscribed to, this will be auto resolvedmessageType - the message data type (e.g. "std_msgs/String")Subscriber for the specified topicpublic <T> Subscriber<T> newSubscriber(java.lang.String topicName, java.lang.String messageType)
newSubscriber in interface ConnectedNodeConnectedNode.newSubscriber(GraphName, String)public <T,S> ServiceServer<T,S> newServiceServer(GraphName serviceName, java.lang.String serviceType, ServiceResponseBuilder<T,S> responseBuilder)
ConnectedNodeServiceServer.newServiceServer in interface ConnectedNodeserviceName - the name of the serviceserviceType - the type of the service (e.g. "rosjava_test_msgs/AddTwoInts")responseBuilder - called for every request to build a responseServiceServerpublic <T,S> ServiceServer<T,S> newServiceServer(java.lang.String serviceName, java.lang.String serviceType, ServiceResponseBuilder<T,S> responseBuilder)
newServiceServer in interface ConnectedNodeConnectedNode.newServiceServer(GraphName, String,
ServiceResponseBuilder)public <T,S> ServiceServer<T,S> getServiceServer(GraphName serviceName)
getServiceServer in interface ConnectedNodeserviceName - the GraphName of the ServiceServerServiceServer with the given name or null if it
does not existpublic <T,S> ServiceServer<T,S> getServiceServer(java.lang.String serviceName)
getServiceServer in interface ConnectedNodeConnectedNode.getServiceServer(GraphName)public java.net.URI lookupServiceUri(GraphName serviceName)
lookupServiceUri in interface ConnectedNodeserviceName - the GraphName of the service URI to lookupURI of the service or null if it does not existpublic java.net.URI lookupServiceUri(java.lang.String serviceName)
lookupServiceUri in interface ConnectedNodeConnectedNode.lookupServiceUri(GraphName)public <T,S> ServiceClient<T,S> newServiceClient(GraphName serviceName, java.lang.String serviceType) throws ServiceNotFoundException
ConnectedNodeServiceClient.newServiceClient in interface ConnectedNodeserviceName - the name of the serviceserviceType - the type of the service (e.g. "rosjava_test_msgs/AddTwoInts")ServiceClientServiceNotFoundException - thrown if no matching service could be foundpublic <T,S> ServiceClient<T,S> newServiceClient(java.lang.String serviceName, java.lang.String serviceType) throws ServiceNotFoundException
newServiceClient in interface ConnectedNodeServiceNotFoundExceptionConnectedNode.newServiceClient(GraphName, String)public org.ros.message.Time getCurrentTime()
ConnectedNodeConnectedNode.getCurrentTime() instead of using the standard
Java routines for determining the current time.getCurrentTime in interface ConnectedNodepublic GraphName getName()
public org.apache.commons.logging.Log getLog()
public GraphName resolveName(GraphName name)
NoderesolveName in interface Nodename - the name to resolvepublic GraphName resolveName(java.lang.String name)
resolveName in interface NodeNode.resolveName(GraphName)public void shutdown()
Nodepublic java.net.URI getMasterUri()
getMasterUri in interface NodeURI of MasterXmlRpcEndpoint that this node is
attached to.public NodeNameResolver getResolver()
getResolver in interface NodeNodeNameResolver for this namespacepublic ParameterTree getParameterTree()
ConnectedNodeParameterTree to query and set parameters on the ROS
parameter server.getParameterTree in interface ConnectedNodeParameterTree with NameResolver in this namespace.public java.net.URI getUri()
public org.ros.message.MessageSerializationFactory getMessageSerializationFactory()
getMessageSerializationFactory in interface NodeMessageSerializationFactory used by this nodepublic org.ros.message.MessageFactory getTopicMessageFactory()
getTopicMessageFactory in interface NodeMessageFactory used by this nodepublic org.ros.message.MessageFactory getServiceRequestMessageFactory()
getServiceRequestMessageFactory in interface NodeMessageFactory used by this node for service requestspublic org.ros.message.MessageFactory getServiceResponseMessageFactory()
getServiceResponseMessageFactory in interface NodeMessageFactory used by this node for service responsespublic void addListener(NodeListener listener)
NodeNodeListener to the Node.addListener in interface Nodelistener - the NodeListener to addpublic java.util.concurrent.ScheduledExecutorService getScheduledExecutorService()
getScheduledExecutorService in interface NodeScheduledExecutorService that this Node usespublic void executeCancellableLoop(CancellableLoop cancellableLoop)
NodeCancellableLoop using the Node's
ScheduledExecutorService. The CancellableLoop will be
canceled when the Node starts shutting down.
Any blocking calls executed in the provided CancellableLoop can
potentially delay Node shutdown and should be avoided.
executeCancellableLoop in interface NodecancellableLoop - the CancellableLoop to execute