Skip to content

It is an experiment repository to develop rosbridge for ROS2.0

License

Notifications You must be signed in to change notification settings

qiuzhong/ros2-web-bridge

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ros2-web-bridgeBuild Statusnpmlicense

NPM

Server Implementations of the rosbridge v2 Protocol

ros2-web-bridge, which leverages the rclnodejs client, provides a JSON interface to ROS 2.0 by adopting the rosbridge v2 protocol. The bridge can process commands through JSON tuneled over WebSockets.

Supported Clients

A client is a program that communicates with ros2-web-bridge using its JSON API. Clients include:

  • roslibjs - A JavaScript API, which communicates with ros2-web-bridge over WebSockets.

Install

1.Prepare for ROS2

Please reference the wiki to install ROS2.

2.Install Node.js You can install Node.js:

  • Download from Node.js offical website, and install it.
  • Use the Node Version Manager (nvm) to install it.

3.Install dependencies

npm install

Run Examples

1.Start ros2-web-bridge module:

node bin/rosbridge.js

2.Start the express server:

cd examples && node index.js

3.Open your browser, and navigate to URL:

http:https://localhost:3000/html/publisher.html

Known Issues

For the latest release of roslibjs (0.19.0), when sending command call_service to request the service, the type of service is not included which is a necessary parameter for ROS 2.0. So you have to transfer both the request and the type of service through args, please reference the code below:

let addTwoInts = new ROSLIB.Service({
  ros : ros,
  name : '/add_two_ints',
  serviceType : 'example_interfaces/AddTwoInts'
});

let request = new ROSLIB.ServiceRequest({
  a : 1,
  b : 2
});

let args = {request: request, type: 'example_interfaces/AddTwoInts'};
addTwoInts.callService(args, function(result) {
  console.log(`Receive result: ${result.sum}`);
});

Contributing

If you want to contribute code to this project, first you need to fork the project. The next step is to send a pull request (PR) for review. The PR will be reviewed by the project team members. Once you have gained "Look Good To Me (LGTM)", the project maintainers will merge the PR.

License

This project abides by Apache License 2.0.

About

It is an experiment repository to develop rosbridge for ROS2.0

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages

  • JavaScript 100.0%