Skip to content
Snippets Groups Projects
Commit 3111d1f3 authored by Wolf Vollprecht's avatar Wolf Vollprecht
Browse files

initial commit

parents
No related branches found
No related tags found
No related merge requests found
.gitgnore 0 → 100644
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
# Translations
*.mo
*.pot
# Django stuff:
*.log
.static_storage/
.media/
local_settings.py
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
target/
# Jupyter Notebook
.ipynb_checkpoints
# pyenv
.python-version
# celery beat schedule file
celerybeat-schedule
# SageMath parsed files
*.sage.py
# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
\ No newline at end of file
# 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 seperates the user away from the code.
We've built an initial version of the 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.
In the future, we plan to bring simple and fast real-time
plotting from ROS topics to this library.
If you find this initial package useful, don't hesitate to
contribute!
You can also always reach out to w.vollprecht@gmail.com or
on twitter: https://twitter.com/wuoulf
\ No newline at end of file
from jupyros.ros_widgets import *
\ No newline at end of file
import rospy
import std_msgs
import ipywidgets as widgets
def _add_widgets(msg_type, form_list, widget_list):
"""
Adds widgets.
@param msg_type The message type
@param form_list The form list
@param widget_list The widget list
@return form_list and widget_list
"""
for idx, slot in enumerate(msg_type.__slots__):
attr = getattr(msg_type, slot)
s_t = msg_type._slot_types[idx]
w = None
if s_t in ['float32', 'float64']:
w = widgets.FloatSlider()
if s_t in ['int8', 'uint8', 'int32', 'uint32', 'int64', 'uint64']:
w = widgets.IntSlider()
if s_t in ['string']:
w = widgets.Text()
if w == None:
add_widgets(s_t, form_list, widget_list)
form_list.append(w)
w_box = widgets.HBox([widgets.Label(value=slot), w])
widget_list.append(w_box)
return form_list, widget_list
def widget_for_msg(msg_type, publish_to):
"""
Create a form widget for message type msg_type.
This function analyzes the fields of msg_type and creates
an appropriate widget.
A publisher is automatically created which publishes to the
topic given as publish_to parameter. This allows pressing the
"Send Message" button to send the message to ROS.
@param msg_type The message type
@param publish_to The topic name to publish to
@return jupyter widget for display
"""
widget_list, form_list = [], []
publisher = rospy.Publisher(publish_to, msg_type, queue_size=10)
form_list, widget_list = _add_widgets(msg_type, [], [])
send_btn = widgets.Button(description="Send Message")
def send_msg(arg):
arg_list = [wdg.value for wdg in form_list]
msg = msg_type(*arg_list)
publisher.publish(msg)
send_btn.on_click(send_msg)
widget_list.append(send_btn)
vbox = widgets.VBox(children=widget_list)
return vbox
\ No newline at end of file
[metadata]
description-file = README.md
\ No newline at end of file
setup.py 0 → 100644
#!/usr/bin/env python
from distutils.core import setup
setup(name='jupyter-ros',
version='1.0',
description='Jupyter utilities for ROS, the Robot Operating System',
author='Wolf Vollprecht',
author_email='w.vollprecht@gmail.com',
url='https://github.com/wolfv/jupyter-ros',
packages=['jupyros'],
)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment