Jupyter widget helpers for ROS, the Robot Operating System

RoboStack, updated 🕥 2023-03-15 11:44:32

ROS Support for jupyter notebooks

While the Jupyter ecosystem has been widely adopted by the Data Science and Machine Learning community, the robotics community has not jumped on the band wagon yet! Most tools around ROS, the Robot Operating System, are built using Python and QT.

However, using QT separates the user away from the code. We've built a set of ROS tools for jupyter notebook, trying to promote a rich, interactive experience for Robotics developers utilizing the power of the jupyter notebook.

Video of jupyter-ros in JupyterLab

With jupyter-ros, it's possible to easily create widgets for custom message types to send messages.

If you find this package useful, don't hesitate to contribute! You can also always reach out to [email protected] or on twitter: https://twitter.com/wuoulf, or join us on Gitter

Installation and Dependencies

You need a ROS environment with rospy. We recommend using Robostack (follow their installation instructions) which allows you to install ROS in a conda environment. Also required are numpy and bqplot for the live-plotting, ipywidgets for the interactive widgets, and ipycanvas for the Turtlesim animations.

conda install jupyter bqplot pyyaml ipywidgets ipycanvas

pyyaml is necessary for rospy.

To install use conda or mamba:

conda install jupyter-ros -c robostack
Development installation

You can create a dev environment with: bash conda create -n jupyros -c conda-forge python nodejs=14 jupyterlab=3 jupyter bqplot pyyaml ipywidgets ipycanvas

For a development installation (requires npm),

git clone https://github.com/RoboStack/jupyter-ros.git
cd jupyter-ros
pip install -e .
jupyter nbextension install --py --symlink --sys-prefix jupyros
jupyter nbextension enable --py --sys-prefix jupyros

To update the defaults.js javascript you need to run python jupyros/ros3d.py.

Troubleshooting

You might see a warning like "The rospy package is not found in your $PYTHONPATH. Subscribe and publish are not going to work. Do you need to activate your ROS environment?"

This is harmless during installation, but if you see this warning in a notebook, you should check that your ROS environment is activated. You can also set the path from inside the notebook using

``` import sys sys.path.append('/opt/ros/melodic/lib/python2.7/dist-packages/')

The next line should now work!

import jupyros ```

If you got the following error when you run a cell failed to display Jupyter Widget of type VBox, you can solve it by running the following command jupyter nbextension enable --py --sys-prefix widgetsnbextension

License

We use a shared copyright model that enables all contributors to maintain the copyright on their contributions.

This software is licensed under the BSD-3-Clause license. See the LICENSE file for details.

Issues

Unable to import ros3d from jupyros

opened on 2023-03-16 17:16:00 by ChengTszYin

I was runing from jupyros import ros3d and get error "ImportError: cannot import name 'ros3d' from 'jupyros'"


ImportError Traceback (most recent call last) Cell In[4], line 1 ----> 1 from jupyros import ros3d 2 import rospy

ImportError: cannot import name 'ros3d' from 'jupyros' (/Users/chengtszyin/Desktop/new_ws/jupyter-ros/jupyros/init.py)

Please help. THANK YOU

Bump webpack from 5.75.0 to 5.76.0 in /js

opened on 2023-03-15 11:44:32 by dependabot[bot]

Bumps webpack from 5.75.0 to 5.76.0.

Release notes

Sourced from webpack's releases.

v5.76.0

Bugfixes

Features

Security

Repo Changes

New Contributors

Full Changelog: https://github.com/webpack/webpack/compare/v5.75.0...v5.76.0

Commits
  • 97b1718 Merge pull request #16781 from askoufis/loader-context-target-type
  • b84efe6 Merge pull request #16759 from ryanwilsonperkin/real-content-hash-regex-perf
  • c98e9e0 Merge pull request #16493 from piwysocki/patch-1
  • 5f34acf feat: Add target to LoaderContext type
  • b7fc4d8 Merge pull request #16703 from ryanwilsonperkin/ryanwilsonperkin/fix-16160
  • 63ea82d Merge branch 'webpack:main' into patch-1
  • 4ba2252 Merge pull request #16446 from akhilgkrishnan/patch-1
  • 1acd635 Merge pull request #16613 from jakebailey/ts-logo
  • 302eb37 Merge pull request #16614 from jakebailey/html5-logo
  • cfdb1df Improve performance of hashRegExp lookup
  • Additional commits viewable in compare view
Maintainer changes

