RobotWebTools / rclnodejs

Node.js version of ROS 2.0 client
https://docs.ros.org/en/jazzy/Concepts/Basic/About-Client-Libraries.html#community-maintained
Apache License 2.0
335 stars 72 forks source link

[question] whats the targeted structure for integrating ROS2 into a website? #638

Closed flynneva closed 4 years ago

flynneva commented 4 years ago

So I'm trying to get familiar with the rclnodejs package.

I figured the best way to do this is to actually use it and try it out on a website.

I've added it successfully to my site and the "hello world ROS2" example works great locally...however once deployed I think it is only publishing it locally and not actually through the internet (probably a good thing to be honest).

I'm struggling to understand the "correct" structure of all the packages that the RobotWebTools team has developed for ROS2 and which packages are meant for the server side and which packages are meant for the client/browser side.

I've looked at this presentation already and it seems like I should've been using roslibjs instead on my site, and then rclnodejs locally on a computer.

What is the right way to integrate ROS2 into a website?

Could I use ros2-web-bridge on the host side to make the topics there available to anyone connected to the site? Or is this frowned upon/insecure for some reason?

Is roslibjs just meant for a UI/control of a robot remotely?

Could it potentially be used to remove the need for someone to install ROS/ROS2 locally on their system, kind of like an enhanced webviz type site?

Any help with understanding this would be greatly appreciated!

minggangw commented 4 years ago

Thanks for your questions, some points I know

What is the right way to integrate ROS2 into a website?

If you want to access ROS with browser only (no ROS env or Node.js), you have to use ros2-web-bridge (with ROS2 env) as a server and run roslibjs in a browser as a client.

Could I use ros2-web-bridge on the host side to make the topics there available to anyone connected to the site? Or is this frowned upon/insecure for some reason?

Theoretically, a client (browser) can connect any accessible endpoint through WebSockets (roslibjs and ros2-web-bridge communicate with).

Is roslibjs just meant for a UI/control of a robot remotely?

Not exactly, it doesn't offer UI elements (but ros2djs & ros3djs does), and it's a js library implements rosbridge v2 protocol which is also supported by ros2-web-bridge and expose ROS interfaces into the browser, so you could manipulate the robot through calling the functions of roslibjs.

Could it potentially be used to remove the need for someone to install ROS/ROS2 locally on their system, kind of like an enhanced webviz type site?

roslibjs could achieve this aim, but you have to setup a ros2-web-bridge for the front-end finally.