Caution
This API has been retired since API level 23.
This API has been retired since API level 23.
Allows an app on a webOS device to communicate with a service running on a ROS 2 device.
Supported Functionality:
Note:
NA
API level 11
API level 23
Calls service in ROS 2 world.
Name | Required | Type | Description |
---|---|---|---|
name | Required | String | Name of ROS 2 message. |
type | Required | String | ROS 2 type name. |
message | Required | Object | ROS 2 message. The JSON schema depends on ROS 2 message structure. |
Name | Required | Type | Description |
---|---|---|---|
returnValue | Required | Boolean | Indicates the status of operation. Possible values are:
|
errorText | Optional | String | Indicates the reason for the failure of the operation. See the "API Error Codes Reference" section for details. |
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
}
API level 11
API level 23
Publishes topic message from LS2 (webOS luna bus) to ROS 2.
Name | Required | Type | Description |
---|---|---|---|
name | Required | String | Name of ROS 2 message. |
type | Required | String | ROS 2 type name. |
message | Required | Object | ROS 2 message. The JSON schema depends on the ROS 2 message structure. |
Name | Required | Type | Description |
---|---|---|---|
returnValue | Required | Boolean | Indicates the status of operation. Possible values are:
|
errorText | Optional | String | Indicates the reason for the failure of the operation. See the "API Error Codes Reference" section for details. |
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 level 11
API level 23
Subscribe topic message from ROS 2 world.
Name | Required | Type | Description |
---|---|---|---|
name | Required | String | Name of ROS 2 message. |
type | Required | String | ROS 2 type name. |
subscribe | Required | Boolean | Subscribe for notifications. This should always to be to true. |
Name | Required | Type | Description |
---|---|---|---|
returnValue | Required | Boolean | Indicates the status of operation. Possible values are:
|
subscribed | Required | Boolean | Indicates if subscribed to get notified. This will always be true. |
errorText | Optional | String | Indicates the reason for the failure of the operation. See the "API Error Codes Reference" section for details. |
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
}
Error Code | Error Text | Error Description |
---|---|---|
None | Invalid 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. |
None | Cannot create ros client | ROS world error. |
Contents