This version was pushed to npm by evilebottnawi, a new releaser for webpack since your current version.


Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) - `@dependabot use these labels` will set the current labels as the default for future PRs for this repo and language - `@dependabot use these reviewers` will set the current reviewers as the default for future PRs for this repo and language - `@dependabot use these assignees` will set the current assignees as the default for future PRs for this repo and language - `@dependabot use this milestone` will set the current milestone as the default for future PRs for this repo and language You can disable automated security fix PRs for this repo from the [Security Alerts page](https://github.com/RoboStack/jupyter-ros/network/alerts).

Unsuccesful development install

opened on 2022-11-25 18:09:30 by ldania

Actions:

$ pip3 install "git+https://github.com/Robostack/jupyter-ros"

Environment: Ubuntu 22.0, Ros2 Humble

Expected Results: Successful install

Result: ````````` Building wheels for collected packages: jupyros Building wheel for jupyros (pyproject.toml) ... error error: subprocess-exited-with-error

× Building wheel for jupyros (pyproject.toml) did not run successfully. │ exit code: 1 ╰─> [47 lines of output] yarn install v1.21.1 [1/4] Resolving packages... [2/4] Fetching packages... [3/4] Linking dependencies... warning "@jupyter-widgets/base > @lumino/[email protected]" has unmet peer dependency "[email protected]". [4/4] Building fresh packages... $ webpack node:internal/crypto/hash:71 this[kHandle] = new _Hash(algorithm, xofLen); ^

  Error: error:0308010C:digital envelope routines::unsupported
      at new Hash (node:internal/crypto/hash:71:19)
      at Object.createHash (node:crypto:133:10)
      at BulkUpdateDecorator.hashFactory (/tmp/pip-req-build-2e5z22x1/js/node_modules/webpack/lib/util/createHash.js:144:18)
      at BulkUpdateDecorator.update (/tmp/pip-req-build-2e5z22x1/js/node_modules/webpack/lib/util/createHash.js:46:50)
      at OriginalSource.updateHash (/tmp/pip-req-build-2e5z22x1/js/node_modules/webpack/node_modules/webpack-sources/lib/OriginalSource.js:104:8)
      at NormalModule._initBuildHash (/tmp/pip-req-build-2e5z22x1/js/node_modules/webpack/lib/NormalModule.js:753:17)
      at handleParseResult (/tmp/pip-req-build-2e5z22x1/js/node_modules/webpack/lib/NormalModule.js:817:10)
      at /tmp/pip-req-build-2e5z22x1/js/node_modules/webpack/lib/NormalModule.js:908:4
      at processResult (/tmp/pip-req-build-2e5z22x1/js/node_modules/webpack/lib/NormalModule.js:640:11)
      at /tmp/pip-req-build-2e5z22x1/js/node_modules/webpack/lib/NormalModule.js:692:5 {
    opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
    library: 'digital envelope routines',
    reason: 'unsupported',
    code: 'ERR_OSSL_EVP_UNSUPPORTED'
  }

  Node.js v18.10.0
  error Command failed with exit code 1.
  info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
  Traceback (most recent call last):
    File "/home/dobots/anaconda3/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 363, in <module>
      main()
    File "/home/dobots/anaconda3/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 345, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
    File "/home/dobots/anaconda3/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 261, in build_wheel
      return _build_backend().build_wheel(wheel_directory, config_settings,
    File "/tmp/pip-build-env-27q3pzbo/overlay/lib/python3.9/site-packages/jupyter_packaging/build_api.py", line 22, in build_wheel
      builder()
    File "/tmp/pip-build-env-27q3pzbo/overlay/lib/python3.9/site-packages/jupyter_packaging/setupbase.py", line 231, in builder
      run(npm_cmd + ["install"], cwd=node_package)
    File "/tmp/pip-build-env-27q3pzbo/overlay/lib/python3.9/site-packages/jupyter_packaging/setupbase.py", line 297, in run
      return subprocess.check_call(cmd, **kwargs)
    File "/home/dobots/anaconda3/lib/python3.9/subprocess.py", line 373, in check_call
      raise CalledProcessError(retcode, cmd)
  subprocess.CalledProcessError: Command '['/tmp/pip-build-env-27q3pzbo/overlay/bin/jlpm', 'install']' returned non-zero exit status 1.
  [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for jupyros Failed to build jupyros ERROR: Could not build wheels for jupyros, which is required to install pyproject.toml-based projects `

Integrating camera images with ros3D

opened on 2021-09-27 15:06:51 by C-Boucher

Is there a way to include images from the robot's camera in the ros3D visualisation? Is it a feature that is planned? The only way I found to do it is to use a threading to update the images from the camera inside a grid, but the results make the video feed delayed by a couple seconds (not delayed without the ros3D object). Here is the code I am using to create a user interface :

``` from ipywidgets import HBox, Box, Layout, GridspecLayout from jupyros import ros3d import ipywidgets as widgets import threading import time

v = ros3d.Viewer() rc = ros3d.ROSConnection(url="ws://localhost:9090") tf_client = ros3d.TFClient(ros=rc, fixed_frame='/map') g = ros3d.GridModel() laser_view = ros3d.LaserScan(topic="/scan", ros=rc, tf_client=tf_client) map_view = ros3d.OccupancyGrid(topic="/map", ros=rc, tf_client=tf_client) pose_view = ros3d.Pose(topic="/mobile_manip/pose", ros=rc, tf_client=tf_client) v.objects = [laser_view, map_view, pose_view] v.layout = Layout(border="3px solid black", width="700px", height="600px")

image = widgets.Image( value=cam_msg.data, format="png", height="120%", width="200%")

btn_up = widgets.Button(icon='arrow-up') btn_left = widgets.Button(icon='arrow-left') btn_down = widgets.Button(icon='arrow-down') btn_right = widgets.Button(icon='arrow-right') btn_stop = widgets.Button(description='Stop')

def update_plot(): while True: image.value=cam_msg.data time.sleep(0.1)

def on_btn_up_clicked(b): move_robot(0.5,0)

def on_btn_left_clicked(b): move_robot(0,0.5)

def on_btn_down_clicked(b): move_robot(-0.5,0)

def on_btn_right_clicked(b): move_robot(0,-0.5)

def on_btn_stop_clicked(b): move_robot(0,0)

btn_up.on_click(on_btn_up_clicked) btn_left.on_click(on_btn_left_clicked) btn_down.on_click(on_btn_down_clicked) btn_right.on_click(on_btn_right_clicked) btn_stop.on_click(on_btn_stop_clicked)

grid = GridspecLayout(8, 8,height='600px')

grid[0:4,0:3] = image grid[5,1] = btn_up grid[6,0] = btn_left grid[6,1] = btn_stop grid[6,2] = btn_right grid[7,1] = btn_down grid[:,4:7] = v thread = threading.Thread(target=update_plot) thread.start() grid ```

AMCL_pose for ros3D

opened on 2021-09-27 15:00:17 by C-Boucher

Is there a way to use directly the pose from AMCL (PoseWithCovarianceStamped) in the ros3d.Pose() widget? Right now I have to create another publisher to publish a PoseStamped message using this code :

``` pose_msg = Pose() def amcl_callback(msg): global pose_msg pose_msg = msg.pose.pose pose = PoseStamped()

pose.header.seq = 1
pose.header.stamp = rospy.Time.now()
pose.header.frame_id = "map"

pose.pose.position.x = pose_msg.position.x
pose.pose.position.y = pose_msg.position.y
pose.pose.position.z = 0.0

pose.pose.orientation.x = pose_msg.orientation.x
pose.pose.orientation.y = pose_msg.orientation.y
pose.pose.orientation.z = pose_msg.orientation.z
pose.pose.orientation.w = pose_msg.orientation.w

pose_pub.publish(pose)

```

installation issue as root inside dockerfile

opened on 2020-09-05 13:07:10 by ljburtz

Hello and thank you for this great project! I'm trying to package it in a ROS Docker image

I have an error when installing (following the .README instructions)

Would anybody here have an idea of what might be the problem? Thank you so much.

```sh Step 25/41 : RUN mkdir -p ~/utilities/ && cd ~/utilities/ && git clone https://github.com/RoboStack/jupyter-ros.git && cd ~/utilities/jupyter-ros && pip3 install -e . ---> Running in a9e29d0dc56b Cloning into 'jupyter-ros'... Obtaining file:///root/utilities/jupyter-ros Complete output from command python setup.py egg_info: setup.py entered $PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin running egg_info running jsdeps 6.14.6 6.14.6 Installing build dependencies with npm. This may take a while...

> [email protected] postinstall /root/utilities/jupyter-ros/js/node_modules/uglifyjs-webpack-plugin
> node lib/post_install.js

npm WARN prepublish-on-install As of [email protected], `prepublish` scripts are deprecated.
npm WARN prepublish-on-install Use `prepare` for build steps and `prepublishOnly` for upload-only.
npm WARN prepublish-on-install See the deprecation note in `npm help scripts` for more information.
npm WARN lifecycle [email protected]~prepublish: cannot run in wd [email protected] webpack (wd=/root/utilities/jupyter-ros/js)
npm WARN [email protected] No license field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

added 432 packages from 380 contributors and audited 501 packages in 5.414s
found 113 vulnerabilities (109 low, 2 moderate, 2 high)
  run `npm audit fix` to fix them, or `npm audit` for details
rebuilding js and css failed
missing files: ['/root/utilities/jupyter-ros/jupyros/static/extension.js', '/root/utilities/jupyter-ros/jupyros/static/index.js']
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/root/utilities/jupyter-ros/setup.py", line 180, in <module>
    setup(**setup_args)
  File "/usr/local/lib/python3.6/dist-packages/setuptools/__init__.py", line 153, in setup
    return distutils.core.setup(**attrs)
  File "/usr/lib/python3.6/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/usr/lib/python3.6/distutils/dist.py", line 955, in run_commands
    self.run_command(cmd)
  File "/usr/lib/python3.6/distutils/dist.py", line 974, in run_command
    cmd_obj.run()
  File "/root/utilities/jupyter-ros/setup.py", line 45, in run
    raise e
  File "/root/utilities/jupyter-ros/setup.py", line 38, in run
    self.distribution.run_command('jsdeps')
  File "/usr/lib/python3.6/distutils/dist.py", line 974, in run_command
    cmd_obj.run()
  File "/root/utilities/jupyter-ros/setup.py", line 118, in run
    raise ValueError(msg)
ValueError: Missing file: /root/utilities/jupyter-ros/jupyros/static/extension.js

----------------------------------------

Command "python setup.py egg_info" failed with error code 1 in /root/utilities/jupyter-ros/

```

Releases

v0.7.0a0 2023-03-06 16:28:45

0.7.0a0

(Full Changelog)

Enhancements made

Other merged PRs

Contributors to this release

(GitHub contributors page for this release)

@Andor233 | @hbcarlos | @ihuicatl | @ldania

v0.6.1 2022-10-19 12:54:03

v0.6.0 2022-09-14 11:06:23

What's Changed

  • Readme: Use conda to install by @Tobias-Fischer in https://github.com/RoboStack/jupyter-ros/pull/83
  • Bump socket.io-parser from 3.3.0 to 3.3.2 in /js by @dependabot in https://github.com/RoboStack/jupyter-ros/pull/84
  • Bump postcss from 8.2.4 to 8.3.4 in /js by @dependabot in https://github.com/RoboStack/jupyter-ros/pull/82
  • Bump glob-parent from 5.1.1 to 5.1.2 in /js by @dependabot in https://github.com/RoboStack/jupyter-ros/pull/81
  • Bump normalize-url from 4.5.0 to 4.5.1 in /js by @dependabot in https://github.com/RoboStack/jupyter-ros/pull/80
  • Bump lodash from 4.17.20 to 4.17.21 in /js by @dependabot in https://github.com/RoboStack/jupyter-ros/pull/77
  • Bump hosted-git-info from 2.7.1 to 2.8.9 in /js by @dependabot in https://github.com/RoboStack/jupyter-ros/pull/76
  • Bump underscore from 1.9.1 to 1.13.1 in /js by @dependabot in https://github.com/RoboStack/jupyter-ros/pull/75
  • Bump browserslist from 4.16.1 to 4.16.6 in /js by @dependabot in https://github.com/RoboStack/jupyter-ros/pull/79
  • Add ROS service/client widget by @ihuicatl in https://github.com/RoboStack/jupyter-ros/pull/92
  • Add Turtlesim Widget by @ihuicatl in https://github.com/RoboStack/jupyter-ros/pull/94
  • Bump moment from 2.24.0 to 2.29.2 in /js by @dependabot in https://github.com/RoboStack/jupyter-ros/pull/93
  • Bump minimist from 1.2.5 to 1.2.6 in /js by @dependabot in https://github.com/RoboStack/jupyter-ros/pull/91
  • Bump nanoid from 3.1.23 to 3.2.0 in /js by @dependabot in https://github.com/RoboStack/jupyter-ros/pull/90
  • Bump tar from 6.1.0 to 6.1.11 in /js by @dependabot in https://github.com/RoboStack/jupyter-ros/pull/87
  • Bump path-parse from 1.0.6 to 1.0.7 in /js by @dependabot in https://github.com/RoboStack/jupyter-ros/pull/86
  • Bump node-fetch from 2.6.1 to 2.6.7 in /js by @dependabot in https://github.com/RoboStack/jupyter-ros/pull/96
  • Bump ansi-regex from 5.0.0 to 5.0.1 in /js by @dependabot in https://github.com/RoboStack/jupyter-ros/pull/95
  • Optimize TurtleSim animation speed by @ihuicatl in https://github.com/RoboStack/jupyter-ros/pull/97
  • Add ipycanvas dependency for Turtlesim animations by @ihuicatl in https://github.com/RoboStack/jupyter-ros/pull/102
  • Add widget and example for ROS actions by @ihuicatl in https://github.com/RoboStack/jupyter-ros/pull/104
  • Clear all notebook outputs by @ihuicatl in https://github.com/RoboStack/jupyter-ros/pull/103
  • Bump moment from 2.29.2 to 2.29.4 in /js by @dependabot in https://github.com/RoboStack/jupyter-ros/pull/105
  • Bump shell-quote from 1.7.2 to 1.7.3 in /js by @dependabot in https://github.com/RoboStack/jupyter-ros/pull/99
  • Make actionlib dependency optional by @ihuicatl in https://github.com/RoboStack/jupyter-ros/pull/107
  • Bump terser from 5.5.1 to 5.14.2 in /js by @dependabot in https://github.com/RoboStack/jupyter-ros/pull/106
  • Add contributing guidelines by @ihuicatl in https://github.com/RoboStack/jupyter-ros/pull/109
  • Prepare repository for ROS2 by @hbcarlos in https://github.com/RoboStack/jupyter-ros/pull/108
  • Update documentation for Read the Docs by @ihuicatl in https://github.com/RoboStack/jupyter-ros/pull/110
  • Update requirements to build docs by @ihuicatl in https://github.com/RoboStack/jupyter-ros/pull/111
  • Update to nodejs=14 to build docs by @ihuicatl in https://github.com/RoboStack/jupyter-ros/pull/112
  • Organize and update notebooks by @ihuicatl in https://github.com/RoboStack/jupyter-ros/pull/115
  • Import ROS1 or ROS2 modules based on environment by @ihuicatl in https://github.com/RoboStack/jupyter-ros/pull/116
  • Rename client to service_client by @ihuicatl in https://github.com/RoboStack/jupyter-ros/pull/117
  • Added build workflow by @hbcarlos in https://github.com/RoboStack/jupyter-ros/pull/118
  • Ros2 scalable by @ldania in https://github.com/RoboStack/jupyter-ros/pull/119
  • Adopt jupyter-releaser by @ihuicatl in https://github.com/RoboStack/jupyter-ros/pull/114
  • Fixes For Ros2 Publisher by @ldania in https://github.com/RoboStack/jupyter-ros/pull/120
  • Removes prints for ros env by @hbcarlos in https://github.com/RoboStack/jupyter-ros/pull/121
  • Automated Changelog Entry for 0.6.0a0 on master by @hbcarlos in https://github.com/RoboStack/jupyter-ros/pull/123
  • Fix error when building the extension by @ihuicatl in https://github.com/RoboStack/jupyter-ros/pull/127
  • Automated Changelog Entry for 0.6.0a1 on master by @hbcarlos in https://github.com/RoboStack/jupyter-ros/pull/129
  • Automated Changelog Entry for 0.6.0 on master by @ihuicatl in https://github.com/RoboStack/jupyter-ros/pull/130
  • Update CHANGELOG.md by @ihuicatl in https://github.com/RoboStack/jupyter-ros/pull/131

New Contributors

  • @ldania made their first contribution in https://github.com/RoboStack/jupyter-ros/pull/119

Full Changelog: https://github.com/RoboStack/jupyter-ros/compare/0.5.0...0.6.0

v0.6.0a0 2022-08-11 12:10:53

0.6.0a0

(Full Changelog)

Enhancements made

Bugs fixed

Maintenance and upkeep improvements

Documentation improvements

Other merged PRs

Contributors to this release

(GitHub contributors page for this release)

@dependabot | @hbcarlos | @ihuicatl | @ldania | @Tobias-Fischer | @wolfv

RoboStack

Maintaining cross-platform ROS packages for conda and mamba

GitHub Repository Homepage

ros jupyter python