Skip to content

Latest commit

 

History

History
75 lines (62 loc) · 2.4 KB

README.md

File metadata and controls

75 lines (62 loc) · 2.4 KB

roslibjs

The Standard ROS JavaScript Library

devDependencies Status dependencies Status devDependencies Status

This project is a maintained fork of the original Roslibjs library

Installation

npm install --save @robostack/roslib

You can also use the CDN version directly in the browser.
Note: The library relies on ES modules, any script that references it must use type="module"

<script type="module">
   import * as ROSLIB from "https://cdn.jsdelivr.net/npm/@robostack/roslib/build/roslib.js"
</script>

Local development

  • Install dependencies: npm install
  • Build and watch the code for changes: npm start
  • In a new terminal, run the examples: npm run examples
  • Open http://localhost:8000/examples/simple to see the examples
  • Better documentation for the available Classes

Usage

The code below lets you connect to a remote Rosbridge endpoint. Other common examples and code snippets can be found in the examples folder

import { Ros } from '@robostack/roslib';
const ros = new Ros();

ros.on('error', (error) => {
  console.log(error);
});

ros.on('connection', () => {
  console.log('Connection successful!');
});

ros.on('close', () => {
  console.log('Connection closed.');
});

ros.connect('ws://localhost:9090');

Overview of functionality

Ros

  • Connect, disconnect to a remote Rosbridge endpoint
  • Get the list of topics, services, params

Topics

  • Subscribe, unsubscribe, publish, advertise and unadvertise a topic

Params

  • Get, set and delete the value of a param

Services

  • Advertise a service, call a service

Planned improvements

  • Add examples with a working Websocket endpoint
  • Verify and update tests
  • Check and fix working with node.js
  • Add better documentation
  • Fix typescript types

API

Detailed API documentation for class methods is available in the docs folder

License

roslibjs is released with a BSD license. For full terms and conditions, see the LICENSE file.

Authors

See the AUTHORS.md file for a full list of contributors.