{"id":21077385,"url":"https://github.com/ros2jsguy/ros2pkg_configure_nodejs","last_synced_at":"2025-03-14T04:10:43.922Z","repository":{"id":94000448,"uuid":"320159905","full_name":"ros2jsguy/ros2pkg_configure_nodejs","owner":"ros2jsguy","description":"A ros2cli plugin to configure a ROS2 package as a Node.js package.","archived":false,"fork":false,"pushed_at":"2020-12-11T19:56:48.000Z","size":15,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-20T23:14:43.487Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ros2jsguy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2020-12-10T04:33:10.000Z","updated_at":"2021-07-17T11:14:19.000Z","dependencies_parsed_at":null,"dependency_job_id":"b57929a9-0170-4601-96b6-d712cb8113b5","html_url":"https://github.com/ros2jsguy/ros2pkg_configure_nodejs","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ros2jsguy%2Fros2pkg_configure_nodejs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ros2jsguy%2Fros2pkg_configure_nodejs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ros2jsguy%2Fros2pkg_configure_nodejs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ros2jsguy%2Fros2pkg_configure_nodejs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ros2jsguy","download_url":"https://codeload.github.com/ros2jsguy/ros2pkg_configure_nodejs/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243521281,"owners_count":20304186,"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":[],"created_at":"2024-11-19T19:36:17.936Z","updated_at":"2025-03-14T04:10:43.898Z","avatar_url":"https://github.com/ros2jsguy.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ros2pkg_configure_nodejs\n**ros2pkg_configure_nodejs** is an extension, i.e., plugin, for the `ros2 pkg` CLI command that simplifies the implementation of ROS2 packages in JavaScript or TypeScript. The plugin extends an existing ROS2 package by scaffolding onto it customized Node.js artifacts, examples and updated installation scripts. **The result is a ROS2-Node.js package that can coexist and participate with other packages in a ROS2 workspace and can be run using the ROS2 `launch` facility.**\n\n## Key Features\n* Customizes and overlays Node.js resources onto ROS2 ament_cmake and cmake packages.\n* Creates a package.json based on ROS2 package.xml Manifest\n* `--typescript` commandline option to configure the package for use with TypeScript.\n* Includes the ROS2 JavaScript client, \n[rclnodejs](https://github.com/RobotWebTools/rclnodejs) as a runtime dependency.\n* Creates an example launch-description.\n* Updates CMakeList.txt install() rules to install key runtime files to the package share/ folder\n* Example JavaScript/TypeScript ROS2 publisher node.\n\n## Prerequisites\n* ROS2 Foxy or greater installed\n* Node.js version 12 or 13\n* npm or yarn package manager\n\n## Getting Started\n\n### 1. Clone and Build ros2pkg_configure_nodejs\nThis is a new ROS2 package and not yet part of a formal ROS2 distribution. At some point in the future I hope to see that happen. Until then you will need to clone and build this GIT repository - a 1 minute task.\n\nFrom a command shell `cd` into a directory that will contain this package. Then enter the following commands:\n```\ngit clone https://github.com/ros2jsguy/ros2pkg_configure_nodejs.git\ncd ros2pkg_configure_nodejs\ncolcon build\n```\nNext let's add the newly built ros2pkg_configure_nodejs package to our ROS2 environment. Do this by running the `install/setup.[bash|bat|sh|ps1]` file for your environment. For background on configuring your ROS2 environement see this [tutorial](https://index.ros.org/doc/ros2/Tutorials/Configuring-ROS2-Environment/).\n\nIn my Linux environment I run this command:\n```\nsource install/setup.bash\n```\nFor future convience consider including the setup.[bat|bash|ps1] in your login script.\n\nLet's verify that ros2pkg_configure_nodejs is installed properly:\nEnter this command and observe the output.\n```\nros2 pkg -h\n```\nYou should see `configure_nodejs` in the Commands list similar to the output shown below.\n```\nusage: ros2 pkg [-h] Call `ros2 pkg \u003ccommand\u003e -h` for more detailed usage. ...\n\nVarious package related sub-commands\n\noptional arguments:\n  -h, --help            show this help message and exit\n\nCommands:\n  configure_nodejs  Configure ROS2 package as Node.js package\n  create       Create a new ROS2 package\n  executables  Output a list of package specific executables\n  list         Output a list of available packages\n  prefix       Output the prefix path of a package\n  xml          Output the XML of the package manifest or a specific tag\n\n  Call `ros2 pkg \u003ccommand\u003e -h` for more detailed usage.\n```\n\n### 2. Create ROS2 Package and Configure it as a Node.js Package\nIn this section we will create a basic ROS2 package and then configuring it as a Node.js package.\n\nFrom your command shell `cd` to a directory that will contain the ROS2 package we will create. \n\nFor this tutorial we will name our ROS2 package `ros2_nodejs`. See [ROS2 Patterns and Conventions](http://wiki.ros.org/ROS/Patterns/Conventions) for naming practices.\n\nEnter the following commands:\n```\nros2 pkg create ros2_nodejs\ncd ros2_nodejs\nros2 pkg configure_nodejs\n```\nThe ros2_nodejs directory content should be similar to this listing.\n```\nCMakeLists.txt\n__init__.py\njsconfig.json\nlaunch/\n  example.launch.py\nnode_modules/\npackage.json\npackage.xml\nsrc/\n  index.js\n```\n\nNow let's build the package using the `colcon` build utility. This will install the key JavaScript resources into the share/ folder.\n```\ncolcon build\n```\nYour package folder will now include the standard ROS2 package directories: `build/`, `install/` and `log/`. The `install/' directory includes configuration scripts and if you look deep to `install/ros2_nodejs/share/ros2_nodejs` you will see the `install()` rules added to the CMakeLists.txt have installed the key JavaScript resources from the `src/` and `launch/` directories.\n\nLastly, add your new ros2_nodejs package to your ROS environment. \n\nFrom your command shell enter:\n```\nsource install/setup.bash\n```\nVerify that the ros2_nodejs package is part of your ROS2 environment using the `ros2` CLI command. \n```\nros2 pkg list\n```\nThis command will output a long list of the packages in your ROS2 environment. Scroll through the list and verify it contains the ros2_nodejs package.\n\n### 3. Launch example.launch.py\nWe can now use the `ros2 launch` command to run the `example.launch.py` launch-description. This launch file defines how to startup the example app in our ros2_nodejs package. The example app creates a ROS2 node and publisher that sends a message every second to the topic named `foo`. See `src/index.js` in the ros2_nodejs package for details of the JavaScript implementation.\n```\nros2 launch ros2_nodejs example.launch.py\n```\nTo view the messages being published to the `foo` topic, open a separate command shell configured with your ROS2 environment and enter:\n```\nros2 topic echo foo\n```\nA message should appear every second.\n\n## Working With Typescript\nIf you would like to work with TypeScript instead of JavaScript use the `--typescript` commandline option as shown below.\n```\nros2 pkg configure_nodejs --typescript\n```\nThe plugin will include a tsconfig.json file and a TypeScript example at `src/index.ts`.\n\n# Getting Help / Providing Feedback\nPlease post bug reports, feature requests and general discussion topics to the [ros2pkg_configure_nodejs project on github](https://github.com/ros2jsguy/ros2pkg_configure_nodejs).\n\n# Thanks\nA special thanks to the rclnodejs team for developing the [rclnodejs, the ROS2 JavaScript SDK](https://github.com/RobotWebTools/rclnodejs) and supporting JavaScript in robotics.\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fros2jsguy%2Fros2pkg_configure_nodejs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fros2jsguy%2Fros2pkg_configure_nodejs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fros2jsguy%2Fros2pkg_configure_nodejs/lists"}