https://github.com/apostololeg/roslibjs-client
Wrapper around roslibjs
https://github.com/apostololeg/roslibjs-client
roslibjs
Last synced: 10 months ago
JSON representation
Wrapper around roslibjs
- Host: GitHub
- URL: https://github.com/apostololeg/roslibjs-client
- Owner: apostololeg
- Created: 2017-11-08T08:31:42.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-12-14T15:25:08.000Z (over 8 years ago)
- Last Synced: 2025-01-22T06:13:03.213Z (over 1 year ago)
- Topics: roslibjs
- Language: JavaScript
- Homepage:
- Size: 29.3 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
Roslibjs Client 🤖
====
This is a wrapper around the roslibjs package aiming to improve shortcomings of the original roslib package by introducing a fluent API as well as some useful error and fault handling mechanisms.
For the official roslibjs repository please head to [https://github.com/RobotWebTools/roslibjs](https://github.com/RobotWebTools/roslibjs)
Inspired by https://github.com/milvusrobotics/roslibjs-client
## Connect
[ROSLIB.Ros({...})](http://robotwebtools.org/jsdoc/roslibjs/current/Ros.html)
```js
const client = new RosClient({
url: 'ws://192.168.0.11:9090' // default
})
client.on('connected', () => {...})
client.on('disconnected', () => {...})
```
## Topic
`opts` - [ROSLIB.Topic({...})](http://robotwebtools.org/jsdoc/roslibjs/current/Topic.html)
`payload` - [ROSLIB.Message({...})](http://robotwebtools.org/jsdoc/roslibjs/current/Message.html)
```js
const topic = client.createTopic(opts) // instantiating
topic.publish(payload)
topic.subscribe(() => {...})
.dispose()
```
## Service
`opts` – [ROSLIB.Service({...})](http://robotwebtools.org/jsdoc/roslibjs/current/Service.html)
`payload` – [ROSLIB.ServiceRequest({...})](http://robotwebtools.org/jsdoc/roslibjs/current/ServiceRequest.html)
```js
client.callService(opts, payload)
```