new Ros(options)
Manages connection to the server and all interactions with ROS.
Emits the following events:
- 'error' - There was an error with ROS.
- 'connection' - Connected to the WebSocket server.
- 'close' - Disconnected to the WebSocket server.
- <topicName> - A message came from rosbridge with the given topic name.
- <serviceID> - A service response came from rosbridge with the given ID.
Parameters:
Name | Type | Description | |||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
Properties
|
- Source:
Methods
authenticate(mac, client, dest, rand, t, level, end)
Send an authorization request to the server.
Parameters:
Name | Type | Description |
---|---|---|
mac |
string | MAC (hash) string given by the trusted source. |
client |
string | IP of the client. |
dest |
string | IP of the destination. |
rand |
string | Random string given by the trusted source. |
t |
Object | Time of the authorization request. |
level |
string | User level as a string given by the client. |
end |
Object | End time of the client's session. |
- Source:
callOnConnection(message)
Send the message over the WebSocket, but queue the message up if not yet connected.
Parameters:
Name | Type | Description |
---|---|---|
message |
Object | The message to be sent. |
- Source:
close()
Disconnect from the WebSocket server.
- Source:
connect(url)
Connect to the specified WebSocket.
Parameters:
Name | Type | Description |
---|---|---|
url |
string | WebSocket URL or RTCDataChannel label for rosbridge. |
- Source:
decodeTypeDefs(defs)
Decode a typedef array into a dictionary like rosmsg show foo/bar
.
Parameters:
Name | Type | Description |
---|---|---|
defs |
Array.<Object> | Array of type_def dictionary. |
- Source:
getActionServers(callback, failedCallbackopt)
Retrieve a list of action servers in ROS as an array of string.
Parameters:
Name | Type | Attributes | Description | ||||||
---|---|---|---|---|---|---|---|---|---|
callback |
function | Function with the following params: Properties
|
|||||||
failedCallback |
function |
<optional> |
The callback function when the service call failed with params: Properties
|
- Source:
getMessageDetails(message, callback, failedCallbackopt)
Retrieve the details of a ROS message.
Parameters:
Name | Type | Attributes | Description | ||||||
---|---|---|---|---|---|---|---|---|---|
message |
string | The name of the message type. |
|||||||
callback |
function | Function with the following params: Properties
|
|||||||
failedCallback |
function |
<optional> |
The callback function when the service call failed with params: Properties
|
- Source:
getNodeDetails(node, callback, failedCallbackopt)
Retrieve a list of subscribed topics, publishing topics and services of a specific node.
These are the parameters if failedCallback is defined.
Parameters:
Name | Type | Attributes | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
node |
string | Name of the node. |
|||||||||||||
callback |
function | Function with the following params: Properties
|
|||||||||||||
failedCallback |
function |
<optional> |
The callback function when the service call failed with params: Properties
|
- Source:
getNodeDetails(node, callback, failedCallbackopt)
Retrieve a list of subscribed topics, publishing topics and services of a specific node.
These are the parameters if failedCallback is undefined.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
node |
string | Name of the node. |
|||||||||||||||||||
callback |
function | Function with the following params: Properties
|
|||||||||||||||||||
failedCallback |
function |
<optional> |
The callback function when the service call failed with params: Properties
|
- Source:
getNodes(callback, failedCallbackopt)
Retrieve a list of active node names in ROS.
Parameters:
Name | Type | Attributes | Description | ||||||
---|---|---|---|---|---|---|---|---|---|
callback |
function | Function with the following params: Properties
|
|||||||
failedCallback |
function |
<optional> |
The callback function when the service call failed with params: Properties
|
- Source:
getParams(callback, failedCallbackopt)
Retrieve a list of parameter names from the ROS Parameter Server.
Parameters:
Name | Type | Attributes | Description | ||||||
---|---|---|---|---|---|---|---|---|---|
callback |
function | Function with the following params: Properties
|
|||||||
failedCallback |
function |
<optional> |
The callback function when the service call failed with params: Properties
|
- Source:
getServiceRequestDetails(type, callback, failedCallbackopt)
Retrieve the details of a ROS service request.
Parameters:
Name | Type | Attributes | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
type |
string | The type of the service. |
|||||||||||||
callback |
function | Function with the following params: Properties
|
|||||||||||||
failedCallback |
function |
<optional> |
The callback function when the service call failed with params: Properties
|
- Source:
getServiceResponseDetails(type, callback, failedCallbackopt)
Retrieve the details of a ROS service response.
Parameters:
Name | Type | Attributes | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
type |
string | The type of the service. |
|||||||||||||
callback |
function | Function with the following params: Properties
|
|||||||||||||
failedCallback |
function |
<optional> |
The callback function when the service call failed with params: Properties
|
- Source:
getServices(callback, failedCallbackopt)
Retrieve a list of active service names in ROS.
Parameters:
Name | Type | Attributes | Description | ||||||
---|---|---|---|---|---|---|---|---|---|
callback |
function | Function with the following params: Properties
|
|||||||
failedCallback |
function |
<optional> |
The callback function when the service call failed with params: Properties
|
- Source:
getServicesForType(serviceType, callback, failedCallbackopt)
Retrieve a list of services in ROS as an array as specific type.
Parameters:
Name | Type | Attributes | Description | ||||||
---|---|---|---|---|---|---|---|---|---|
serviceType |
string | The service type to find. |
|||||||
callback |
function | Function with the following params: Properties
|
|||||||
failedCallback |
function |
<optional> |
The callback function when the service call failed with params: Properties
|
- Source:
getServiceType(service, callback, failedCallbackopt)
Retrieve the type of a ROS service.
Parameters:
Name | Type | Attributes | Description | ||||||
---|---|---|---|---|---|---|---|---|---|
service |
string | Name of the service. |
|||||||
callback |
function | Function with the following params: Properties
|
|||||||
failedCallback |
function |
<optional> |
The callback function when the service call failed with params: Properties
|
- Source:
getTopics(callback, failedCallbackopt)
Retrieve a list of topics in ROS as an array.
Parameters:
Name | Type | Attributes | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
callback |
function | Function with the following params: Properties
|
||||||||||||||||
failedCallback |
function |
<optional> |
The callback function when the service call failed with params: Properties
|
- Source:
getTopicsAndRawTypes(callback, failedCallbackopt)
Retrieve a list of topics and their associated type definitions.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
callback |
function | Function with the following params: Properties
|
|||||||||||||||||||
failedCallback |
function |
<optional> |
The callback function when the service call failed with params: Properties
|
- Source:
getTopicsForType(topicType, callback, failedCallbackopt)
Retrieve a list of topics in ROS as an array of a specific type.
Parameters:
Name | Type | Attributes | Description | ||||||
---|---|---|---|---|---|---|---|---|---|
topicType |
string | The topic type to find. |
|||||||
callback |
function | Function with the following params: Properties
|
|||||||
failedCallback |
function |
<optional> |
The callback function when the service call failed with params: Properties
|
- Source:
getTopicType(topic, callback, failedCallbackopt)
Retrieve the type of a ROS topic.
Parameters:
Name | Type | Attributes | Description | ||||||
---|---|---|---|---|---|---|---|---|---|
topic |
string | Name of the topic. |
|||||||
callback |
function | Function with the following params: Properties
|
|||||||
failedCallback |
function |
<optional> |
The callback function when the service call failed with params: Properties
|
- Source:
sendEncodedMessage(messageEncoded)
Send an encoded message over the WebSocket.
Parameters:
Name | Type | Description |
---|---|---|
messageEncoded |
Object | The encoded message to be sent. |
- Source:
setStatusLevel(level, idopt)
Send a set_level request to the server.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
level |
string | Status level (none, error, warning, info). |
|
id |
number |
<optional> |
Operation ID to change status level on. |
- Source: