Skip to content

RoboStack/roslibjs

This branch is 24 commits ahead of, 398 commits behind RobotWebTools/roslibjs:develop.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

0dd4f03 · Sep 27, 2021
Dec 14, 2020
Sep 27, 2021
Sep 27, 2021
Sep 27, 2021
Feb 26, 2021
Sep 27, 2021
Sep 27, 2021
Oct 20, 2014
Dec 8, 2014
Feb 28, 2020
Sep 9, 2015
Sep 27, 2021
Sep 27, 2021
Sep 27, 2021
Sep 27, 2021
Sep 25, 2021
Sep 25, 2021

Repository files navigation

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.

Packages

No packages published

Languages

  • TypeScript 60.9%
  • JavaScript 37.7%
  • Shell 1.4%