Skip to content

Commit

Permalink
deploy: 08f8eb0
Browse files Browse the repository at this point in the history
  • Loading branch information
fuzzypixelz committed Sep 30, 2024
1 parent a788bfd commit 6f3c22d
Show file tree
Hide file tree
Showing 16 changed files with 28 additions and 27 deletions.
2 changes: 1 addition & 1 deletion blog/2021-04-28-ros2-integration/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
</span></span><span style=display:flex><span><span style=color:#09f;font-style:italic># Make it move forward until it hits the wall!!</span>
</span></span><span style=display:flex><span>session<span style=color:#555>.</span>put(<span style=color:#c30>&#39;rt/turtle1/cmd_vel&#39;</span>, t)
</span></span><span style=display:flex><span>session<span style=color:#555>.</span>put(<span style=color:#c30>&#39;rt/turtle1/cmd_vel&#39;</span>, t)
</span></span></code></pre></div></li></ol><p>You can see more complete versions of a &ldquo;teleop&rdquo; code with various options and arrows key-pressed listener here:</p><ul><li>in Python: <a href=https://github.com/eclipse-zenoh/zenoh-demos/tree/master/ROS2/zenoh-python-teleop>https://github.com/eclipse-zenoh/zenoh-demos/tree/master/ROS2/zenoh-python-teleop</a></li><li>in Rust: <a href=https://github.com/eclipse-zenoh/zenoh-demos/tree/master/ROS2/zenoh-rust-teleop>https://github.com/eclipse-zenoh/zenoh-demos/tree/master/ROS2/zenoh-rust-teleop</a></li></ul><hr><h2 id=how-do-i-use-zenoh-to-operate-my-robot-from-anywhere-in-the-world->How do I use zenoh to operate my robot from anywhere in the world ?</h2><p>In the scenario described above, the zenoh application discovers the zenoh/DDS bridge via its scouting protocol that leverages UDP multicast - when available. Once discovered, a TCP connection is established between the app and the bridge</p><p><img src=../../img/blog-RO2-integration/multicast-discovery.png alt="multicast discovery"></p><p>But the zenoh application can also be configured to directly establish a TCP connection with a known host, without relying on scouting protocol. Thus, it can connect directly to the bridge (if reachable) or to 1 or more zenoh routers that will route the zenoh communications between the application and the bridge.</p><p>Let&rsquo;s see the different use cases:</p><h3 id=1-opening-a-tcp-port-and-redirecting-it-to-the-zenohdds-bridge>1. Opening a TCP port and redirecting it to the zenoh/DDS bridge</h3><p>Assuming you can configure your internet connection to open a public TCP port (e.g. 7447) and redirect it to the host running the zenoh/DDS bridge, you can do the following deployment:</p><p><img src=../../img/blog-RO2-integration/open-port.png alt="open port"></p><p>Where:</p><ul><li><p>the zenoh/DDS bridge is started with this command:</p><div class=highlight><pre tabindex=0 style=background-color:#f0f3f3;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-shell data-lang=shell><span style=display:flex><span>zenoh-bridge-dds -m peer -l tcp/0.0.0.0:7447
</span></span></code></pre></div></li></ol><p>You can see more complete versions of a &ldquo;teleop&rdquo; code with various options and arrows key-pressed listener here:</p><ul><li>in Python: <a href=https://github.com/eclipse-zenoh/zenoh-demos/tree/main/ROS2/zenoh-python-teleop>https://github.com/eclipse-zenoh/zenoh-demos/tree/main/ROS2/zenoh-python-teleop</a></li><li>in Rust: <a href=https://github.com/eclipse-zenoh/zenoh-demos/tree/main/ROS2/zenoh-rust-teleop>https://github.com/eclipse-zenoh/zenoh-demos/tree/main/ROS2/zenoh-rust-teleop</a></li></ul><hr><h2 id=how-do-i-use-zenoh-to-operate-my-robot-from-anywhere-in-the-world->How do I use zenoh to operate my robot from anywhere in the world ?</h2><p>In the scenario described above, the zenoh application discovers the zenoh/DDS bridge via its scouting protocol that leverages UDP multicast - when available. Once discovered, a TCP connection is established between the app and the bridge</p><p><img src=../../img/blog-RO2-integration/multicast-discovery.png alt="multicast discovery"></p><p>But the zenoh application can also be configured to directly establish a TCP connection with a known host, without relying on scouting protocol. Thus, it can connect directly to the bridge (if reachable) or to 1 or more zenoh routers that will route the zenoh communications between the application and the bridge.</p><p>Let&rsquo;s see the different use cases:</p><h3 id=1-opening-a-tcp-port-and-redirecting-it-to-the-zenohdds-bridge>1. Opening a TCP port and redirecting it to the zenoh/DDS bridge</h3><p>Assuming you can configure your internet connection to open a public TCP port (e.g. 7447) and redirect it to the host running the zenoh/DDS bridge, you can do the following deployment:</p><p><img src=../../img/blog-RO2-integration/open-port.png alt="open port"></p><p>Where:</p><ul><li><p>the zenoh/DDS bridge is started with this command:</p><div class=highlight><pre tabindex=0 style=background-color:#f0f3f3;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-shell data-lang=shell><span style=display:flex><span>zenoh-bridge-dds -m peer -l tcp/0.0.0.0:7447
</span></span></code></pre></div><p>The <code>-l</code> option makes the bridge to listen for TCP connection on port 7447.</p></li><li><p>Our zenoh teleop application must be configured to connect to the public IP and port of the bridge.<br>In Python, this is done adding a <code>"peer"</code> configuration when initializing the API:</p><div class=highlight><pre tabindex=0 style=background-color:#f0f3f3;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-python data-lang=python><span style=display:flex><span><span style=color:#09f;font-style:italic># note: replace &#34;123.4.5.6&#34; with your public IP in here:</span>
</span></span><span style=display:flex><span>session <span style=color:#555>=</span> zenoh<span style=color:#555>.</span>net<span style=color:#555>.</span>open({<span style=color:#c30>&#34;peer&#34;</span>: <span style=color:#c30>&#34;tcp/123.4.5.6:7447&#34;</span>})
</span></span></code></pre></div><p>With the &ldquo;teleop&rdquo; demos provided <a href=https://github.com/atolab/zenoh-demo/tree/main/ROS2>here</a>, you can use the <code>-e tcp/123.4.5.6:7447</code> program argument.</p></li></ul><h3 id=2-behind-a-nat-leverage-a-zenoh-router-in-the-cloud>2. Behind a NAT? Leverage a zenoh router in the cloud!</h3><p>If you can&rsquo;t open a public TCP port in your LAN, let&rsquo;s use a zenoh router in a public cloud instance that will intermediate the communications between the bridge and the zenoh application:</p><p><img src=../../img/blog-RO2-integration/router-in-cloud.png alt="router in cloud"></p><p>To deploy this:</p><ol><li><p>Pick your favorite cloud provider and provision a 64-bit Ubuntu VM with a public IP.</p></li><li><p>Install the zenoh router in this VM following those instructions:
Expand Down
2 changes: 1 addition & 1 deletion blog/2021-11-09-ros2-zenoh-pico/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> zn_write(s, <span style=color:#555>*</span>reskey, (<span style=color:#069;font-weight:700>const</span> <span style=color:#078;font-weight:700>uint8_t</span> <span style=color:#555>*</span>)buf, twist_serialized_size);
</span></span><span style=display:flex><span>}
</span></span></code></pre></div><p><strong>Note:</strong> auxiliary structs and serialization functions are missing in the previous snippet. For the full code, including the adaptations for the turtlesim, please check the code under <a href=https://github.com/eclipse-zenoh/zenoh-demos/tree/master/ROS2/zenoh-pico-teleop-gyro>https://github.com/eclipse-zenoh/zenoh-demos/tree/master/ROS2/zenoh-pico-teleop-gyro</a></p><h2 id=3-setting-up-the-infrastructure-and-the-turtlebot--turtlesim>3. Setting up the infrastructure and the turtlebot / turtlesim</h2><p>In order to set up the infrastructure and the turtlebot / turtle in different configurations, follow the steps described in our <a href=https://zenoh.io/blog/2021-04-28-ros2-integration/>previous blog</a>. However, note that Zenoh-pico currently supports client mode only (a lightweight peer mode is coming soon). As such, you might need to deploy at least one Zenoh router to which your microcontroller application will need to connect to. The minimum steps are shown below:</p><ol><li>Start the turtlesim or turtlebot3 burger:<ul><li>ros2 run turtlesim turtlesim_node # turtlesim</li><li>ros2 launch turtlebot3_bringup robot.launch.py # turtlebot3 burger</li></ul></li><li>Start the Zenoh router:<ul><li>zenohd</li></ul></li><li>Start the Zenoh/DDS bridge if not included as a plugin in Zenoh router<ul><li>zenoh-bridge-dds</li></ul></li><li>Build, Upload and Start Ros2Teleop in your microcontroller<ul><li>platformio run -t upload</li></ul></li><li>Move the sensor to drive the robot</li></ol><h2 id=4-demonstration>4. Demonstration</h2><p>If everything goes well, you might be able to control the robot just like in the video below.</p><table><thead><tr><th>Turtlebot3 Burger</th><th></th><th></th><th style=text-align:center>Turtlesim</th></tr></thead><tbody><tr><td><img src=../../img/blog-ros2-zenoh-pico/turtlebot-test-demo.gif alt=msg-sec></td><td></td><td></td><td style=text-align:center><img src=../../img/blog-ros2-zenoh-pico/turtlesim-test-demo.gif alt=msg-sec></td></tr></tbody></table><p>Really cool, isn’t it?!</p><hr><h1 id=conclusion>Conclusion</h1><p>Although it seems a very simple demonstration, it is supported by several state-of-the-art technologies and protocols that are running under the hood. For you as a developer, being abstracted from all of them means that you can focus on the core business of your application.</p><p>Moreover, Zenoh and Zenoh-pico are bridging the gap between ROS 2 and microcontroller environments, allowing ROS 2 users to make use of all its capabilities within their applications. Summarizing some key points:</p><ul><li><a href=https://github.com/eclipse-zenoh/zenoh>Zenoh</a> is hatching as a powerful and yet low overhead data-centric solution, extremely flexible to accommodate a wide range of distinct applications and use cases.</li><li><a href=https://github.com/eclipse-zenoh/zenoh-pico>Zenoh-pico</a> allows you to integrate Zenoh functionalities in your embedded systems and microcontrollers natively in C.</li><li><a href=https://github.com/eclipse-zenoh/zenoh-plugin-dds>Zenoh bridge for DDS</a> allows to (1) bridge DDS communications through Zenoh, and (2) reduce by up to 99.97% the discovery traffic between the nodes.</li></ul><p>Tell us about your ideas on how to unlock the power of microcontrollers. We will provide all the support you need either in <a href=https://github.com/eclipse-zenoh>GitHub</a> or <a href=https://discord.gg/cY4nVjUd>Discord</a>.</p><p><a href=https://github.com/cguimaraes/><strong>&ndash;CG</strong></a>
</span></span></code></pre></div><p><strong>Note:</strong> auxiliary structs and serialization functions are missing in the previous snippet. For the full code, including the adaptations for the turtlesim, please check the code under <a href=https://github.com/eclipse-zenoh/zenoh-demos/tree/main/ROS2/zenoh-pico-teleop-gyro>https://github.com/eclipse-zenoh/zenoh-demos/tree/main/ROS2/zenoh-pico-teleop-gyro</a></p><h2 id=3-setting-up-the-infrastructure-and-the-turtlebot--turtlesim>3. Setting up the infrastructure and the turtlebot / turtlesim</h2><p>In order to set up the infrastructure and the turtlebot / turtle in different configurations, follow the steps described in our <a href=https://zenoh.io/blog/2021-04-28-ros2-integration/>previous blog</a>. However, note that Zenoh-pico currently supports client mode only (a lightweight peer mode is coming soon). As such, you might need to deploy at least one Zenoh router to which your microcontroller application will need to connect to. The minimum steps are shown below:</p><ol><li>Start the turtlesim or turtlebot3 burger:<ul><li>ros2 run turtlesim turtlesim_node # turtlesim</li><li>ros2 launch turtlebot3_bringup robot.launch.py # turtlebot3 burger</li></ul></li><li>Start the Zenoh router:<ul><li>zenohd</li></ul></li><li>Start the Zenoh/DDS bridge if not included as a plugin in Zenoh router<ul><li>zenoh-bridge-dds</li></ul></li><li>Build, Upload and Start Ros2Teleop in your microcontroller<ul><li>platformio run -t upload</li></ul></li><li>Move the sensor to drive the robot</li></ol><h2 id=4-demonstration>4. Demonstration</h2><p>If everything goes well, you might be able to control the robot just like in the video below.</p><table><thead><tr><th>Turtlebot3 Burger</th><th></th><th></th><th style=text-align:center>Turtlesim</th></tr></thead><tbody><tr><td><img src=../../img/blog-ros2-zenoh-pico/turtlebot-test-demo.gif alt=msg-sec></td><td></td><td></td><td style=text-align:center><img src=../../img/blog-ros2-zenoh-pico/turtlesim-test-demo.gif alt=msg-sec></td></tr></tbody></table><p>Really cool, isn’t it?!</p><hr><h1 id=conclusion>Conclusion</h1><p>Although it seems a very simple demonstration, it is supported by several state-of-the-art technologies and protocols that are running under the hood. For you as a developer, being abstracted from all of them means that you can focus on the core business of your application.</p><p>Moreover, Zenoh and Zenoh-pico are bridging the gap between ROS 2 and microcontroller environments, allowing ROS 2 users to make use of all its capabilities within their applications. Summarizing some key points:</p><ul><li><a href=https://github.com/eclipse-zenoh/zenoh>Zenoh</a> is hatching as a powerful and yet low overhead data-centric solution, extremely flexible to accommodate a wide range of distinct applications and use cases.</li><li><a href=https://github.com/eclipse-zenoh/zenoh-pico>Zenoh-pico</a> allows you to integrate Zenoh functionalities in your embedded systems and microcontrollers natively in C.</li><li><a href=https://github.com/eclipse-zenoh/zenoh-plugin-dds>Zenoh bridge for DDS</a> allows to (1) bridge DDS communications through Zenoh, and (2) reduce by up to 99.97% the discovery traffic between the nodes.</li></ul><p>Tell us about your ideas on how to unlock the power of microcontrollers. We will provide all the support you need either in <a href=https://github.com/eclipse-zenoh>GitHub</a> or <a href=https://discord.gg/cY4nVjUd>Discord</a>.</p><p><a href=https://github.com/cguimaraes/><strong>&ndash;CG</strong></a>
<a href=https://github.com/gabrik/><strong>&ndash;GB</strong></a>
<a href=https://github.com/JEnoch/><strong>&ndash;JE</strong></a></p><div class=ato-next><b>Next up</b>: <a href=../../blog/2021-10-04-zenoh-pico-guide/>Zenoh goes embedded with zenoh-pico</a></div></main></div></div><footer class="ato-footer text-muted"><div class="container-fluid p-6 p-md-5"><div class=row><div class=col-md-2><h5>Eclipse Incubation</h5><p><img src=../../img/eclipse-incubation.png style=width:100px></p><p>Eclipse zenoh &trade; is an incubating project under the Eclipse Foundation.</p></div><div class=col-md-2><h5>More Information</h5><p><a href=https://www.eclipse.org/legal target=_blank>Legal</a></p><p><a href=https://www.eclipse.org/legal/privacy.php target=_blank>Privacy policy</a></p><p><a href=https://www.eclipse.org/legal/termsofuse.php target=_blank>Terms of use</a></p><p><a href=https://www.eclipse.org/legal/copyright.php target=_blank>Copyright</a></p><p><a href=https://www.eclipse.org/security/ target=_blank>Report a security issue</a></p><p><a href=https://www.eclipse.org/legal/epl-2.0/ target=_blank>Eclipse Public License 2.0</a></p><p><a href=https://www.apache.org/licenses/LICENSE-2.0 target=_blank>Apache License 2.0</a></p><p><a href=https://www.eclipse.org/ target=_blank>Eclipse Foundation</a></p></div><div class=col-md-2><h5>Sponsored by:</h5><p><a href=https://www.eclipse.org target=_blank><img src=../../img/eclipse-foundation.svg style=width:120px></a></p><p><a href=https://zettascale.tech target=_blank><img src=../../img/zettascale-dark.svg style=width:120px></a></p></div><div class=col-md-2><h5>Follow us</h5><p><a href=https://github.com/eclipse-zenoh/zenoh><i class="fa fa-github" aria-hidden=true></i>
GitHub</a></p><p><a href=https://discord.gg/vSDSpqnbkm><i class="fa fa fa-comments-o" aria-hidden=true></i>
Expand Down
Loading

0 comments on commit 6f3c22d

Please sign in to comment.