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.
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
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
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
.
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/')
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
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.
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
Bumps webpack from 5.75.0 to 5.76.0.
Sourced from webpack's releases.
v5.76.0
Bugfixes
- Avoid cross-realm object access by
@Jack-Works
in webpack/webpack#16500- Improve hash performance via conditional initialization by
@lvivski
in webpack/webpack#16491- Serialize
generatedCode
info to fix bug in asset module cache restoration by@ryanwilsonperkin
in webpack/webpack#16703- Improve performance of
hashRegExp
lookup by@ryanwilsonperkin
in webpack/webpack#16759Features
- add
target
toLoaderContext
type by@askoufis
in webpack/webpack#16781Security
- CVE-2022-37603 fixed by
@akhilgkrishnan
in webpack/webpack#16446Repo Changes
- Fix HTML5 logo in README by
@jakebailey
in webpack/webpack#16614- Replace TypeScript logo in README by
@jakebailey
in webpack/webpack#16613- Update actions/cache dependencies by
@piwysocki
in webpack/webpack#16493New Contributors
@Jack-Works
made their first contribution in webpack/webpack#16500@lvivski
made their first contribution in webpack/webpack#16491@jakebailey
made their first contribution in webpack/webpack#16614@akhilgkrishnan
made their first contribution in webpack/webpack#16446@ryanwilsonperkin
made their first contribution in webpack/webpack#16703@piwysocki
made their first contribution in webpack/webpack#16493@askoufis
made their first contribution in webpack/webpack#16781Full Changelog: https://github.com/webpack/webpack/compare/v5.75.0...v5.76.0
97b1718
Merge pull request #16781 from askoufis/loader-context-target-typeb84efe6
Merge pull request #16759 from ryanwilsonperkin/real-content-hash-regex-perfc98e9e0
Merge pull request #16493 from piwysocki/patch-15f34acf
feat: Add target
to LoaderContext
typeb7fc4d8
Merge pull request #16703 from ryanwilsonperkin/ryanwilsonperkin/fix-1616063ea82d
Merge branch 'webpack:main' into patch-14ba2252
Merge pull request #16446 from akhilgkrishnan/patch-11acd635
Merge pull request #16613 from jakebailey/ts-logo302eb37
Merge pull request #16614 from jakebailey/html5-logocfdb1df
Improve performance of hashRegExp lookupThis version was pushed to npm by evilebottnawi, a new releaser for webpack since your current version.
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
.
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 `
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 ```
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)
```
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/
```
(GitHub contributors page for this release)
@Andor233 | @hbcarlos | @ihuicatl | @ldania
client
to service_client
by @ihuicatl in https://github.com/RoboStack/jupyter-ros/pull/117Full Changelog: https://github.com/RoboStack/jupyter-ros/compare/0.5.0...0.6.0
client
to service_client
#117 (@ihuicatl)client
to service_client
#117 (@ihuicatl)(GitHub contributors page for this release)
@dependabot | @hbcarlos | @ihuicatl | @ldania | @Tobias-Fischer | @wolfv
ros jupyter python