Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prepare repository for ROS2 #108

Merged
merged 1 commit into from
Jul 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions jupyros/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@

from ._version import version_info, __version__

from .ros_widgets import *
from .pubsub import *
from .ipy import *
from .server_extension import *

from .ros3d import *
from .ros1.ipy import *
from .ros1.pubsub import *
from .ros1.ros_widgets import *
from .ros1.ros3d import *
from .ros1.server_extension import *
from .ros1.turtle_sim import *

def _jupyter_nbextension_paths():
return [{
Expand All @@ -32,4 +32,4 @@ def _jupyter_labextension_paths():
def _jupyter_server_extension_paths():
return [{
"module": "jupyros"
}]
}]
16 changes: 16 additions & 0 deletions jupyros/ros1/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#############################################################################
# Copyright (c) Wolf Vollprecht, QuantStack #
# #
# Distributed under the terms of the BSD 3-Clause License. #
# #
# The full license is in the file LICENSE, distributed with this software. #
#############################################################################

from .._version import __version__

from .ipy import *
from .pubsub import *
from .ros_widgets import *
from .ros3d import *
from .server_extension import *
from .turtle_sim import *
11 changes: 5 additions & 6 deletions jupyros/ipy.py → jupyros/ros1/ipy.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@
# #
# The full license is in the file LICENSE, distributed with this software. #
#############################################################################

from IPython import get_ipython
from IPython.core.magic import register_line_magic, register_cell_magic, register_line_cell_magic
import sys
from threading import Thread
import time
from jupyros.pubsub import output_registry

import ipywidgets as widgets
import sys
from IPython.core.magic import register_cell_magic

from .pubsub import output_registry

def executor(cell, gbls, lcls):
exec(cell, gbls, lcls)
Expand Down
8 changes: 4 additions & 4 deletions jupyros/pubsub.py → jupyros/ros1/pubsub.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@

from __future__ import print_function

import sys
import threading
import time

import ipywidgets as widgets
import sys

try:
import rospy
except:
print("The actionlib package is not found in your $PYTHONPATH. Action clients are not going to work.")
print("Do you need to activate your ROS environment?")
pass

import inspect

output_registry = {}
subscriber_registry = {}

Expand Down
7 changes: 2 additions & 5 deletions jupyros/ros3d.py → jupyros/ros1/ros3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,10 @@

import os

import ipywidgets as widgets
from traitlets import *
import ipywidgets as widgets

try:
from _version import version_info
except:
from ._version import version_info
from .._version import version_info

js_version = '^' + '.'.join([str(x) for x in version_info[:3]])

Expand Down
28 changes: 17 additions & 11 deletions jupyros/ros_widgets.py → jupyros/ros1/ros_widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,35 @@
# #
# The full license is in the file LICENSE, distributed with this software. #
#############################################################################
import os
import yaml
import threading
import subprocess
import numpy as np

import bqplot as bq
import ipywidgets as widgets


try:
import rospy
except:
print("The rospy package is not found in your $PYTHONPATH. Subscribe and publish are not going to work.")
print("Do you need to activate your ROS environment?")

try:
import actionlib
except:
print("The actionlib package is not found in your $PYTHONPATH. Action clients are not going to work.")
print("Do you need to activate your ROS environment?")

try:
from cv_bridge import CvBridge, CvBridgeError
from cv_bridge import CvBridge
import cv2

bridge = CvBridge()
except:
pass
import bqplot as bq
import ipywidgets as widgets
import numpy as np
import threading
import subprocess, yaml, os

try:
import actionlib
except:
print("The actionlib package is not found in your $PYTHONPATH. Action clients are not going to work.")


def add_widgets(msg_instance, widget_dict, widget_list, prefix=''):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,16 @@
# #
# The full license is in the file LICENSE, distributed with this software. #
#############################################################################
import os

from notebook.utils import url_path_join
from notebook.base.handlers import IPythonHandler
from jupyros import _version

import rospkg
import os

__version__ = _version.__version__
from .._version import __version__

__version__ = __version__

if os.getenv('JUPYROS_DEFAULT_WS'):
envs = os.getenv('JUPYROS_DEFAULT_WS').split(';')
Expand Down
10 changes: 6 additions & 4 deletions jupyros/turtle_sim.py → jupyros/ros1/turtle_sim.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import os
import time
import math
import random

import ipycanvas
import ipywidgets

import rospkg
import random
import time
import math
import os


class TurtleSim:
Expand Down
16 changes: 16 additions & 0 deletions jupyros/ros2/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#############################################################################
# Copyright (c) Wolf Vollprecht, QuantStack #
# #
# Distributed under the terms of the BSD 3-Clause License. #
# #
# The full license is in the file LICENSE, distributed with this software. #
#############################################################################

from .._version import __version__

from ..ros1.ipy import *
from ..ros1.pubsub import *
from ..ros1.ros_widgets import *
from ..ros1.ros3d import *
from ..ros1.server_extension import *
from ..ros1.turtle_sim import *