{"id":13799914,"url":"https://github.com/RobotWebTools/rclnodejs","last_synced_at":"2025-05-13T08:32:14.678Z","repository":{"id":37791624,"uuid":"91813233","full_name":"RobotWebTools/rclnodejs","owner":"RobotWebTools","description":"Node.js version of ROS 2.0 client ","archived":false,"fork":false,"pushed_at":"2025-05-06T08:01:11.000Z","size":3926,"stargazers_count":360,"open_issues_count":37,"forks_count":75,"subscribers_count":24,"default_branch":"develop","last_synced_at":"2025-05-08T18:47:01.046Z","etag":null,"topics":["client","javascript","nodejs","rcl","robotics","ros","ros2","typescript"],"latest_commit_sha":null,"homepage":"https://docs.ros.org/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RobotWebTools.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"docs/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2017-05-19T14:17:20.000Z","updated_at":"2025-05-06T09:56:09.000Z","dependencies_parsed_at":"2023-11-16T04:25:51.791Z","dependency_job_id":"6c963588-99de-448f-9b58-fde8c8f331ab","html_url":"https://github.com/RobotWebTools/rclnodejs","commit_stats":{"total_commits":562,"total_committers":25,"mean_commits":22.48,"dds":0.3736654804270463,"last_synced_commit":"83958f4a93c2b70bdb51a48a45e5b02cd5821fd5"},"previous_names":[],"tags_count":76,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RobotWebTools%2Frclnodejs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RobotWebTools%2Frclnodejs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RobotWebTools%2Frclnodejs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RobotWebTools%2Frclnodejs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RobotWebTools","download_url":"https://codeload.github.com/RobotWebTools/rclnodejs/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253903893,"owners_count":21981766,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["client","javascript","nodejs","rcl","robotics","ros","ros2","typescript"],"created_at":"2024-08-04T00:01:07.152Z","updated_at":"2025-05-13T08:32:14.672Z","avatar_url":"https://github.com/RobotWebTools.png","language":"JavaScript","funding_links":[],"categories":["Packages","JavaScript"],"sub_categories":["\"System\" bindings"],"readme":"# rclnodejs - The ROS 2 Client Library for JavaScript\n\n[![npm](https://img.shields.io/npm/v/rclnodejs.svg)](https://www.npmjs.com/package/rclnodejs)[![Coverage Status](https://coveralls.io/repos/github/RobotWebTools/rclnodejs/badge.svg?branch=develop)](https://coveralls.io/github/RobotWebTools/rclnodejs?branch=develop)[![npm](https://img.shields.io/npm/dm/rclnodejs)](https://www.npmjs.com/package/rclnodejs)[![GitHub license](https://img.shields.io/github/license/RobotWebTools/rclnodejs.svg)](https://github.com/RobotWebTools/rclnodejs/blob/develop/LICENSE)[![node](https://img.shields.io/node/v/rclnodejs.svg)](https://nodejs.org/en/download/releases/)[![npm type definitions](https://img.shields.io/npm/types/rclnodejs)](https://www.npmjs.com/package/rclnodejs)[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)\n\n| **ROS Distro\\*** |                                                                                                                                       **Linux**                                                                                                                                       |                                                                                                                                        **Windows**                                                                                                                                        |\n| :--------------: | :-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: |\n|      Jazzy       |            [![rclnodejs - Linux Build and Test](https://github.com/RobotWebTools/rclnodejs/actions/workflows/linux-build-and-test.yml/badge.svg?branch=jazzy)](https://github.com/RobotWebTools/rclnodejs/actions/workflows/linux-build-and-test.yml?query=branch%3Ajazzy)            |            [![rclnodejs - Windows Build \u0026 Test](https://github.com/RobotWebTools/rclnodejs/actions/workflows/windows-build-and-test.yml/badge.svg?branch=jazzy)](https://github.com/RobotWebTools/rclnodejs/actions/workflows/windows-build-and-test.yml?query=branch%3Ajazzy)            |\n|      Humble      | [![rclnodejs - Linux Build and Test](https://github.com/RobotWebTools/rclnodejs/actions/workflows/linux-build-and-test.yml/badge.svg?branch=humble-hawksbill)](https://github.com/RobotWebTools/rclnodejs/actions/workflows/linux-build-and-test.yml?query=branch%3Ahumble-hawksbill) | [![rclnodejs - Windows Build \u0026 Test](https://github.com/RobotWebTools/rclnodejs/actions/workflows/windows-build-and-test.yml/badge.svg?branch=humble-hawksbill)](https://github.com/RobotWebTools/rclnodejs/actions/workflows/windows-build-and-test.yml?query=branch%3Ahumble-hawksbill) |\n\n\\* rclnodejs development and maintenance is limited to the ROS 2 LTS releases and the Rolling development branch\n\n**rclnodejs** is a Node.js client library for the Robot Operating System\n([ROS 2](https://www.ros.org/)). It provides tooling and comprehensive\nJavaScript and TypeScript APIs for developing ROS 2 solutions capable of\ninteroperating with ROS 2 nodes implemented in other languages such as\nC++ and Python.\n\nHere's an example for creating a ROS 2 node that publishes a string message in a few lines of JavaScript.\n\n```JavaScript\nconst rclnodejs = require('rclnodejs');\nrclnodejs.init().then(() =\u003e {\n  const node = new rclnodejs.Node('publisher_example_node');\n  const publisher = node.createPublisher('std_msgs/msg/String', 'topic');\n  publisher.publish(`Hello ROS 2 from rclnodejs`);\n  node.spin();\n});\n```\n\n## Documentation\n\n- [Installation](#installation)\n- [rclnodejs-cli](#rclnodejs-cli)\n- [API Documentation](#api-documentation)\n- [Using TypeScript](#using-rclnodejs-with-typescript)\n- [Examples](https://github.com/RobotWebTools/rclnodejs/tree/develop/example)\n- [Electron demo](https://github.com/RobotWebTools/rclnodejs/tree/develop/electron_demo)\n- [Efficient Usage Tips](./docs/EFFICIENCY.md)\n- [FAQ and Known Issues](./docs/FAQ.md)\n- [Building from Scratch](./docs/BUILDING.md)\n- [Contributing](./docs/CONTRIBUTING.md)\n\n## Installation\n\n### Prerequisites\n\nBefore installing `rclnodejs` please ensure the following software is installed and configured on your system:\n\n- [Nodejs](https://nodejs.org/en/) version \u003e= 16.13.0.\n\n- [ROS 2 SDK](https://docs.ros.org/en/jazzy/Installation.html) for details.\n  **DON'T FORGET TO [SOURCE THE ROS 2 SETUP FILE](https://docs.ros.org/en/jazzy/Tutorials/Beginner-CLI-Tools/Configuring-ROS2-Environment.html#source-the-setup-files)**\n\n### Installing rclnodejs\n\nInstall the rclnodejs version that is compatible with your version of ROS 2 (see table below).\n\nFor the most current version of rclnodejs run:\n\n```bash\nnpm i rclnodejs\n```\n\nTo install a specific version of rclnodejs use:\n\n```bash\nnpm i rclnodejs@x.y.z\n```\n\n- **Note:** to install rclnodejs from GitHub: add `\"rclnodejs\":\"RobotWebTools/rclnodejs#\u003cbranch\u003e\"` to your `package.json` dependency section.\n\n## rclnodejs-cli\n\n[rclnodejs-cli](https://github.com/RobotWebTools/rclnodejs-cli/) is a companion project we recently launched to provide a commandline interface to a set of developer tools for working with this `rclnodejs`. You may find `rclnodejs-cli` particularly useful if you plan to create ROS 2 node(s) and launch files for working with multiple node orchestrations.\n\n```\n           _                 _       _\n  _ __ ___| |_ __   ___   __| | ___ (_)___\n | '__/ __| | '_ \\ / _ \\ / _` |/ _ \\| / __|\n | | | (__| | | | | (_) | (_| |  __/| \\__ \\\n |_|  \\___|_|_| |_|\\___/ \\__,_|\\___|/ |___/\n                                  |__/\nUsage: rclnodejs [command] [options]\n\nOptions:\n  -h, --help                               display help for command\n\nCommands:\n  create-package [options] \u003cpackage-name\u003e  Create a ROS2 package for Nodejs development.\n  generate-ros-messages                    Generate JavaScript code from ROS2 IDL interfaces\n  help [command]                           display help for command\n```\n\n## API Documentation\n\nAPI documentation is generated by `jsdoc` and can be viewed in the `docs/` folder or [online doc](https://robotwebtools.github.io/rclnodejs/docs/index.html). To create a local copy of the documentation run `npm run docs`.\n\n## Using rclnodejs with TypeScript\n\n`rclnodejs` API can be used in TypeScript projects. You can find the TypeScript declaration files (\\*.d.ts) in the `types/` folder.\n\nYour `tsconfig.json` file should include the following compiler options:\n\n```jsonc\n{\n  \"compilerOptions\": {\n    \"module\": \"commonjs\",\n    \"moduleResolution\": \"node\",\n    \"target\": \"es6\",\n    // your additional options here\n  },\n}\n```\n\nHere's a short `rclnodejs` TypeScript example:\n\n```typescript\nimport * as rclnodejs from 'rclnodejs';\nrclnodejs.init().then(() =\u003e {\n  const node = new rclnodejs.Node('publisher_example_node');\n  const publisher = node.createPublisher('std_msgs/msg/String', 'topic');\n  publisher.publish(`Hello ROS 2 from rclnodejs`);\n  node.spin();\n});\n```\n\nThe benefits of using TypeScript become evident when working with more complex use-cases. ROS messages are defined in the `types/interfaces.d.ts` module. This module is updated as part of the `generate-ros-messages` process described in the next section.\n\n## ROS2 Interface Message Generation (important)\n\nROS components communicate by sending and receiving messages described\nby the interface definition language (IDL). ROS client libraries such as\nrclnodejs are responsible for converting these IDL message descriptions\ninto source code of their target language. For this, rclnodejs provides\nthe npm binary`generate-ros-messages` script that reads the IDL\nmessage files of a ROS environment and generates corresponding JavaScript\nmessage interface files. Additionally, the tool generates the TypeScript\n`interface.d.ts` file containing declarations for each IDL message file.\n\nLearn more about ROS interfaces and IDL [here](https://docs.ros.org/en/jazzy/Concepts/Basic/About-Interfaces.html).\n\nIn the following example rclnodejs loads a generated JavaScript message file corresponding to the ROS `std_msgs/msg/String' definition.\n\n```\nimport * as rclnodejs from 'rclnodejs';\nlet stringMsgObject = rclnodejs.createMessageObject('std_msgs/msg/String');\nstringMsgObject.data = 'hello world';\n```\n\n### Maintaining Generated JavaScript Message Files\n\nMessage files are generated as a post-install step of the rclnodejs\ninstallation process. Thereafter, you will need to manually run the\nrclnodejs message generation script when new ROS message packages are installed\nfor which your ROS2-nodejs project has a dependency.\n\n### Running `generate-ros-messages` Utility\n\nTo run the `generate-ros-messages` script from your Nodejs package, use the `npx` utility included in your Nodejs installation.\n\n```\nnpx generate-ros-messages\n```\n\nThe newly generated JavaScript files can be found at\n`\u003cyourproject\u003e/node_modules/rclnodejs/generated/`.\n\n## Contributing\n\nPlease read the [Contributing Guide]() before making a pull request.\n\nThank you to all the [people](CONTRIBUTORS.md) who already contributed to rclnodejs!\n\n\u003cdiv\u003e\n\u003ca href=\"https://github.com/wayneparrott\"\u003e\n  \u003cimg src=\"https://github.com/wayneparrott.png\" width=\"30\"\u003e\n\u003c/a\u003e\n\u003ca href=\"https://github.com/koonpeng\"\u003e\n  \u003cimg src=\"https://github.com/koonpeng.png\" width=\"30\"\u003e\n\u003c/a\u003e\n\u003ca href=\"https://github.com/mattrichard\"\u003e\n  \u003cimg src=\"https://github.com/mattrichard.png\" width=\"30\"\u003e\n\u003c/a\u003e\n\u003ca href=\"https://github.com/felixdivo\"\u003e\n  \u003cimg src=\"https://github.com/felixdivo.png\" width=\"30\"\u003e\n\u003c/a\u003e\n\u003ca href=\"https://github.com/martins-mozeiko\"\u003e\n  \u003cimg src=\"https://github.com/martins-mozeiko.png\" width=\"30\"\u003e\n\u003c/a\u003e\n\u003ca href=\"https://github.com/amikhalev\"\u003e\n  \u003cimg src=\"https://github.com/amikhalev.png\" width=\"30\"\u003e\n\u003c/a\u003e\n\u003ca href=\"https://github.com/kenny-y\"\u003e\n  \u003cimg src=\"https://github.com/kenny-y.png\" width=\"30\"\u003e\n\u003c/a\u003e\n\u003ca href=\"https://github.com/qiuzhong\"\u003e\n  \u003cimg src=\"https://github.com/qiuzhong.png\" width=\"30\"\u003e\n\u003c/a\u003e\n\u003ca href=\"https://github.com/minggangw\"\u003e\n  \u003cimg src=\"https://github.com/minggangw.png\" width=\"30\"\u003e\n\u003c/a\u003e\n\u003ca href=\"https://github.com/hanyia\"\u003e\n  \u003cimg src=\"https://github.com/hanyia.png\" width=\"30\"\u003e\n\u003c/a\u003e\n\u003c/div\u003e\n\n## License\n\nThis project abides by the [Apache License 2.0](https://github.com/RobotWebTools/rclnodejs/blob/develop/LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FRobotWebTools%2Frclnodejs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FRobotWebTools%2Frclnodejs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FRobotWebTools%2Frclnodejs/lists"}