robostack / jupyter-ros Goto Github PK
View Code? Open in Web Editor NEWJupyter widget helpers for ROS, the Robot Operating System
Home Page: https://jupyter-ros.readthedocs.io/en/latest/
License: BSD 3-Clause "New" or "Revised" License
Jupyter widget helpers for ROS, the Robot Operating System
Home Page: https://jupyter-ros.readthedocs.io/en/latest/
License: BSD 3-Clause "New" or "Revised" License
I dont know how you determine the ranges for the generated ui for jr.publish. But if you are publishing Twist, the ranges are 0.0 -> I think 100 or something. It would be nice if you changed that to -10 -> +10. When the max is 100 the slider is too sensitive for normal cases.
The extension (v0.7.0) is currently not compatible with JupyterLab>=4.0 and Notebook>=7.0
When starting a jupyter notebook (or jupyter lab) I get the error:
libgcc_s.so.1 must be installed for pthread_cancel to work
Aborted (core dumped)
This only happens after I install jupyter-ros. Any ideas?
I'm using Python 3.7 in a conda 4.8.3 environment.
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
When I use this line to plot only the x and y values, I get x,y, and z values plotted
jr.live_plot("/my/posetopic:x:y", geometry_msgs.Pose)
It works as expected if I use
!rqt_plot /my/posetopic/x /posetopic/y
Thanks!
Mohamed
I am trying to get the package to work with Jupyter Lab. However the UI widget just for pub and subscribe don't seem to work. Do I install them differently for lab?
What is the right course of action for accessing custom messages from other ROS packages? I was trying to see if there was something in the examples, but I couldn't find anything.
I am still trying to figure out the threading model of this approach.
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.
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 npm@5, `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/
Please consider editing the README.md development installation instructions to
git clone https://github.com/RoboStack/jupyter-ros.git
Instead of
git clone https://github.com/wolfv/jupyter-ros.git
(or adding some kind of warning since both repositories are popular)
It took me too much time to figure out why the newer features in the RoboStack master branch where not working.
Thanks for this great project!
Hi I tried to run the following:
jupyter nbextension install --py --symlink --sys-prefix jupyros
but ended up getting this error instead.
OSError: [Errno 13] Permission denied: '/usr/share/jupyter'
Hello,
I got this error while tring to create my widget with your example. I checked the source code and the widget_for_msg function doesn't seem to exist. Also could you give me an example of the use of the jupyros.add_widgets function ?
Thank you very much
AttributeError Traceback (most recent call last)
in ()
----> 1 jupyros.widget_for_msg()
AttributeError: module 'jupyros' has no attribute 'widget_for_msg'
When I am writing or debugging a node in Jupyter Notebook + Jupyter Ros, I often need to run the edited version. I've been restarting the kernel in Jupyter as a way to try to get it to run the edited node, but I am not sure that works or is reliable. I've also tried killing roscore and restarting it. I am not sure yet what works and what doesn't. What's the recommended way to do this?
Is there a TF display widget similar to the one in RViz that visualizes all broadcasted reference frames? From the code it seems like TFClient
does not have any display capabilities.
Can more then one ros jupyter session be stated in different tabs one for each node? Like in a launch file.
What's interesting is that roslibpy offers a viable route of working with ROS without having the requirement of running in a ROS environment. Those environments that work with ROS, -well basically Ubuntu linux- are quite a small subset from those environments that run python well.
I think a powerful use case of this project is having a ROS docker running somewhere, and using jupyter-ros
to interface it, without having to create the actual ROS environment.
Might be worth looking into it, or to decide whether a ROS env is a requirement or not
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)
Hi there!
Several names are unknown in the code.
It started by Unicode in file jupyros/ros3d.py
=> I explicitly import it by a from traitlets import Unicode
But then, I'm getting a:
>>> import jupyros
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/meunier/miniforge3/envs/ros_env2/lib/python3.9/site-packages/jupyros/__init__.py", line 16, in <module>
from .ros3d import *
File "/home/meunier/miniforge3/envs/ros_env2/lib/python3.9/site-packages/jupyros/ros3d.py", line 78, in <module>
class TFClient(widgets.Widget):
File "/home/meunier/miniforge3/envs/ros_env2/lib/python3.9/site-packages/jupyros/ros3d.py", line 95, in TFClient
ros = Instance(ROSConnection).tag(**sync_widget)
NameError: name 'Instance' is not defined
I've done the standard installation of Robotstack, for ROS Noetic, followed by: mamba install jupyter-ros -c robostack
On a x86_64 macchine running Ubuntu 20.04.6 LTS
Some version info:
jupyter-ros 0.5.0 pyhd8ed1ab_0 robostack
jupyter_client 7.4.9 pyhd8ed1ab_0 conda-forge
jupyter_core 5.5.0 py39hf3d152e_0 conda-forge
jupyter_events 0.9.0 pyhd8ed1ab_0 conda-forge
jupyter_server 2.10.1 pyhd8ed1ab_0 conda-forge
jupyter_server_fileid 0.9.0 pyhd8ed1ab_0 conda-forge
jupyter_server_terminals 0.4.4 pyhd8ed1ab_1 conda-forge
jupyter_server_ydoc 0.8.0 pyhd8ed1ab_0 conda-forge
jupyter_ydoc 0.2.4 pyhd8ed1ab_0 conda-forge
jupyterlab 3.6.6 pyhd8ed1ab_0 conda-forge
jupyterlab_pygments 0.2.2 pyhd8ed1ab_0 conda-forge
jupyterlab_server 2.25.1 pyhd8ed1ab_0 conda-forge
jupyterlab_widgets 3.0.9 pyhd8ed1ab_0 conda-forge
Thanks for any help,
JL
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
`
From https://github.com/RoboStack/jupyter-ros
typed in
pip install jupyter bqplot pyyaml ipywidgets
jupyter nbextension enable --py --sys-prefix ipywidgets
Results in:
KeyError: 'The Python module ipywidgets is not a valid nbextension, it is missing the `_jupyter_nbextension_paths()` method.'
Happens both on Windoze 10 install and Debian 10 install.
Hi, great job on this. I'm excited to see where it goes.
Just some feedback... In order to get the widgets to render in Jupyter Notebook, I had to install ipywidgets.
I did so by executing the following:
pip install ipywidgets
jupyter nbextension enable --py widgetsnbextension
Hi all,
I tried installing jupyter-ros
in docker ubunut:16.04
, later in osrf/ros:kinetic-desktop-full
, but it always fails with different errors.
Did anybody manage to install it on Docker?
when I run "jupyter nbextension install --py --symlink --sys-prefix jupyros" , it breaks down for the following error. My environment is python 3.9 and it seems python3.x do not support the Unicode function. Hope to get some clues!!!!
File "/jupyter-ros/jupyros/ros1/ros3d.py", line 73, in ROSConnection
url = Unicode(os.environ.get("JUPYROS_WEBSOCKET_URL", "ws://Z9d2n4:9090")).tag(sync=True)
NameError: name 'Unicode' is not defined
Hi@all,
i am getting the following error after installing jupyros with micromamba:
Traceback (most recent call last):
File "/home/mirkosertic/micromamba/envs/ros_jupyter/lib/python3.9/site-packages/jupyter_server/extension/manager.py", line 319, in add_extension
extpkg = ExtensionPackage(name=extension_name, enabled=enabled)
File "/home/mirkosertic/micromamba/envs/ros_jupyter/lib/python3.9/site-packages/jupyter_server/extension/manager.py", line 183, in __init__
self._load_metadata()
File "/home/mirkosertic/micromamba/envs/ros_jupyter/lib/python3.9/site-packages/jupyter_server/extension/manager.py", line 192, in _load_metadata
self.module, self.metadata = get_metadata(name, logger=self.log)
File "/home/mirkosertic/micromamba/envs/ros_jupyter/lib/python3.9/site-packages/jupyter_server/extension/utils.py", line 71, in get_metadata
module = importlib.import_module(package_name)
File "/home/mirkosertic/micromamba/envs/ros_jupyter/lib/python3.9/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 850, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "/home/mirkosertic/micromamba/envs/ros_jupyter/lib/python3.9/site-packages/jupyros/__init__.py", line 16, in <module>
from .ros3d import *
File "/home/mirkosertic/micromamba/envs/ros_jupyter/lib/python3.9/site-packages/jupyros/ros3d.py", line 60, in <module>
class ROSConnection(widgets.Widget):
File "/home/mirkosertic/micromamba/envs/ros_jupyter/lib/python3.9/site-packages/jupyros/ros3d.py", line 75, in ROSConnection
url = Unicode(os.environ.get("JUPYROS_WEBSOCKET_URL", "ws://{hostname}:9090")).tag(sync=True)
NameError: name 'Unicode' is not defined
any ideas what I am missing? I'd really like to give it a try, but unfortunately there is this issue in my environment, and I really do not have a glue about how to proceed.
For completeness, here is the command I used to create a fresh environment:
micromamba create -n ros_jupyter python=3.9 jupyter-ros -c robostack -c conda-forge --no-channel-priority --override-channels
Do you have a time estimate for when / if there will be ROS2 support?
I got error when I ran the code
"jupyter labextension install jupyter-ros "
Error executing Jupyter command 'labextension': [Errno 'jupyter-labextension' not found] 2
I'm getting this error:
index.js:276 Plugin 'jupyter-ros' failed to activate.
(anonymous) @ index.js:276
index.js:277 Error: No provider for: jupyter.extensions.jupyterWidgetRegistry.
at f.e.resolveRequiredService (index.js:191)
at index.js:149
at Array.map (<anonymous>)
at f.e.activatePlugin (index.js:149)
at index.js:275
at Array.map (<anonymous>)
at f.e.start (index.js:274)
at o (index.out.js:1059)
Digging in the problem comes from base.IJupyterWidgetRegistry in https://github.com/RoboStack/jupyter-ros/blob/master/js/lib/labplugin.js#L14 not being the same object as the object saved in the serivice map. I think it's because the deduplication step is not doing what it should, when I install with jupyter labextension install jupyter-ros --debug
I'm getting:
> node /usr/local/lib/python3.6/dist-packages/jupyterlab/staging/yarn.js yarn-deduplicate -s fewer --fail
|yarn run v1.21.1
$ /usr/local/share/jupyter/lab/staging/node_modules/.bin/yarn-deduplicate -s fewer --fail
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Not sure how to fix this one
Hi,
I am glad development continues - thanks so much. We had built a docker container after we found out what versions of extensions and python packages works with jupy ros. After the update on th e 15th it is broken again. Currently we fixed it by forcing to use jupyros 0.12a0.
Could you please provide an enviroment.yml with versions of python packages and widget extensions used, when you update things?
Thanks a lot
regards
Riko
Hi - where can I find an example of how to do real-time, time series plotting - as shown in your blog ? It's fantastic - me want ! :)
Well...
Don't know what to do:
I have my roscore working fine, with rviz I can see my /scan => No issues
using jupyros is another story:
1st code (proposed in the documentation) working fine:
import jupyros as jr
import rospy
from std_msgs.msg import String
rospy.init_node('jupyter_node')
jr.subscribe('/sometopic', String, lambda msg: print(msg))
2nd code just render a grid without scan, no error message, no warning, nothing.
How to debug???
Here is my code:
import rospy
import jupyros as jr
from jupyros import ros3d
from ipywidgets import Layout
import os
v = ros3d.Viewer()
v.layout=Layout(border="3px solid red",width="800px",height="400px")
rc = ros3d.ROSConnection(url="ws://localhost:9090")
g = ros3d.GridModel()
tf_client = ros3d.TFClient(ros=rc, fixed_frame='/base_link')
laser_view = ros3d.LaserScan(topic="/scan", ros=rc, tf_client=tf_client)
#urdf = ros3d.URDFModel(ros=rc, tf_client=tf_client, path=os.environ.get('JUPYROS_ASSETS_URL', 'http://localhost:3000'))
v.objects = [g, laser_view]
v
Hi,
When I tried to publish string message using Start button with rate = 10, I noticed from the terminal when I ran rostopic hz the frequency was increasing constantly with low increases from 0.1 hz to 9.8 hz.
How can I avoid this issue?
Please consider adding license information to your repo and files
When re-subscribing to a topic when you re-execute the cell (which you shouldn't, I know :-) ), I get this error.
I could make a PR but I'm not sure what it should be 🤷♂️ Maybe RuntimeError?
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-6-a297a3eee99c> in <module>()
----> 1 jr.subscribe('/barcode', String, cb)
/home/lvb/.local/lib/python2.7/site-packages/jupyros/pubsub.pyc in subscribe(topic, msg_type, callback)
48
49 if subscriber_registry.get(topic):
---> 50 raise Error("Already registerd...")
51
52 out = widgets.Output(layout={'border': '1px solid gray'})
NameError: global name 'Error' is not defined
Version info:
The version of the notebook server is: 5.7.8
Python 2.7.12 (default, Nov 12 2018, 14:36:49)
Type "copyright", "credits" or "license" for more information.
IPython 5.8.0 -- An enhanced Interactive Python.
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
I got this error and solved it by running the command below, it would be helpful if you add this to the documentation, to remind the users to enable the extension
jupyter nbextension enable --py --sys-prefix widgetsnbextension
after setting up everything, you still can't use the action_client widget in jupyter. It throws key doesnt exist exceptions.
Hi, I've tried running python setup.py install --user
and noticed that some paths are broken.
The path jupyros/static/... isn't in the project so python will throw an error (Lines 69-70, 135-137).
I'd love to install the most recent library (without relying on pip), so please let me know if this can be resolved or if there's a quick fix.
Thank you
Hi,
I need to plot several topics at the same window using live_plot() function, is that possible?
Thanks,
Mohammad
Logging an issue to describe details of errors to answer question from Gitter thread. I tried to run the notebook named - Ros2 Pub_Sub_Communication.ipynb from pre-release https://github.com/RoboStack/jupyter-ros/tree/v0.6.0a0/notebooks and got following errors. It may be some issue with the way I installed the package and extensions. I tried to follow instructions from here to install from source.
I have an env named ros_env which has ROS2 humble installation with full desktop version of humble installed and it works correctly. I also tried to set ROS_DISTRO=humble in the terminal within jupyter-labs to see if it will make any difference but it didn't help.
I also have another env named ros2_foxy where ROS2 foxy is installed and main computer where ROS2 foxy is installed as well with ROS_DISTRO=foxy for main computer. I can see that in the error description it is still trying to look in the paths under /opt/ros/foxy even though I am running in humble so may be that's the main issue somehow.
Please suggest any options as I'm willing to try to get it to work with ROS2 in jypyter-labs. It will be a big help for community overall if I can document how to get it working.
I did make a change in the ~/mambaforge/envs/ros_env/jupyter-ros-0.6.0a0/jupyros/init.py file to change the ros version to 2 and name to humble like this, I thought this was necessary to use ROS2 but I could be wrong:
from ._version import __version__
import os
try:
ros_version = os.environ['ROS_VERSION']
ros_distro = os.environ['ROS_DISTRO']
except KeyError:
# print('No ROS environment detected.')
# print('Defaulting to ROS noetic.')
ros_version = '2'
ros_distro = 'humble'
While running following block of code in jupyter-labs:
## Relative pathing to the Jupyros module (jupyter-ros/jupyros), due to difficulty with with development install
## Remove at PR is Dev Install successful
import sys
sys.path.append("./../")
import rclpy as rp
import jupyros.ros2 as jr2
from geometry_msgs.msg import Pose, Point
from sensor_msgs.msg import Image
Two main errors received - one saying jupyros not found and the other with context problem related to rp.init()
The rclpy package is not found in your $PYTHONPATH. Subscribe and publish are not going to work.
Do you need to activate your ros2 environment?
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
Input In [5], in <cell line: 6>()
4 sys.path.append("./../")
5 import rclpy as rp
----> 6 import jupyros.ros2 as jr2
7 from geometry_msgs.msg import Pose, Point
8 from sensor_msgs.msg import Image
File ~/mambaforge/envs/ros_env/jupyter-ros-0.6.0a0/jupyros/__init__.py:24, in <module>
19 ros_distro = 'humble'
21 if ros_version == '2':
22 # Import ROS2 modules
23 # print(f'ROS2 {ros_distro} environment detected.')
---> 24 from .ros2.publisher import *
25 from .ros2.ros_widgets import *
26 from .ros2.subscriber import *
File ~/mambaforge/envs/ros_env/jupyter-ros-0.6.0a0/jupyros/ros2/__init__.py:16, in <module>
9 from .._version import __version__
11 #from ..ros1.ipy import *
12 #from ..ros1.ros3d import *
13 #from ..ros1.server_extension import *
14 #from ..ros1.turtle_sim import *
---> 16 from ..ros2.publisher import *
17 from ..ros2.ros_widgets import *
18 from ..ros2.subscriber import *
File ~/mambaforge/envs/ros_env/jupyter-ros-0.6.0a0/jupyros/ros2/publisher.py:42, in <module>
38 # Used for documentation purposes only
39 MsgType = TypeVar('MsgType')
---> 42 class Publisher():
43 """
44 Creates a class containing the form widget for message type `msg_type`.
45 This class analyzes the fields of msg_type and creates
(...)
55
56 """
57 def __init__(self, node: Node, msg_type: MsgType, topic: str) -> None:
58 # Check if a ros2 node is provided.
File ~/mambaforge/envs/ros_env/jupyter-ros-0.6.0a0/jupyros/ros2/publisher.py:57, in Publisher()
42 class Publisher():
43 """
44 Creates a class containing the form widget for message type `msg_type`.
45 This class analyzes the fields of msg_type and creates
(...)
55
56 """
---> 57 def __init__(self, node: Node, msg_type: MsgType, topic: str) -> None:
58 # Check if a ros2 node is provided.
59 if (not isinstance(node, Node) or not issubclass(type(node), Node)):
60 raise TypeError(
61 "Input argument 'node' is not of type rclpy.node.Node!")
NameError: name 'Node' is not defined
# Initialize ROS communications for a given context
rp.init()
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
Input In [4], in <cell line: 2>()
1 # Initialize ROS communications for a given context
----> 2 rp.init()
File /opt/ros/foxy/lib/python3.8/site-packages/rclpy/__init__.py:70, in init(args, context)
62 def init(*, args: Optional[List[str]] = None, context: Context = None) -> None:
63 """
64 Initialize ROS communications for a given context.
65
(...)
68 (see :func:`.get_default_context`).
69 """
---> 70 context = get_default_context() if context is None else context
71 return context.init(args)
File /opt/ros/foxy/lib/python3.8/site-packages/rclpy/utilities.py:34, in get_default_context(shutting_down)
32 global g_default_context
33 if g_default_context is None:
---> 34 g_default_context = Context()
35 if shutting_down:
36 old_context = g_default_context
File /opt/ros/foxy/lib/python3.8/site-packages/rclpy/context.py:37, in Context.__init__(self)
36 def __init__(self):
---> 37 from rclpy.impl.implementation_singleton import rclpy_implementation
38 from .handle import Handle
39 self._handle = Handle(rclpy_implementation.rclpy_create_context())
File /opt/ros/foxy/lib/python3.8/site-packages/rclpy/impl/implementation_singleton.py:31, in <module>
15 """
16 Provide singleton access to the rclpy C modules.
17
(...)
26 # ...
27 """
29 from rclpy.impl import _import
---> 31 rclpy_implementation = _import('._rclpy')
32 rclpy_action_implementation = _import('._rclpy_action')
33 rclpy_logging_implementation = _import('._rclpy_logging')
File /opt/ros/foxy/lib/python3.8/site-packages/rclpy/impl/__init__.py:28, in _import(name)
23 try:
24 # Since Python 3.8, on Windows we should ensure DLL directories are
25 # explicitly added to the search path.
26 # See https://docs.python.org/3/whatsnew/3.8.html#bpo-36085-whatsnew
27 with add_dll_directories_from_env('PATH'):
---> 28 return importlib.import_module(name, package='rclpy')
29 except ImportError as e:
30 if e.path is None:
File ~/mambaforge/envs/ros_env/lib/python3.9/importlib/__init__.py:127, in import_module(name, package)
125 break
126 level += 1
--> 127 return _bootstrap._gcd_import(name[level:], package, level)
ModuleNotFoundError: No module named 'rclpy._rclpy'
The C extension '/opt/ros/foxy/lib/python3.8/site-packages/rclpy/_rclpy.cpython-39-x86_64-linux-gnu.so' isn't present on the system. Please refer to 'https://index.ros.org/doc/ros2/Troubleshooting/Installation-Troubleshooting/#import-failing-without-library-present-on-the-system' for possible solutions
Hi! Thanks for your repo.
When I run
!jupyter nbextension enable --py --sys-prefix jupyros
I get an error. Could anyone help me ?
Traceback (most recent call last):
File "/usr/local/bin/jupyter-nbextension", line 8, in <module>
sys.exit(main())
File "/usr/local/lib/python2.7/dist-packages/jupyter_core/application.py", line 267, in launch_instance
return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/traitlets/config/application.py", line 658, in launch_instance
app.start()
File "/usr/local/lib/python2.7/dist-packages/notebook/nbextensions.py", line 988, in start
super(NBExtensionApp, self).start()
File "/usr/local/lib/python2.7/dist-packages/jupyter_core/application.py", line 256, in start
self.subapp.start()
File "/usr/local/lib/python2.7/dist-packages/notebook/nbextensions.py", line 896, in start
self.toggle_nbextension_python(self.extra_args[0])
File "/usr/local/lib/python2.7/dist-packages/notebook/nbextensions.py", line 872, in toggle_nbextension_python
logger=self.log)
File "/usr/local/lib/python2.7/dist-packages/notebook/nbextensions.py", line 483, in enable_nbextension_python
logger=logger)
File "/usr/local/lib/python2.7/dist-packages/notebook/nbextensions.py", line 380, in _set_nbextension_state_python
m, nbexts = _get_nbextension_metadata(module)
File "/usr/local/lib/python2.7/dist-packages/notebook/nbextensions.py", line 1122, in _get_nbextension_metadata
m = import_item(module)
File "/usr/local/lib/python2.7/dist-packages/traitlets/utils/importstring.py", line 42, in import_item
return __import__(parts[0])
ImportError: No module named jupyros
This looks really promising!
However instead of accepting live data, IMHO a more common use case for jupyter is to analyze recorded data. So in the ROS context that usually means bag files.
It would be great to have good support for bag files.
https://github.com/cruise-automation/webviz could be useful here as well.
I would like to import custom ROS message types definitions from another ROS module lying in the same catkin workspace as the jupyter notebook. Anyone knows how to do that?
Actually it would be great to run the jupyter-ros notebook as catkin module, to realize a live monitoring node of the stack. Any ideas?
Thanks a lot.
Riko
I was trying to get run it on google colab, but something is missing.
Can you help?
https://colab.research.google.com/drive/1QpSNBB339OoCJaVJ4_3bfikt0ygOC2NV
commands to reproduce:
pip3 install jupyros
jupyter nbextension enable --py --sys-prefix jupyros
on version 0.2.0 gave the output:
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?
Enabling notebook extension jupyter-ros/extension...
- Validating: OK
now in version 0.2.1 gives the error:
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?
Traceback (most recent call last):
File "/usr/local/bin/jupyter-nbextension", line 10, in <module>
sys.exit(main())
File "/usr/local/lib/python3.6/dist-packages/jupyter_core/application.py", line 267, in launch_instance
return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/traitlets/config/application.py", line 658, in launch_instance
app.start()
File "/usr/local/lib/python3.6/dist-packages/notebook/nbextensions.py", line 988, in start
super(NBExtensionApp, self).start()
File "/usr/local/lib/python3.6/dist-packages/jupyter_core/application.py", line 256, in start
self.subapp.start()
File "/usr/local/lib/python3.6/dist-packages/notebook/nbextensions.py", line 896, in start
self.toggle_nbextension_python(self.extra_args[0])
File "/usr/local/lib/python3.6/dist-packages/notebook/nbextensions.py", line 872, in toggle_nbextension_python
logger=self.log)
File "/usr/local/lib/python3.6/dist-packages/notebook/nbextensions.py", line 483, in enable_nbextension_python
logger=logger)
File "/usr/local/lib/python3.6/dist-packages/notebook/nbextensions.py", line 380, in _set_nbextension_state_python
m, nbexts = _get_nbextension_metadata(module)
File "/usr/local/lib/python3.6/dist-packages/notebook/nbextensions.py", line 1122, in _get_nbextension_metadata
m = import_item(module)
File "/usr/local/lib/python3.6/dist-packages/traitlets/utils/importstring.py", line 42, in import_item
return __import__(parts[0])
File "/usr/local/lib/python3.6/dist-packages/jupyros/__init__.py", line 5, in <module>
from .ipy import *
File "/usr/local/lib/python3.6/dist-packages/jupyros/ipy.py", line 9, in <module>
@register_cell_magic
File "/usr/local/lib/python3.6/dist-packages/IPython/core/magic.py", line 238, in magic_deco
ip.register_magic_function(func, magic_kind, name)
AttributeError: 'NoneType' object has no attribute 'register_magic_function'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.