<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom"><title>Jupyter Blog - Wolf Vollprecht</title><link href="https://jasongrout.github.io/medium-archive/pelican/" rel="alternate"/><link href="https://jasongrout.github.io/medium-archive/pelican/feeds/author-wolf-vollprecht.atom.xml" rel="self"/><id>https://jasongrout.github.io/medium-archive/pelican/</id><updated>2019-04-07T21:15:00+00:00</updated><subtitle>The Project Jupyter blog: news, releases, and community stories, archived from blog.jupyter.org.</subtitle><entry><title>ROS @ Jupyter</title><link href="https://jasongrout.github.io/medium-archive/pelican/posts/2019/ros-jupyter/" rel="alternate"/><published>2019-04-07T21:15:00+00:00</published><updated>2019-04-07T21:15:00+00:00</updated><author><name>Wolf Vollprecht</name></author><id>tag:jasongrout.github.io,2019-04-07:/medium-archive/pelican/posts/2019/ros-jupyter/</id><summary type="html">&lt;p&gt;Project Jupyter is a huge hit in data science, but it has not yet found widespread adoption in robotics. Today, we are releasing the first version of jupyter-ros, a collection of Jupyter interactive widgets inspired by Qt and RViz, to bring their features to the Jupyter ecosystem. This may be the right time for Jupyter-based developer tools, as cloud robotics is taking off.&lt;/p&gt;
</summary><content type="html">&lt;figure&gt;
&lt;p&gt;&lt;video src="images/005-Ri327iDKuC4pnExM4L-giphy.mp4" preload="metadata" loop muted playsinline controls&gt;&lt;/video&gt;&lt;/p&gt;
&lt;figcaption&gt;
&lt;p&gt;This may be the right time for Jupyter-based developer tools, as cloud robotics is taking off. A PR2 robot in the browser, and making him dance through the traditional Qt interface&lt;/p&gt;
&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;Historically, the &lt;a href="http://www.ros.org/"&gt;ROS (Robot Operating System)&lt;/a&gt; community has relied on Qt for building complex user interfaces. Nowadays, the Jupyter notebook and the ipywidgets framework offer a compelling alternative for several reasons:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Code and interface are &lt;em&gt;not separated&lt;/em&gt; — both are in the same notebook.&lt;/li&gt;
&lt;li&gt;Complex widgets using browser technology are possible: from &lt;a href="https://github.com/jupyter-widgets/ipywidgets"&gt;JavaScript sliders&lt;/a&gt; to 3D with &lt;a href="https://github.com/maartenbreddels/ipyvolume"&gt;WebGL&lt;/a&gt;, &lt;a href="https://github.com/maartenbreddels/ipywebrtc"&gt;real time video streaming with WebRTC&lt;/a&gt;…&lt;/li&gt;
&lt;li&gt;Works with any web browser — not bound to Linux, and no Qt applications need to be compiled.&lt;/li&gt;
&lt;li&gt;Doesn’t need to run locally! Applications can run on a server far away, without any manual setup or installation procedure.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;However, ROS does not play nicely with Jupyter. For example, rospy is inherently multi-threaded (every new ROS topic subscriber spawns a new thread). Debug printouts in callbacks result in Jupyter printing that content into the output area of the active notebook cell, quickly flooding the user interface — and there is no easy way to stop logging threads once started.&lt;/p&gt;
&lt;h3 id="ipywidgets-to-the-rescue-jupyter-ros"&gt;ipywidgets to the rescue: jupyter-ros&lt;/h3&gt;
&lt;p&gt;That is why &lt;a href="https://github.com/RoboStack/jupyter-ros"&gt;jupyter-ros&lt;/a&gt; was created. It is a suite of plugins to the Jupyter ecosystem to make working with ROS inside Jupyter a breeze.&lt;/p&gt;
&lt;figure&gt;
&lt;img alt="Subscribing with jupyter-ros produces an interactive widget" src="https://jasongrout.github.io/medium-archive/pelican/posts/2019/ros-jupyter/images/001-1_35w3erSL2xz0mp9le6YNyg.webp" loading="lazy" data-body-image=""&gt;
&lt;figcaption&gt;Subscribing with jupyter-ros produces an interactive widget&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;First, when you subscribe using jupyter-ros, the function returns an ipywidget with a start/stop button and a dedicated output area for debug prints. Internally this re-routes all print outs from your subscriber thread to this Jupyter cell, and gives full control over the thread (by being able to stop and restart it at any time).&lt;/p&gt;
&lt;figure&gt;
&lt;img alt="The jupyros publishing sugar" src="https://jasongrout.github.io/medium-archive/pelican/posts/2019/ros-jupyter/images/002-1_yBgrLtyCGlaZcUQnFV9Jpg.webp" loading="lazy" data-body-image=""&gt;
&lt;figcaption&gt;The jupyros publishing sugar&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;If you call the publish function in jupyter-ros, a widget is automatically generated from the message specification. For example, a ROS message String field automatically becomes a text input widget, a Float32 becomes a FloatSlider…&lt;/p&gt;
&lt;figure&gt;
&lt;p&gt;&lt;video src="images/006-fSqNQ06Ujnuu8juH2t-giphy.mp4" preload="metadata" loop muted playsinline controls&gt;&lt;/video&gt;&lt;/p&gt;
&lt;figcaption&gt;
&lt;p&gt;Live plotting IMU data from a BBC micro:bit&lt;/p&gt;
&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;Another interesting functionality is the live plotting, similar to rqt_plot. For this we use &lt;a href="https://github.com/bloomberg/bqplot"&gt;bqplot&lt;/a&gt;, a “jupyter-native” solution to plotting. With jupyter-ros, you can select a couple of fields from your message, and they will be automatically plotted to a bqplot.&lt;/p&gt;
&lt;h3 id="going-3-d"&gt;Going 3-D&lt;/h3&gt;
&lt;p&gt;Most robots are three dimensional, and so should be the visualizations! The go-to tool in the ROS ecosystem at the moment is RViz, a very powerful 3-D visualization tool.&lt;/p&gt;
&lt;p&gt;Some of RViz’s functionality has already been ported over to the web browser as part of the &lt;a href="http://robotwebtools.org/"&gt;RobotWebTools&lt;/a&gt; effort. We’ve been able to piggy-back on their impressive work, and we’re releasing the first iteration of ROS3D Jupyter widgets. Currently, they allow you to programatically plug together RViz like visualizations for different data types, such as laser scans, robot trajectories, and 3D (URDF) models of the robot!&lt;/p&gt;
&lt;p&gt;Thanks to the ipywidgetification, you can now bring complex visualizations to the web, without writing any JavaScript, and arrange those visualizations freely in JupyterLab.&lt;/p&gt;
&lt;figure&gt;
&lt;iframe src="https://www.youtube-nocookie.com/embed/mPvYZango2E" title="ROS widgets in JupyterLab" width="560" height="315" style="aspect-ratio: 560 / 315" loading="lazy" allow="accelerometer; clipboard-write; encrypted-media; gyroscope; picture-in-picture" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen&gt;&lt;/iframe&gt;
&lt;figcaption&gt;
&lt;p&gt;Interactive widgets showing ROS data inside JupyterLab&lt;/p&gt;
&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;h3 id="jupyter-widgets-and-cloud-robotics"&gt;Jupyter, Widgets, and Cloud Robotics&lt;/h3&gt;
&lt;p&gt;We hope that Jupyter, and the jupyter-ros widgets will play a big role in cloud robotics. In cloud robotics, some of the software powering one or multiple robots runs on powerful computers in data centers. For monitoring purposes, or development, Jupyter and JupyterLab are perfect candidates. Robot customers will be able to login to a single user-friendly interface, without having to install any custom software on their machine, or run a specialized operating system (ROS usually runs on Ubuntu). Exciting possibilities arise: it is already possible to run a Docker container running JupyterLab and jupyter-ros on the leading cloud robotics platforms, &lt;a href="https://rapyuta-robotics.com"&gt;Rapyuta Robotics&lt;/a&gt; and their freshly launched platform &lt;a href="http://rapyuta.io"&gt;rapyuta.io&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id="installation-source"&gt;Installation &amp;amp; source&lt;/h3&gt;
&lt;p&gt;The jupyter-ros widgets can be installed from PyPI using&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;$&lt;span class="w"&gt; &lt;/span&gt;pip&lt;span class="w"&gt; &lt;/span&gt;install&lt;span class="w"&gt; &lt;/span&gt;jupyros
$&lt;span class="w"&gt; &lt;/span&gt;jupyter&lt;span class="w"&gt; &lt;/span&gt;nbextension&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nb"&gt;enable&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;--py&lt;span class="w"&gt; &lt;/span&gt;--sys-prefix&lt;span class="w"&gt; &lt;/span&gt;jupyros
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The examples and the source code can be found on github: &lt;a href="https://github.com/robostack/jupyter-ros"&gt;https://github.com/robostack/jupyter-ros&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;This work is still early stages and you might find some rough edges. We look forward to collaborating with the community to polish these widgets to the highest standards!&lt;/p&gt;
&lt;h3 id="about-quantstack"&gt;About QuantStack&lt;/h3&gt;
&lt;p&gt;&lt;a href="https://twitter.com/QuantStack"&gt;QuantStack&lt;/a&gt; is located in the center of Europe (Paris). We are core Jupyter developers, and love ROS, and the cloud. If you are interested in working with us on professional user interfaces for developers or clients in the cloud, do not hesitate to send us an email: &lt;a href="mailto:wolf.vollprecht@quantstack.net"&gt;wolf.vollprecht@quantstack.net&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://jasongrout.github.io/medium-archive/pelican/posts/2019/ros-jupyter/images/003-1_puvws-ulE4ShvCd9inzo0g.webp" alt="" loading="lazy" data-body-image=""&gt;&lt;br&gt;
&lt;img src="https://jasongrout.github.io/medium-archive/pelican/posts/2019/ros-jupyter/images/004-1_WqG2vz1hl2X0-Z2TZFFSAQ.webp" alt="" loading="lazy" data-body-image=""&gt;&lt;/p&gt;
</content><category term="robotics"/><category term="visualization"/></entry><entry><title>A Diagram Editor for JupyterLab</title><link href="https://jasongrout.github.io/medium-archive/pelican/posts/2018/a-diagram-editor-for-jupyterlab/" rel="alternate"/><published>2018-02-26T11:33:00+00:00</published><updated>2018-02-26T11:51:00+00:00</updated><author><name>Wolf Vollprecht</name></author><id>tag:jasongrout.github.io,2018-02-26:/medium-archive/pelican/posts/2018/a-diagram-editor-for-jupyterlab/</id><summary type="html">&lt;p&gt;With the success of the notebook file format as a medium for communicating scientific results, more than an interactive development environment, Jupyter is turning into an interactive scientific authoring environment.&lt;/p&gt;
</summary><content type="html">&lt;figure&gt;
&lt;img alt="JupyterLab viewing LaTeX source code and a PDF document" src="https://jasongrout.github.io/medium-archive/pelican/posts/2018/a-diagram-editor-for-jupyterlab/images/001-0_SQhbgeWA5hO5_nt7.jpg" loading="lazy" data-body-image=""&gt;
&lt;figcaption&gt;JupyterLab viewing LaTeX source code and a PDF document&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;&lt;a href="/posts/2018/jupyterlab-is-ready-for-users/"&gt;The new JupyterLab interface&lt;/a&gt; is much more than a replacement for the classic notebook. It aims to bring together all the pieces required for a complete scientific workflow. The extension-based architecture of JupyterLab comes with a number of components already enabled:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;a Jupyter notebook,&lt;/li&gt;
&lt;li&gt;a text editor,&lt;/li&gt;
&lt;li&gt;a file browser in the sidebar,&lt;/li&gt;
&lt;li&gt;a number of editors and viewers for &lt;a href="http://jupyterlab.readthedocs.io/en/stable/user/file_formats.html"&gt;various file formats&lt;/a&gt;,&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;and much more. However, some pieces are still missing to complete the picture for a scientific authoring environment. One would be a featureful LaTeX editor. The &lt;a href="https://github.com/jupyterlab/jupyterlab-latex"&gt;first LaTeX editor for JupyterLab&lt;/a&gt; is a step in the right direction and offers an easy way to live-compile &lt;code&gt;tex&lt;/code&gt; documents. Another piece is — of course — a means to produce diagrams, flow charts and draw figures!&lt;/p&gt;
&lt;h3 id="drawing-charts-and-diagrams"&gt;Drawing charts and diagrams&lt;/h3&gt;
&lt;p&gt;On the occasion of the Paris Jupyter Widgets workshop, I started working on a feature to fill that gap and built a JupyterLab extension for the &lt;a href="http://draw.io"&gt;Draw.io&lt;/a&gt; diagram editor.&lt;/p&gt;
&lt;p&gt;Draw.io is a diagram editor that runs in the web browser and is Apache 2.0 licensed. It’s got a really mature code base, which has been around for many years. However, unlike the other components used by JupyterLab, Draw.io has not yet embraced the new JavaScript packaging tooling such as NPM, which complicated the integration with JupyterLab a little bit, but it all paid off eventually!&lt;/p&gt;
&lt;p&gt;Now, I am really pleased to announce the first release of the draw.io extension, a fully fledged integration for JupyterLab of the fully-fledged diagram editor!&lt;/p&gt;
&lt;iframe src="https://www.youtube-nocookie.com/embed/CJH34I01cKA" title="Screencast: JupyterLab with Drawio Plugin" width="560" height="315" style="aspect-ratio: 560 / 315" loading="lazy" allow="accelerometer; clipboard-write; encrypted-media; gyroscope; picture-in-picture" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen&gt;&lt;/iframe&gt;
&lt;p&gt;The Draw.io JupyterLab extension takes advantages of the JupyterLab architecture: i.e. registering a new mime type (.dio) with the file explorer to open files, and adding a launcher button and menu items. Besides that, multiple synchronized views of the same diagrams can be displayed at the same time, allowing a user to visualize the same content with different zoom levels, or with a bare text editor.&lt;/p&gt;
&lt;h3 id="installation"&gt;Installation&lt;/h3&gt;
&lt;p&gt;You can install the jupyterlab-drawio extension with the following command:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;jupyter labextension install jupyterlab-drawio
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This should set up the extension inside your JupyterLab environment. I hope this will be a useful extension for the larger community. All the code is available on GitHub: &lt;a href="https://github.com/QuantStack/jupyterlab-drawio"&gt;https://github.com/QuantStack/jupyterlab-drawio&lt;/a&gt;. Don’t hesitate to open issues and come contribute to jupyterlab-drawio.&lt;/p&gt;
&lt;h3 id="the-future"&gt;The future&lt;/h3&gt;
&lt;p&gt;There are other projects just waiting to be packaged for use inside of JupyterLab: one great &lt;em&gt;webapp&lt;/em&gt; for JupyterLab would probably be the &lt;a href="https://github.com/sharelatex/sharelatex"&gt;ShareLaTeX&lt;/a&gt; application, which is Open Source as well and provides a very nicely integrated editing experience for LaTeX documents, with autocomplete of LaTeX commands and reference search. Eventually, we might be able to integrate with the official ShareLaTeX server for a collaborative, hosted, editing experience for LaTeX documents from inside JupyterLab.&lt;/p&gt;
&lt;p&gt;Maybe we as a community can come together and start building integrations for these amazing free tools into JupyterLab!&lt;/p&gt;
&lt;p&gt;To conclude, thanks to all who’ve organized and participated in the workshop (especially &lt;a href="https://twitter.com/SylvainCorlay"&gt;Sylvain&lt;/a&gt; for the organization). I’ve used the opportunity to chat with the core developers and get their helpful input: &lt;a href="https://twitter.com/steve_silvester"&gt;Steven&lt;/a&gt;, &lt;a href="http://micronova"&gt;Afshin&lt;/a&gt;, and &lt;a href="https://twitter.com/jason_grout"&gt;Jason&lt;/a&gt;, thanks for helping me out in getting this off the ground and making JupyterLab! And honestly, the biggest shoutout has to go to the people who’ve worked on improving draw.io and thankfully open sourced this &lt;a href="https://github.com/jgraph/mxgraph"&gt;amazing code base&lt;/a&gt;: the entire draw.io team.&lt;/p&gt;
&lt;h3 id="about-the-author"&gt;About the Author&lt;/h3&gt;
&lt;p&gt;&lt;a href="https://twitter.com/wuoulf"&gt;Wolf Vollprecht&lt;/a&gt; is a scientific software developer at &lt;a href="https://twitter.com/QuantStack"&gt;QuantStack&lt;/a&gt;, passionate about High-Performance Computing and Robotics. He is one of the core developers of &lt;a href="https://github.com/QuantStack/xtensor/"&gt;xtensor&lt;/a&gt;.&lt;/p&gt;
</content><category term="JupyterLab"/><category term="visualization"/></entry></feed>