com.webos.service.rosbridge

Caution
This API has been retired since API level 23.

API Summary

Allows an app on a webOS device to communicate with a service running on a ROS 2 device.

ROS2 bridge overview

Supported Functionality:  

  • webOS web app can subscribe/publish topic to ROS 2.
  • webOS web app can call service in ROS 2. 
  • Currently, only client-specific APIs are supported.

Note: 

  • ROS (Robot Operating System) is a popular robot platform that provides services to build robot applications.
  • Currently, this service is compatible with only ROS 2 supported devices. 

Overview of the API

NA 

Methods

call

ACG: rosbridge.service
Retired
  • Added: API level 11
  • Retired: API level 23

Description

Calls service in ROS 2 world.

Parameters

Name

Required

Type

Description

nameRequiredString

Name of ROS 2 message.

typeRequiredString

ROS 2 type name.

messageRequiredObject

ROS 2 message.

The JSON schema depends on ROS 2 message structure.

Call Returns

Name

Required

Type

Description

returnValueRequiredBoolean

Indicates the status of operation. Possible values are:

  • true - Indicates that the operation was successful.
  • false - Indicates that the operation failed. Check the "errorText" field for details.
errorTextOptionalString

Indicates the reason for the failure of the operation. See the "API Error Codes Reference" section for details.

Example

Example scenario

// Run test service
# ros2 run demo_nodes_cpp add_two_ints_server

// Call service by rosbridge
# luna-send -n 1 -f luna://com.webos.service.rosbridge/call '{ "name":"add_two_ints", "type":"example_interfaces/srv/AddTwoInts", "message": { "a": 100, "b": 200} }'
{
    "sum": 300
}

publish

ACG: rosbridge.topic
Retired
  • Added: API level 11
  • Retired: API level 23

Description

Publishes topic message from LS2 (webOS luna bus) to ROS 2.

Parameters

Name

Required

Type

Description

nameRequiredString

Name of ROS 2 message.

typeRequiredString

ROS 2 type name.

messageRequiredObject

ROS 2 message.

The JSON schema depends on the ROS 2 message structure.

Call Returns

Name

Required

Type

Description

returnValueRequiredBoolean

Indicates the status of operation. Possible values are:

  • true - Indicates that the operation was successful.
  • false - Indicates that the operation failed. Check the "errorText" field for details.
errorTextOptionalString

Indicates the reason for the failure of the operation. See the "API Error Codes Reference" section for details.

Example

Example scenario

// Console
# luna-send -i -f luna://com.webos.service.rosbridge/subscribe '{ "name":"topic_test", "type":"std_msgs/msg/String", "subscribe":true }'
{
    "subscribed": true
}
{
    "data": "hello"
}

// Another console
# luna-send -n 1 -f luna://com.webos.service.rosbridge/publish '{ "name":"topic_test", "type":"std_msgs/msg/String", "message":"hello" }'
{
    "returnValue": true
}

subscribe

ACG: rosbridge.topic
Retired
  • Added: API level 11
  • Retired: API level 23

Description

Subscribe topic message from ROS 2 world.

Parameters

Name

Required

Type

Description

nameRequiredString

Name of ROS 2 message.

typeRequiredString

ROS 2 type name.

subscribeRequiredBoolean

Subscribe for notifications. This should always to be to true. 

Call Returns

Name

Required

Type

Description

returnValueRequiredBoolean

Indicates the status of operation. Possible values are:

  • true - Indicates that the operation was successful.
  • false - Indicates that the operation failed. Check the "errorText" field for details.
subscribedRequiredBoolean

Indicates if subscribed to get notified. This will always be true.

errorTextOptionalString

Indicates the reason for the failure of the operation. See the "API Error Codes Reference" section for details.

Example

Example scenario

// Console
# luna-send -i -f luna://com.webos.service.rosbridge/subscribe '{ "name":"topic_test", "type":"std_msgs/msg/String", "subscribe":true }'
{
    "subscribed": true
}
{
    "data": "hello"
}

// Another console
# luna-send -n 1 -f luna://com.webos.service.rosbridge/publish '{ "name":"topic_test", "type":"std_msgs/msg/String", "message":"hello" }'
{
    "returnValue": true
}

API Error Codes Reference

Error Code

Error Text

Error Description

NoneInvalid JSON format

Invalid JSON format

None'subscribe' should be 'true'

Subscribe API only supports subscription call.

If there is no subscribe parameter, this errorText will be returned.

None'type' is required parameter

If there is no 'type' parameter in request payload.

None'name' is required parameter

If there is no 'name' parameter in request payload.

None'message' is required parameter

If there is no 'message' parameter in request payload.

NoneCannot create ros client

ROS world error.

Contents