From 7bdecc1cb2d663094c91b7a44053ed690e23b1af Mon Sep 17 00:00:00 2001 From: Eric Gallimore Date: Tue, 16 Jul 2024 14:08:23 -0400 Subject: [PATCH 01/34] Changed type hints in ros_loader.py to use imports from Typing, restoring compatibility with Python <3.9. --- .../src/rosbridge_library/internal/ros_loader.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/rosbridge_library/src/rosbridge_library/internal/ros_loader.py b/rosbridge_library/src/rosbridge_library/internal/ros_loader.py index 3651727ac..1b0b12f2b 100644 --- a/rosbridge_library/src/rosbridge_library/internal/ros_loader.py +++ b/rosbridge_library/src/rosbridge_library/internal/ros_loader.py @@ -33,7 +33,7 @@ import importlib from threading import Lock -from typing import Any +from typing import Any, Tuple, Dict """ ros_loader contains methods for dynamically loading ROS message classes at runtime. It's achieved by using roslib to load the manifest files for the @@ -129,7 +129,7 @@ def get_action_result_instance(typestring: str) -> Any: def _get_interface_class( - typestring: str, intf_type: str, loaded_intfs: dict[str, Any], intf_lock: Lock + typestring: str, intf_type: str, loaded_intfs: Dict[str, Any], intf_lock: Lock ) -> Any: """ If not loaded, loads the specified ROS interface class then returns an instance of it. @@ -152,7 +152,7 @@ def _get_interface_class( return _get_class(typestring, intf_type, loaded_intfs, intf_lock) -def _get_class(typestring: str, subname: str, cache: dict[str, Any], lock: Lock) -> Any: +def _get_class(typestring: str, subname: str, cache: Dict[str, Any], lock: Lock) -> Any: """If not loaded, loads the specified class then returns an instance of it. @@ -206,7 +206,7 @@ def _load_class(modname: str, subname: str, classname: str) -> None: raise InvalidClassException(modname, subname, classname, exc) -def _splittype(typestring: str) -> tuple[str, str]: +def _splittype(typestring: str) -> Tuple[str, str]: """Split the string the / delimiter and strip out empty strings Performs similar logic to roslib.names.package_resource_name but is a bit @@ -220,13 +220,13 @@ def _splittype(typestring: str) -> tuple[str, str]: raise InvalidTypeStringException(typestring) -def _add_to_cache(cache: dict[str, Any], lock: Lock, key: str, value: any) -> None: +def _add_to_cache(cache: Dict[str, Any], lock: Lock, key: str, value: any) -> None: lock.acquire() cache[key] = value lock.release() -def _get_from_cache(cache: dict[str, Any], lock: Lock, key: str) -> Any: +def _get_from_cache(cache: Dict[str, Any], lock: Lock, key: str) -> Any: """Returns the value for the specified key from the cache. Locks the lock before doing anything. Returns None if key not in cache""" lock.acquire() From 3f44e5f792a409b02a0b5e0c8c931064119a9f50 Mon Sep 17 00:00:00 2001 From: Eric Gallimore Date: Tue, 16 Jul 2024 14:13:44 -0400 Subject: [PATCH 02/34] Reordered imports alphabetically to fix isort linting CI error. --- rosbridge_library/src/rosbridge_library/internal/ros_loader.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rosbridge_library/src/rosbridge_library/internal/ros_loader.py b/rosbridge_library/src/rosbridge_library/internal/ros_loader.py index 1b0b12f2b..c45abb896 100644 --- a/rosbridge_library/src/rosbridge_library/internal/ros_loader.py +++ b/rosbridge_library/src/rosbridge_library/internal/ros_loader.py @@ -33,7 +33,7 @@ import importlib from threading import Lock -from typing import Any, Tuple, Dict +from typing import Any, Dict, Tuple """ ros_loader contains methods for dynamically loading ROS message classes at runtime. It's achieved by using roslib to load the manifest files for the From 8b1b597f77e1008c62d48452d839ea8e53aa2390 Mon Sep 17 00:00:00 2001 From: Eric Gallimore Date: Tue, 16 Jul 2024 14:32:03 -0400 Subject: [PATCH 03/34] Change rosapi package to use ament_python rather than ament_cmake. --- rosapi/package.xml | 4 ++-- rosapi/setup.cfg | 4 ++++ rosapi/setup.py | 25 +++++++++++++++++++++++++ 3 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 rosapi/setup.cfg create mode 100644 rosapi/setup.py diff --git a/rosapi/package.xml b/rosapi/package.xml index af550dc72..c81c9b06f 100644 --- a/rosapi/package.xml +++ b/rosapi/package.xml @@ -17,7 +17,7 @@ Jihoon Lee Foxglove - ament_cmake_ros + ament_python rosapi_msgs builtin_interfaces @@ -41,7 +41,7 @@ rmw_dds_common - ament_cmake + ament_python diff --git a/rosapi/setup.cfg b/rosapi/setup.cfg new file mode 100644 index 000000000..d59d9c698 --- /dev/null +++ b/rosapi/setup.cfg @@ -0,0 +1,4 @@ +[develop] +script_dir=$base/scripts +[install] +install_scripts=$base/lib diff --git a/rosapi/setup.py b/rosapi/setup.py new file mode 100644 index 000000000..75b459fe4 --- /dev/null +++ b/rosapi/setup.py @@ -0,0 +1,25 @@ +from setuptools import find_packages, setup + +package_name = 'rosapi' + +setup( + name=package_name, + version='1.3.2', + packages=find_packages(exclude=['test']), + data_files=[ + ], + install_requires=['setuptools'], + zip_safe=True, + author='Jonathan Mace', + author_email='jonathan.c.mace@gmail.com', + maintainer='Jihoon Lee, Foxglove', + maintainer_email='jihoonlee.in@gmail.com, ros-tooling@foxglove.dev', + description='Provides service calls for getting ros meta-information, like list of topics, services, params, etc.', + license='BSD', + tests_require=['pytest'], + entry_points={ + 'console_scripts': [ + 'rosapi_node = rosapi.rosapi_node:main' + ], + }, +) \ No newline at end of file From e3f823eb580efe869931d6afd78bd17e8b551c75 Mon Sep 17 00:00:00 2001 From: Eric Gallimore Date: Tue, 16 Jul 2024 14:37:32 -0400 Subject: [PATCH 04/34] Change rosbridge_server to use ament_python rather than ament_cmake. --- rosbridge_server/package.xml | 5 ++--- rosbridge_server/setup.cfg | 4 ++++ rosbridge_server/setup.py | 25 +++++++++++++++++++++++++ 3 files changed, 31 insertions(+), 3 deletions(-) create mode 100644 rosbridge_server/setup.cfg create mode 100644 rosbridge_server/setup.py diff --git a/rosbridge_server/package.xml b/rosbridge_server/package.xml index 07596660c..2278e926e 100644 --- a/rosbridge_server/package.xml +++ b/rosbridge_server/package.xml @@ -14,8 +14,7 @@ Jihoon Lee Foxglove - ament_cmake - ament_cmake_ros + ament_python python3-tornado python3-twisted @@ -34,6 +33,6 @@ std_srvs - ament_cmake + ament_python diff --git a/rosbridge_server/setup.cfg b/rosbridge_server/setup.cfg new file mode 100644 index 000000000..d59d9c698 --- /dev/null +++ b/rosbridge_server/setup.cfg @@ -0,0 +1,4 @@ +[develop] +script_dir=$base/scripts +[install] +install_scripts=$base/lib diff --git a/rosbridge_server/setup.py b/rosbridge_server/setup.py new file mode 100644 index 000000000..09d27655b --- /dev/null +++ b/rosbridge_server/setup.py @@ -0,0 +1,25 @@ +from setuptools import find_packages, setup + +package_name = 'rosbridge_server' + +setup( + name=package_name, + version='1.3.2', + packages=find_packages(exclude=['test']), + data_files=[ + ], + install_requires=['setuptools'], + zip_safe=True, + author='Jonathan Mace', + author_email='jonathan.c.mace@gmail.com', + maintainer='Jihoon Lee, Foxglove', + maintainer_email='jihoonlee.in@gmail.com, ros-tooling@foxglove.dev', + description='A WebSocket interface to rosbridge.', + license='BSD', + tests_require=['pytest'], + entry_points={ + 'console_scripts': [ + 'rosbridge_websocket = rosbridge_server.rosbridge_websocket:main' + ], + }, +) \ No newline at end of file From 81b6172b0a248e68cd918bca2bd35b1a91c6b5ef Mon Sep 17 00:00:00 2001 From: Eric Gallimore Date: Tue, 16 Jul 2024 14:42:05 -0400 Subject: [PATCH 05/34] Fix setup.py formatting. --- rosapi/setup.py | 39 ++++++++++++++++++--------------------- rosbridge_server/setup.py | 39 ++++++++++++++++++--------------------- 2 files changed, 36 insertions(+), 42 deletions(-) diff --git a/rosapi/setup.py b/rosapi/setup.py index 75b459fe4..865703331 100644 --- a/rosapi/setup.py +++ b/rosapi/setup.py @@ -1,25 +1,22 @@ from setuptools import find_packages, setup -package_name = 'rosapi' +package_name = "rosapi" setup( - name=package_name, - version='1.3.2', - packages=find_packages(exclude=['test']), - data_files=[ - ], - install_requires=['setuptools'], - zip_safe=True, - author='Jonathan Mace', - author_email='jonathan.c.mace@gmail.com', - maintainer='Jihoon Lee, Foxglove', - maintainer_email='jihoonlee.in@gmail.com, ros-tooling@foxglove.dev', - description='Provides service calls for getting ros meta-information, like list of topics, services, params, etc.', - license='BSD', - tests_require=['pytest'], - entry_points={ - 'console_scripts': [ - 'rosapi_node = rosapi.rosapi_node:main' - ], - }, -) \ No newline at end of file + name=package_name, + version="1.3.2", + packages=find_packages(exclude=["test"]), + data_files=[], + install_requires=["setuptools"], + zip_safe=True, + author="Jonathan Mace", + author_email="jonathan.c.mace@gmail.com", + maintainer="Jihoon Lee, Foxglove", + maintainer_email="jihoonlee.in@gmail.com, ros-tooling@foxglove.dev", + description="Provides service calls for getting ros meta-information, like list of topics, services, params, etc.", + license="BSD", + tests_require=["pytest"], + entry_points={ + "console_scripts": ["rosapi_node = rosapi.rosapi_node:main"], + }, +) diff --git a/rosbridge_server/setup.py b/rosbridge_server/setup.py index 09d27655b..cbb5b9ab6 100644 --- a/rosbridge_server/setup.py +++ b/rosbridge_server/setup.py @@ -1,25 +1,22 @@ from setuptools import find_packages, setup -package_name = 'rosbridge_server' +package_name = "rosbridge_server" setup( - name=package_name, - version='1.3.2', - packages=find_packages(exclude=['test']), - data_files=[ - ], - install_requires=['setuptools'], - zip_safe=True, - author='Jonathan Mace', - author_email='jonathan.c.mace@gmail.com', - maintainer='Jihoon Lee, Foxglove', - maintainer_email='jihoonlee.in@gmail.com, ros-tooling@foxglove.dev', - description='A WebSocket interface to rosbridge.', - license='BSD', - tests_require=['pytest'], - entry_points={ - 'console_scripts': [ - 'rosbridge_websocket = rosbridge_server.rosbridge_websocket:main' - ], - }, -) \ No newline at end of file + name=package_name, + version="1.3.2", + packages=find_packages(exclude=["test"]), + data_files=[], + install_requires=["setuptools"], + zip_safe=True, + author="Jonathan Mace", + author_email="jonathan.c.mace@gmail.com", + maintainer="Jihoon Lee, Foxglove", + maintainer_email="jihoonlee.in@gmail.com, ros-tooling@foxglove.dev", + description="A WebSocket interface to rosbridge.", + license="BSD", + tests_require=["pytest"], + entry_points={ + "console_scripts": ["rosbridge_websocket = rosbridge_server.rosbridge_websocket:main"], + }, +) From a6d28c6042ac419d1805f89fbf9163fb11188acf Mon Sep 17 00:00:00 2001 From: Eric Gallimore Date: Tue, 16 Jul 2024 14:46:07 -0400 Subject: [PATCH 06/34] Run pre-commit and commit fixes. (Not sure why this is needed, since some of these files aren't touched in this branch.) --- rosapi/src/rosapi/objectutils.py | 3 ++- rosapi/src/rosapi/params.py | 1 + rosapi/test/test_stringify_field_types.py | 3 ++- rosbridge_server/scripts/rosbridge_websocket | 2 +- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/rosapi/src/rosapi/objectutils.py b/rosapi/src/rosapi/objectutils.py index 0c981c051..7a31a0ad5 100644 --- a/rosapi/src/rosapi/objectutils.py +++ b/rosapi/src/rosapi/objectutils.py @@ -35,9 +35,10 @@ import logging import re -from rosapi.stringify_field_types import stringify_field_types from rosbridge_library.internal import ros_loader +from rosapi.stringify_field_types import stringify_field_types + # Keep track of atomic types and special types atomics = [ "bool", diff --git a/rosapi/src/rosapi/params.py b/rosapi/src/rosapi/params.py index 988324895..795dd2b4f 100644 --- a/rosapi/src/rosapi/params.py +++ b/rosapi/src/rosapi/params.py @@ -40,6 +40,7 @@ from rclpy.parameter import get_parameter_value from ros2node.api import get_absolute_node_name from ros2param.api import call_get_parameters, call_set_parameters + from rosapi.proxy import get_nodes """ Methods to interact with the param server. Values have to be passed diff --git a/rosapi/test/test_stringify_field_types.py b/rosapi/test/test_stringify_field_types.py index ca551bbd0..b6e36bc63 100644 --- a/rosapi/test/test_stringify_field_types.py +++ b/rosapi/test/test_stringify_field_types.py @@ -1,9 +1,10 @@ #!/usr/bin/env python import unittest -from rosapi.stringify_field_types import stringify_field_types from rosbridge_library.internal.ros_loader import InvalidModuleException +from rosapi.stringify_field_types import stringify_field_types + class TestObjectUtils(unittest.TestCase): def test_stringify_field_types(self): diff --git a/rosbridge_server/scripts/rosbridge_websocket b/rosbridge_server/scripts/rosbridge_websocket index 647069442..c5eccad0b 120000 --- a/rosbridge_server/scripts/rosbridge_websocket +++ b/rosbridge_server/scripts/rosbridge_websocket @@ -1 +1 @@ -rosbridge_websocket.py \ No newline at end of file +rosbridge_websocket.py From 75ec31464ced059b4d9f0aca1afe72b0aeb6f638 Mon Sep 17 00:00:00 2001 From: Eric Gallimore Date: Tue, 16 Jul 2024 14:50:26 -0400 Subject: [PATCH 07/34] Revert inadvertent changes to rosbridge_websocket symlink. --- rosbridge_server/scripts/rosbridge_websocket | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rosbridge_server/scripts/rosbridge_websocket b/rosbridge_server/scripts/rosbridge_websocket index c5eccad0b..647069442 120000 --- a/rosbridge_server/scripts/rosbridge_websocket +++ b/rosbridge_server/scripts/rosbridge_websocket @@ -1 +1 @@ -rosbridge_websocket.py +rosbridge_websocket.py \ No newline at end of file From 609e03748ead113957689f70c1e44a532fbbbe8c Mon Sep 17 00:00:00 2001 From: Eric Gallimore Date: Tue, 16 Jul 2024 15:15:38 -0400 Subject: [PATCH 08/34] Fix launch files in rosbridge_server. --- rosbridge_server/setup.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rosbridge_server/setup.py b/rosbridge_server/setup.py index cbb5b9ab6..78f937c2e 100644 --- a/rosbridge_server/setup.py +++ b/rosbridge_server/setup.py @@ -1,3 +1,5 @@ +from glob import glob +import os from setuptools import find_packages, setup package_name = "rosbridge_server" @@ -6,7 +8,7 @@ name=package_name, version="1.3.2", packages=find_packages(exclude=["test"]), - data_files=[], + data_files=[(os.path.join('share', package_name, 'launch'), glob(os.path.join('launch', '*launch.[pxy][yma]*')))], install_requires=["setuptools"], zip_safe=True, author="Jonathan Mace", From f7b258e116ab9b376a62a8a7a52351b7d40b3fe0 Mon Sep 17 00:00:00 2001 From: Eric Gallimore Date: Tue, 16 Jul 2024 17:47:29 -0400 Subject: [PATCH 09/34] Fix setup.cfg paths. --- rosapi/setup.cfg | 4 ++-- rosbridge_server/setup.cfg | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/rosapi/setup.cfg b/rosapi/setup.cfg index d59d9c698..7b315f355 100644 --- a/rosapi/setup.cfg +++ b/rosapi/setup.cfg @@ -1,4 +1,4 @@ [develop] -script_dir=$base/scripts +script_dir=$base/lib/rosapi [install] -install_scripts=$base/lib +install_scripts=$base/lib/rosapi diff --git a/rosbridge_server/setup.cfg b/rosbridge_server/setup.cfg index d59d9c698..ffe2ab328 100644 --- a/rosbridge_server/setup.cfg +++ b/rosbridge_server/setup.cfg @@ -1,4 +1,4 @@ [develop] -script_dir=$base/scripts +script_dir=$base/lib/rosbridge_server [install] -install_scripts=$base/lib +install_scripts=$base/lib/rosbridge_server From 88534ab5bddf1cb97ad16b07da3f42cb3843607c Mon Sep 17 00:00:00 2001 From: Eric Gallimore Date: Tue, 16 Jul 2024 17:50:40 -0400 Subject: [PATCH 10/34] Fix setup.py data_files. --- rosapi/setup.py | 8 +++++++- rosbridge_server/setup.py | 12 +++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/rosapi/setup.py b/rosapi/setup.py index 865703331..d7b8752a7 100644 --- a/rosapi/setup.py +++ b/rosapi/setup.py @@ -1,3 +1,4 @@ +import os from setuptools import find_packages, setup package_name = "rosapi" @@ -6,7 +7,12 @@ name=package_name, version="1.3.2", packages=find_packages(exclude=["test"]), - data_files=[], + data_files=[ + # Install marker file in the package index + ("share/ament_index/resource_index/packages", ["resource/" + package_name]), + # Include our package.xml file + (os.path.join("share", package_name), ["package.xml"]), + ], install_requires=["setuptools"], zip_safe=True, author="Jonathan Mace", diff --git a/rosbridge_server/setup.py b/rosbridge_server/setup.py index 78f937c2e..70c0516cd 100644 --- a/rosbridge_server/setup.py +++ b/rosbridge_server/setup.py @@ -8,7 +8,17 @@ name=package_name, version="1.3.2", packages=find_packages(exclude=["test"]), - data_files=[(os.path.join('share', package_name, 'launch'), glob(os.path.join('launch', '*launch.[pxy][yma]*')))], + data_files=[ + # Install marker file in the package index + ("share/ament_index/resource_index/packages", ["resource/" + package_name]), + # Include our package.xml file + (os.path.join("share", package_name), ["package.xml"]), + # Include all launch files. + ( + os.path.join("share", package_name, "launch"), + glob(os.path.join("launch", "*launch.[pxy][yma]*")), + ), + ], install_requires=["setuptools"], zip_safe=True, author="Jonathan Mace", From 1617efcaa75b235fe8096ef79d3064a6d23dc5c5 Mon Sep 17 00:00:00 2001 From: Eric Gallimore Date: Tue, 16 Jul 2024 17:57:16 -0400 Subject: [PATCH 11/34] Moved rosapi_node and rosbridge_websocket.py into respective packages. --- rosapi/{scripts/rosapi_node => src/rosapi/rosapi_node.py} | 0 rosbridge_server/scripts/rosbridge_websocket | 1 - .../{scripts => src/rosbridge_server}/rosbridge_websocket.py | 0 3 files changed, 1 deletion(-) rename rosapi/{scripts/rosapi_node => src/rosapi/rosapi_node.py} (100%) mode change 100755 => 100644 delete mode 120000 rosbridge_server/scripts/rosbridge_websocket rename rosbridge_server/{scripts => src/rosbridge_server}/rosbridge_websocket.py (100%) mode change 100755 => 100644 diff --git a/rosapi/scripts/rosapi_node b/rosapi/src/rosapi/rosapi_node.py old mode 100755 new mode 100644 similarity index 100% rename from rosapi/scripts/rosapi_node rename to rosapi/src/rosapi/rosapi_node.py diff --git a/rosbridge_server/scripts/rosbridge_websocket b/rosbridge_server/scripts/rosbridge_websocket deleted file mode 120000 index 647069442..000000000 --- a/rosbridge_server/scripts/rosbridge_websocket +++ /dev/null @@ -1 +0,0 @@ -rosbridge_websocket.py \ No newline at end of file diff --git a/rosbridge_server/scripts/rosbridge_websocket.py b/rosbridge_server/src/rosbridge_server/rosbridge_websocket.py old mode 100755 new mode 100644 similarity index 100% rename from rosbridge_server/scripts/rosbridge_websocket.py rename to rosbridge_server/src/rosbridge_server/rosbridge_websocket.py From b808d1aec5bee8d1b3251b421a2a485af9b442d5 Mon Sep 17 00:00:00 2001 From: Eric Gallimore Date: Tue, 16 Jul 2024 17:59:26 -0400 Subject: [PATCH 12/34] Add resource files. --- rosapi/resource/rosapi | 0 rosbridge_server/resource/rosbridge_server | 0 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 rosapi/resource/rosapi create mode 100644 rosbridge_server/resource/rosbridge_server diff --git a/rosapi/resource/rosapi b/rosapi/resource/rosapi new file mode 100644 index 000000000..e69de29bb diff --git a/rosbridge_server/resource/rosbridge_server b/rosbridge_server/resource/rosbridge_server new file mode 100644 index 000000000..e69de29bb From 18766814e759ce9f6fc66e3b819b7ce68a65776c Mon Sep 17 00:00:00 2001 From: Eric Gallimore Date: Tue, 16 Jul 2024 18:11:20 -0400 Subject: [PATCH 13/34] Reorganize package to follow ROS2 python convention (and resolve issue with find_packages) --- rosapi/{src => }/rosapi/__init__.py | 0 rosapi/{src => }/rosapi/glob_helper.py | 0 rosapi/{src => }/rosapi/objectutils.py | 0 rosapi/{src => }/rosapi/params.py | 0 rosapi/{src => }/rosapi/proxy.py | 0 rosapi/{src => }/rosapi/rosapi_node.py | 0 rosapi/{src => }/rosapi/stringify_field_types.py | 0 rosbridge_server/{src => }/rosbridge_server/__init__.py | 0 rosbridge_server/{src => }/rosbridge_server/client_manager.py | 0 .../{src => }/rosbridge_server/rosbridge_websocket.py | 0 rosbridge_server/{src => }/rosbridge_server/websocket_handler.py | 0 11 files changed, 0 insertions(+), 0 deletions(-) rename rosapi/{src => }/rosapi/__init__.py (100%) rename rosapi/{src => }/rosapi/glob_helper.py (100%) rename rosapi/{src => }/rosapi/objectutils.py (100%) rename rosapi/{src => }/rosapi/params.py (100%) rename rosapi/{src => }/rosapi/proxy.py (100%) rename rosapi/{src => }/rosapi/rosapi_node.py (100%) rename rosapi/{src => }/rosapi/stringify_field_types.py (100%) rename rosbridge_server/{src => }/rosbridge_server/__init__.py (100%) rename rosbridge_server/{src => }/rosbridge_server/client_manager.py (100%) rename rosbridge_server/{src => }/rosbridge_server/rosbridge_websocket.py (100%) rename rosbridge_server/{src => }/rosbridge_server/websocket_handler.py (100%) mode change 100755 => 100644 diff --git a/rosapi/src/rosapi/__init__.py b/rosapi/rosapi/__init__.py similarity index 100% rename from rosapi/src/rosapi/__init__.py rename to rosapi/rosapi/__init__.py diff --git a/rosapi/src/rosapi/glob_helper.py b/rosapi/rosapi/glob_helper.py similarity index 100% rename from rosapi/src/rosapi/glob_helper.py rename to rosapi/rosapi/glob_helper.py diff --git a/rosapi/src/rosapi/objectutils.py b/rosapi/rosapi/objectutils.py similarity index 100% rename from rosapi/src/rosapi/objectutils.py rename to rosapi/rosapi/objectutils.py diff --git a/rosapi/src/rosapi/params.py b/rosapi/rosapi/params.py similarity index 100% rename from rosapi/src/rosapi/params.py rename to rosapi/rosapi/params.py diff --git a/rosapi/src/rosapi/proxy.py b/rosapi/rosapi/proxy.py similarity index 100% rename from rosapi/src/rosapi/proxy.py rename to rosapi/rosapi/proxy.py diff --git a/rosapi/src/rosapi/rosapi_node.py b/rosapi/rosapi/rosapi_node.py similarity index 100% rename from rosapi/src/rosapi/rosapi_node.py rename to rosapi/rosapi/rosapi_node.py diff --git a/rosapi/src/rosapi/stringify_field_types.py b/rosapi/rosapi/stringify_field_types.py similarity index 100% rename from rosapi/src/rosapi/stringify_field_types.py rename to rosapi/rosapi/stringify_field_types.py diff --git a/rosbridge_server/src/rosbridge_server/__init__.py b/rosbridge_server/rosbridge_server/__init__.py similarity index 100% rename from rosbridge_server/src/rosbridge_server/__init__.py rename to rosbridge_server/rosbridge_server/__init__.py diff --git a/rosbridge_server/src/rosbridge_server/client_manager.py b/rosbridge_server/rosbridge_server/client_manager.py similarity index 100% rename from rosbridge_server/src/rosbridge_server/client_manager.py rename to rosbridge_server/rosbridge_server/client_manager.py diff --git a/rosbridge_server/src/rosbridge_server/rosbridge_websocket.py b/rosbridge_server/rosbridge_server/rosbridge_websocket.py similarity index 100% rename from rosbridge_server/src/rosbridge_server/rosbridge_websocket.py rename to rosbridge_server/rosbridge_server/rosbridge_websocket.py diff --git a/rosbridge_server/src/rosbridge_server/websocket_handler.py b/rosbridge_server/rosbridge_server/websocket_handler.py old mode 100755 new mode 100644 similarity index 100% rename from rosbridge_server/src/rosbridge_server/websocket_handler.py rename to rosbridge_server/rosbridge_server/websocket_handler.py From 24317fcb399ac0623c521435919ed85832fefa11 Mon Sep 17 00:00:00 2001 From: Eric Gallimore Date: Tue, 16 Jul 2024 18:14:55 -0400 Subject: [PATCH 14/34] Run pre-commit and fix linting errors. --- rosapi/setup.py | 1 + rosbridge_server/setup.py | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/rosapi/setup.py b/rosapi/setup.py index d7b8752a7..d86d5febe 100644 --- a/rosapi/setup.py +++ b/rosapi/setup.py @@ -1,4 +1,5 @@ import os + from setuptools import find_packages, setup package_name = "rosapi" diff --git a/rosbridge_server/setup.py b/rosbridge_server/setup.py index 70c0516cd..3f98a8e28 100644 --- a/rosbridge_server/setup.py +++ b/rosbridge_server/setup.py @@ -1,5 +1,6 @@ -from glob import glob import os +from glob import glob + from setuptools import find_packages, setup package_name = "rosbridge_server" From 974c6b700aaaab666fff814f2ec19596e94d5b52 Mon Sep 17 00:00:00 2001 From: Brad Martin <52003535+bmartin427@users.noreply.github.com> Date: Wed, 14 Aug 2024 23:02:38 -0400 Subject: [PATCH 15/34] rosapi: Don't start parameter services that aren't spun (#943) (#944) --- rosapi/src/rosapi/params.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rosapi/src/rosapi/params.py b/rosapi/src/rosapi/params.py index 988324895..36af6913f 100644 --- a/rosapi/src/rosapi/params.py +++ b/rosapi/src/rosapi/params.py @@ -75,7 +75,9 @@ def init(parent_node_name): parent_node_basename = parent_node_name.split("/")[-1] param_node_name = f"{parent_node_basename}_params" _node = rclpy.create_node( - param_node_name, cli_args=["--ros-args", "-r", f"__node:={param_node_name}"] + param_node_name, + cli_args=["--ros-args", "-r", f"__node:={param_node_name}"], + start_parameter_services=False, ) _parent_node_name = get_absolute_node_name(parent_node_name) From 8b0b4c5aa85173fe0efc709eb2a85cb8d90b4732 Mon Sep 17 00:00:00 2001 From: Brad Martin <52003535+bmartin427@users.noreply.github.com> Date: Wed, 14 Aug 2024 23:10:40 -0400 Subject: [PATCH 16/34] rosbridge_websocket: Stop websocket server if ROS shuts down (#945) (#946) Signed-off-by: Brad Martin --- rosbridge_server/scripts/rosbridge_websocket.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/rosbridge_server/scripts/rosbridge_websocket.py b/rosbridge_server/scripts/rosbridge_websocket.py index bfa968d15..49d2a52b6 100755 --- a/rosbridge_server/scripts/rosbridge_websocket.py +++ b/rosbridge_server/scripts/rosbridge_websocket.py @@ -337,7 +337,13 @@ def main(args=None): executor = rclpy.executors.SingleThreadedExecutor() executor.add_node(node) - spin_callback = PeriodicCallback(lambda: executor.spin_once(timeout_sec=0.01), 1) + + def spin_ros(): + executor.spin_once(timeout_sec=0.01) + if not rclpy.ok(): + shutdown_hook() + + spin_callback = PeriodicCallback(spin_ros, 1) spin_callback.start() try: start_hook() From baa463a1327ee404946dfdc711e9683ad332942a Mon Sep 17 00:00:00 2001 From: Brad Martin <52003535+bmartin427@users.noreply.github.com> Date: Wed, 14 Aug 2024 23:18:29 -0400 Subject: [PATCH 17/34] Avoid stale subscription when unsubscribing during resubscription (#947) (#948) If a client asks to subscribe to the same topic more than once, then disconnects, only a pending 'new' subscription may get deleted, leaving the 'old' subscription active indefinitely. Signed-off-by: Brad Martin --- rosbridge_library/src/rosbridge_library/internal/subscribers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rosbridge_library/src/rosbridge_library/internal/subscribers.py b/rosbridge_library/src/rosbridge_library/internal/subscribers.py index 0bb94a809..c698c0b79 100644 --- a/rosbridge_library/src/rosbridge_library/internal/subscribers.py +++ b/rosbridge_library/src/rosbridge_library/internal/subscribers.py @@ -196,7 +196,7 @@ def unsubscribe(self, client_id): with self.rlock: if client_id in self.new_subscriptions: del self.new_subscriptions[client_id] - else: + if client_id in self.subscriptions: del self.subscriptions[client_id] def has_subscribers(self): From 996fddd6d4c4e60c78d11f2df61a892d2164cea3 Mon Sep 17 00:00:00 2001 From: ManuETR <37251724+ManuETR@users.noreply.github.com> Date: Thu, 15 Aug 2024 05:27:13 +0200 Subject: [PATCH 18/34] docs: update ROSBRIDGE_PROTOCOL.md - correcting indentation (#949) Add whitespace in front of all ROS action operations -- for correct indentation in Markdown --- ROSBRIDGE_PROTOCOL.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ROSBRIDGE_PROTOCOL.md b/ROSBRIDGE_PROTOCOL.md index e58850d61..4a7e82468 100644 --- a/ROSBRIDGE_PROTOCOL.md +++ b/ROSBRIDGE_PROTOCOL.md @@ -93,12 +93,12 @@ ROS operations: * **call_service** - a service call * **service_response** - a service response * Actions: - * **advertise_action** - advertise an external action server - * **unadvertise_action** - unadvertise an external action server - * **send_action_goal** - a goal sent to an action server - * **cancel_action_goal** - cancel an in-progress action goal - * **action_feedback** - feedback messages from an action server - * **action_result** - an action result + * **advertise_action** - advertise an external action server + * **unadvertise_action** - unadvertise an external action server + * **send_action_goal** - a goal sent to an action server + * **cancel_action_goal** - cancel an in-progress action goal + * **action_feedback** - feedback messages from an action server + * **action_result** - an action result In general, actions or operations that the client takes (such as publishing and subscribing) have opcodes which are verbs (subscribe, call_service, unadvertise From febe1c46df9066ff468932924f99cec52b04517e Mon Sep 17 00:00:00 2001 From: Dimitri Nikitopoulos Date: Thu, 15 Aug 2024 08:53:03 -0400 Subject: [PATCH 19/34] fix: update new subs with dds from publisher (#940) --- .../src/rosbridge_library/internal/subscribers.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/rosbridge_library/src/rosbridge_library/internal/subscribers.py b/rosbridge_library/src/rosbridge_library/internal/subscribers.py index c698c0b79..a64c90b7f 100644 --- a/rosbridge_library/src/rosbridge_library/internal/subscribers.py +++ b/rosbridge_library/src/rosbridge_library/internal/subscribers.py @@ -176,6 +176,11 @@ def subscribe(self, client_id, callback): # In any case, the first message is handled using new_sub_callback, # which adds the new callback to the subscriptions dictionary. self.new_subscriptions.update({client_id: callback}) + infos = self.node_handle.get_publishers_info_by_topic(self.topic) + if any(pub.qos_profile.durability == DurabilityPolicy.TRANSIENT_LOCAL for pub in infos): + self.qos.durability = DurabilityPolicy.TRANSIENT_LOCAL + if any(pub.qos_profile.reliability == ReliabilityPolicy.BEST_EFFORT for pub in infos): + self.qos.reliability = ReliabilityPolicy.BEST_EFFORT if self.new_subscriber is None: self.new_subscriber = self.node_handle.create_subscription( self.msg_class, From 677dcaeefa9f5c65633e9ef1dfb5083e62b06ddd Mon Sep 17 00:00:00 2001 From: Eric Gallimore Date: Thu, 15 Aug 2024 13:11:15 -0400 Subject: [PATCH 20/34] Fixed executable bit on scripts. --- rosapi/rosapi/rosapi_node.py | 0 rosbridge_server/rosbridge_server/rosbridge_websocket.py | 0 rosbridge_server/rosbridge_server/websocket_handler.py | 0 3 files changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 rosapi/rosapi/rosapi_node.py mode change 100644 => 100755 rosbridge_server/rosbridge_server/rosbridge_websocket.py mode change 100644 => 100755 rosbridge_server/rosbridge_server/websocket_handler.py diff --git a/rosapi/rosapi/rosapi_node.py b/rosapi/rosapi/rosapi_node.py old mode 100644 new mode 100755 diff --git a/rosbridge_server/rosbridge_server/rosbridge_websocket.py b/rosbridge_server/rosbridge_server/rosbridge_websocket.py old mode 100644 new mode 100755 diff --git a/rosbridge_server/rosbridge_server/websocket_handler.py b/rosbridge_server/rosbridge_server/websocket_handler.py old mode 100644 new mode 100755 From 55b8fa321804fdd3b8b1f3e7dd1d987ef73e30f0 Mon Sep 17 00:00:00 2001 From: Ezra Brooks Date: Thu, 15 Aug 2024 13:32:29 -0600 Subject: [PATCH 21/34] Fix length-limited list types (#840) --- .../internal/message_conversion.py | 4 ++-- .../test/internal/test_message_conversion.py | 18 ++++++++++++++++++ rosbridge_test_msgs/CMakeLists.txt | 1 + .../msg/TestNestedBoundedArray.msg | 1 + 4 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 rosbridge_test_msgs/msg/TestNestedBoundedArray.msg diff --git a/rosbridge_library/src/rosbridge_library/internal/message_conversion.py b/rosbridge_library/src/rosbridge_library/internal/message_conversion.py index d3361cfa3..a0d833ce2 100644 --- a/rosbridge_library/src/rosbridge_library/internal/message_conversion.py +++ b/rosbridge_library/src/rosbridge_library/internal/message_conversion.py @@ -90,7 +90,8 @@ ] ros_header_types = ["Header", "std_msgs/Header", "roslib/Header"] ros_binary_types = ["uint8[]", "char[]", "sequence", "sequence"] -list_tokens = re.compile("<(.+?)>") +# Remove the list type wrapper, and length specifier, from rostypes i.e. sequence +list_tokens = re.compile(r"<(.+?)(, \d+)?>") bounded_array_tokens = re.compile(r"(.+)\[.*\]") ros_binary_types_list_braces = [ ("uint8[]", re.compile(r"uint8\[[^\]]*\]")), @@ -392,7 +393,6 @@ def _to_object_inst(msg, rostype, roottype, clock, inst, stack): inst.stamp = clock.now().to_msg() inst_fields = inst.get_fields_and_field_types() - for field_name in msg: # Add this field to the field stack field_stack = stack + [field_name] diff --git a/rosbridge_library/test/internal/test_message_conversion.py b/rosbridge_library/test/internal/test_message_conversion.py index 9ccba4f05..f837e6275 100755 --- a/rosbridge_library/test/internal/test_message_conversion.py +++ b/rosbridge_library/test/internal/test_message_conversion.py @@ -316,3 +316,21 @@ def test_float32_msg(rostype, data): ints = list(map(int, range(0, 16))) ret = test_float32_msg(rostype, ints) np.testing.assert_array_equal(ret, np.array(ints)) + + # Test a float32 array with a length with non-numeric characters in it + def test_float32_complexboundedarray(self): + def test_nestedboundedarray_msg(rostype, data): + msg = {"data": {"data": data}} + inst = ros_loader.get_message_instance(rostype) + c.populate_instance(msg, inst) + self.validate_instance(inst) + return inst.data + + for msgtype in ["TestNestedBoundedArray"]: + rostype = "rosbridge_test_msgs/" + msgtype + + # From List[float] + floats = list(map(float, range(0, 16))) + ret = test_nestedboundedarray_msg(rostype, floats) + + self.assertEqual(c._from_inst(ret, rostype), {"data": floats}) diff --git a/rosbridge_test_msgs/CMakeLists.txt b/rosbridge_test_msgs/CMakeLists.txt index e327c419d..4ef1e87df 100644 --- a/rosbridge_test_msgs/CMakeLists.txt +++ b/rosbridge_test_msgs/CMakeLists.txt @@ -20,6 +20,7 @@ rosidl_generate_interfaces(${PROJECT_NAME} msg/TestUInt8FixedSizeArray16.msg msg/TestFloat32Array.msg msg/TestFloat32BoundedArray.msg + msg/TestNestedBoundedArray.msg srv/AddTwoInts.srv srv/SendBytes.srv srv/TestArrayRequest.srv diff --git a/rosbridge_test_msgs/msg/TestNestedBoundedArray.msg b/rosbridge_test_msgs/msg/TestNestedBoundedArray.msg new file mode 100644 index 000000000..a35d82372 --- /dev/null +++ b/rosbridge_test_msgs/msg/TestNestedBoundedArray.msg @@ -0,0 +1 @@ +TestFloat32BoundedArray data From f7aa27a4515ff3af54c40f9a4877e5fc3edb981c Mon Sep 17 00:00:00 2001 From: Eric Gallimore Date: Tue, 16 Jul 2024 14:32:03 -0400 Subject: [PATCH 22/34] Change rosapi package to use ament_python rather than ament_cmake. --- rosapi/package.xml | 4 ++-- rosapi/setup.cfg | 4 ++++ rosapi/setup.py | 25 +++++++++++++++++++++++++ 3 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 rosapi/setup.cfg create mode 100644 rosapi/setup.py diff --git a/rosapi/package.xml b/rosapi/package.xml index af550dc72..c81c9b06f 100644 --- a/rosapi/package.xml +++ b/rosapi/package.xml @@ -17,7 +17,7 @@ Jihoon Lee Foxglove - ament_cmake_ros + ament_python rosapi_msgs builtin_interfaces @@ -41,7 +41,7 @@ rmw_dds_common - ament_cmake + ament_python diff --git a/rosapi/setup.cfg b/rosapi/setup.cfg new file mode 100644 index 000000000..d59d9c698 --- /dev/null +++ b/rosapi/setup.cfg @@ -0,0 +1,4 @@ +[develop] +script_dir=$base/scripts +[install] +install_scripts=$base/lib diff --git a/rosapi/setup.py b/rosapi/setup.py new file mode 100644 index 000000000..75b459fe4 --- /dev/null +++ b/rosapi/setup.py @@ -0,0 +1,25 @@ +from setuptools import find_packages, setup + +package_name = 'rosapi' + +setup( + name=package_name, + version='1.3.2', + packages=find_packages(exclude=['test']), + data_files=[ + ], + install_requires=['setuptools'], + zip_safe=True, + author='Jonathan Mace', + author_email='jonathan.c.mace@gmail.com', + maintainer='Jihoon Lee, Foxglove', + maintainer_email='jihoonlee.in@gmail.com, ros-tooling@foxglove.dev', + description='Provides service calls for getting ros meta-information, like list of topics, services, params, etc.', + license='BSD', + tests_require=['pytest'], + entry_points={ + 'console_scripts': [ + 'rosapi_node = rosapi.rosapi_node:main' + ], + }, +) \ No newline at end of file From 28eb1c0a2acea66f383de3298d51522059c7fa52 Mon Sep 17 00:00:00 2001 From: Eric Gallimore Date: Tue, 16 Jul 2024 14:37:32 -0400 Subject: [PATCH 23/34] Change rosbridge_server to use ament_python rather than ament_cmake. --- rosbridge_server/package.xml | 5 ++--- rosbridge_server/setup.cfg | 4 ++++ rosbridge_server/setup.py | 25 +++++++++++++++++++++++++ 3 files changed, 31 insertions(+), 3 deletions(-) create mode 100644 rosbridge_server/setup.cfg create mode 100644 rosbridge_server/setup.py diff --git a/rosbridge_server/package.xml b/rosbridge_server/package.xml index 07596660c..2278e926e 100644 --- a/rosbridge_server/package.xml +++ b/rosbridge_server/package.xml @@ -14,8 +14,7 @@ Jihoon Lee Foxglove - ament_cmake - ament_cmake_ros + ament_python python3-tornado python3-twisted @@ -34,6 +33,6 @@ std_srvs - ament_cmake + ament_python diff --git a/rosbridge_server/setup.cfg b/rosbridge_server/setup.cfg new file mode 100644 index 000000000..d59d9c698 --- /dev/null +++ b/rosbridge_server/setup.cfg @@ -0,0 +1,4 @@ +[develop] +script_dir=$base/scripts +[install] +install_scripts=$base/lib diff --git a/rosbridge_server/setup.py b/rosbridge_server/setup.py new file mode 100644 index 000000000..09d27655b --- /dev/null +++ b/rosbridge_server/setup.py @@ -0,0 +1,25 @@ +from setuptools import find_packages, setup + +package_name = 'rosbridge_server' + +setup( + name=package_name, + version='1.3.2', + packages=find_packages(exclude=['test']), + data_files=[ + ], + install_requires=['setuptools'], + zip_safe=True, + author='Jonathan Mace', + author_email='jonathan.c.mace@gmail.com', + maintainer='Jihoon Lee, Foxglove', + maintainer_email='jihoonlee.in@gmail.com, ros-tooling@foxglove.dev', + description='A WebSocket interface to rosbridge.', + license='BSD', + tests_require=['pytest'], + entry_points={ + 'console_scripts': [ + 'rosbridge_websocket = rosbridge_server.rosbridge_websocket:main' + ], + }, +) \ No newline at end of file From ad1aa25cbe05ad473098695f78138531984fac8b Mon Sep 17 00:00:00 2001 From: Eric Gallimore Date: Tue, 16 Jul 2024 14:42:05 -0400 Subject: [PATCH 24/34] Fix setup.py formatting. --- rosapi/setup.py | 39 ++++++++++++++++++--------------------- rosbridge_server/setup.py | 39 ++++++++++++++++++--------------------- 2 files changed, 36 insertions(+), 42 deletions(-) diff --git a/rosapi/setup.py b/rosapi/setup.py index 75b459fe4..865703331 100644 --- a/rosapi/setup.py +++ b/rosapi/setup.py @@ -1,25 +1,22 @@ from setuptools import find_packages, setup -package_name = 'rosapi' +package_name = "rosapi" setup( - name=package_name, - version='1.3.2', - packages=find_packages(exclude=['test']), - data_files=[ - ], - install_requires=['setuptools'], - zip_safe=True, - author='Jonathan Mace', - author_email='jonathan.c.mace@gmail.com', - maintainer='Jihoon Lee, Foxglove', - maintainer_email='jihoonlee.in@gmail.com, ros-tooling@foxglove.dev', - description='Provides service calls for getting ros meta-information, like list of topics, services, params, etc.', - license='BSD', - tests_require=['pytest'], - entry_points={ - 'console_scripts': [ - 'rosapi_node = rosapi.rosapi_node:main' - ], - }, -) \ No newline at end of file + name=package_name, + version="1.3.2", + packages=find_packages(exclude=["test"]), + data_files=[], + install_requires=["setuptools"], + zip_safe=True, + author="Jonathan Mace", + author_email="jonathan.c.mace@gmail.com", + maintainer="Jihoon Lee, Foxglove", + maintainer_email="jihoonlee.in@gmail.com, ros-tooling@foxglove.dev", + description="Provides service calls for getting ros meta-information, like list of topics, services, params, etc.", + license="BSD", + tests_require=["pytest"], + entry_points={ + "console_scripts": ["rosapi_node = rosapi.rosapi_node:main"], + }, +) diff --git a/rosbridge_server/setup.py b/rosbridge_server/setup.py index 09d27655b..cbb5b9ab6 100644 --- a/rosbridge_server/setup.py +++ b/rosbridge_server/setup.py @@ -1,25 +1,22 @@ from setuptools import find_packages, setup -package_name = 'rosbridge_server' +package_name = "rosbridge_server" setup( - name=package_name, - version='1.3.2', - packages=find_packages(exclude=['test']), - data_files=[ - ], - install_requires=['setuptools'], - zip_safe=True, - author='Jonathan Mace', - author_email='jonathan.c.mace@gmail.com', - maintainer='Jihoon Lee, Foxglove', - maintainer_email='jihoonlee.in@gmail.com, ros-tooling@foxglove.dev', - description='A WebSocket interface to rosbridge.', - license='BSD', - tests_require=['pytest'], - entry_points={ - 'console_scripts': [ - 'rosbridge_websocket = rosbridge_server.rosbridge_websocket:main' - ], - }, -) \ No newline at end of file + name=package_name, + version="1.3.2", + packages=find_packages(exclude=["test"]), + data_files=[], + install_requires=["setuptools"], + zip_safe=True, + author="Jonathan Mace", + author_email="jonathan.c.mace@gmail.com", + maintainer="Jihoon Lee, Foxglove", + maintainer_email="jihoonlee.in@gmail.com, ros-tooling@foxglove.dev", + description="A WebSocket interface to rosbridge.", + license="BSD", + tests_require=["pytest"], + entry_points={ + "console_scripts": ["rosbridge_websocket = rosbridge_server.rosbridge_websocket:main"], + }, +) From 98b4347beecce011793e144203cd956541c829a2 Mon Sep 17 00:00:00 2001 From: Eric Gallimore Date: Tue, 16 Jul 2024 14:46:07 -0400 Subject: [PATCH 25/34] Run pre-commit and commit fixes. (Not sure why this is needed, since some of these files aren't touched in this branch.) --- rosapi/src/rosapi/objectutils.py | 3 ++- rosapi/src/rosapi/params.py | 1 + rosapi/test/test_stringify_field_types.py | 3 ++- rosbridge_server/scripts/rosbridge_websocket | 2 +- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/rosapi/src/rosapi/objectutils.py b/rosapi/src/rosapi/objectutils.py index 0c981c051..7a31a0ad5 100644 --- a/rosapi/src/rosapi/objectutils.py +++ b/rosapi/src/rosapi/objectutils.py @@ -35,9 +35,10 @@ import logging import re -from rosapi.stringify_field_types import stringify_field_types from rosbridge_library.internal import ros_loader +from rosapi.stringify_field_types import stringify_field_types + # Keep track of atomic types and special types atomics = [ "bool", diff --git a/rosapi/src/rosapi/params.py b/rosapi/src/rosapi/params.py index 36af6913f..209ab4f90 100644 --- a/rosapi/src/rosapi/params.py +++ b/rosapi/src/rosapi/params.py @@ -40,6 +40,7 @@ from rclpy.parameter import get_parameter_value from ros2node.api import get_absolute_node_name from ros2param.api import call_get_parameters, call_set_parameters + from rosapi.proxy import get_nodes """ Methods to interact with the param server. Values have to be passed diff --git a/rosapi/test/test_stringify_field_types.py b/rosapi/test/test_stringify_field_types.py index ca551bbd0..b6e36bc63 100644 --- a/rosapi/test/test_stringify_field_types.py +++ b/rosapi/test/test_stringify_field_types.py @@ -1,9 +1,10 @@ #!/usr/bin/env python import unittest -from rosapi.stringify_field_types import stringify_field_types from rosbridge_library.internal.ros_loader import InvalidModuleException +from rosapi.stringify_field_types import stringify_field_types + class TestObjectUtils(unittest.TestCase): def test_stringify_field_types(self): diff --git a/rosbridge_server/scripts/rosbridge_websocket b/rosbridge_server/scripts/rosbridge_websocket index 647069442..c5eccad0b 120000 --- a/rosbridge_server/scripts/rosbridge_websocket +++ b/rosbridge_server/scripts/rosbridge_websocket @@ -1 +1 @@ -rosbridge_websocket.py \ No newline at end of file +rosbridge_websocket.py From b9d200d569ed52654919a873df61fa0c49c983fc Mon Sep 17 00:00:00 2001 From: Eric Gallimore Date: Tue, 16 Jul 2024 14:50:26 -0400 Subject: [PATCH 26/34] Revert inadvertent changes to rosbridge_websocket symlink. --- rosbridge_server/scripts/rosbridge_websocket | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rosbridge_server/scripts/rosbridge_websocket b/rosbridge_server/scripts/rosbridge_websocket index c5eccad0b..647069442 120000 --- a/rosbridge_server/scripts/rosbridge_websocket +++ b/rosbridge_server/scripts/rosbridge_websocket @@ -1 +1 @@ -rosbridge_websocket.py +rosbridge_websocket.py \ No newline at end of file From 889b229b9ebe05232c68c826664799eee6aa971a Mon Sep 17 00:00:00 2001 From: Eric Gallimore Date: Tue, 16 Jul 2024 15:15:38 -0400 Subject: [PATCH 27/34] Fix launch files in rosbridge_server. --- rosbridge_server/setup.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rosbridge_server/setup.py b/rosbridge_server/setup.py index cbb5b9ab6..78f937c2e 100644 --- a/rosbridge_server/setup.py +++ b/rosbridge_server/setup.py @@ -1,3 +1,5 @@ +from glob import glob +import os from setuptools import find_packages, setup package_name = "rosbridge_server" @@ -6,7 +8,7 @@ name=package_name, version="1.3.2", packages=find_packages(exclude=["test"]), - data_files=[], + data_files=[(os.path.join('share', package_name, 'launch'), glob(os.path.join('launch', '*launch.[pxy][yma]*')))], install_requires=["setuptools"], zip_safe=True, author="Jonathan Mace", From 2882d8ea4f1ab905c52a91711f8800083ce8e32b Mon Sep 17 00:00:00 2001 From: Eric Gallimore Date: Tue, 16 Jul 2024 17:47:29 -0400 Subject: [PATCH 28/34] Fix setup.cfg paths. --- rosapi/setup.cfg | 4 ++-- rosbridge_server/setup.cfg | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/rosapi/setup.cfg b/rosapi/setup.cfg index d59d9c698..7b315f355 100644 --- a/rosapi/setup.cfg +++ b/rosapi/setup.cfg @@ -1,4 +1,4 @@ [develop] -script_dir=$base/scripts +script_dir=$base/lib/rosapi [install] -install_scripts=$base/lib +install_scripts=$base/lib/rosapi diff --git a/rosbridge_server/setup.cfg b/rosbridge_server/setup.cfg index d59d9c698..ffe2ab328 100644 --- a/rosbridge_server/setup.cfg +++ b/rosbridge_server/setup.cfg @@ -1,4 +1,4 @@ [develop] -script_dir=$base/scripts +script_dir=$base/lib/rosbridge_server [install] -install_scripts=$base/lib +install_scripts=$base/lib/rosbridge_server From 407af907e8fe157cfdea74331ea4dcd120926230 Mon Sep 17 00:00:00 2001 From: Eric Gallimore Date: Tue, 16 Jul 2024 17:50:40 -0400 Subject: [PATCH 29/34] Fix setup.py data_files. --- rosapi/setup.py | 8 +++++++- rosbridge_server/setup.py | 12 +++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/rosapi/setup.py b/rosapi/setup.py index 865703331..d7b8752a7 100644 --- a/rosapi/setup.py +++ b/rosapi/setup.py @@ -1,3 +1,4 @@ +import os from setuptools import find_packages, setup package_name = "rosapi" @@ -6,7 +7,12 @@ name=package_name, version="1.3.2", packages=find_packages(exclude=["test"]), - data_files=[], + data_files=[ + # Install marker file in the package index + ("share/ament_index/resource_index/packages", ["resource/" + package_name]), + # Include our package.xml file + (os.path.join("share", package_name), ["package.xml"]), + ], install_requires=["setuptools"], zip_safe=True, author="Jonathan Mace", diff --git a/rosbridge_server/setup.py b/rosbridge_server/setup.py index 78f937c2e..70c0516cd 100644 --- a/rosbridge_server/setup.py +++ b/rosbridge_server/setup.py @@ -8,7 +8,17 @@ name=package_name, version="1.3.2", packages=find_packages(exclude=["test"]), - data_files=[(os.path.join('share', package_name, 'launch'), glob(os.path.join('launch', '*launch.[pxy][yma]*')))], + data_files=[ + # Install marker file in the package index + ("share/ament_index/resource_index/packages", ["resource/" + package_name]), + # Include our package.xml file + (os.path.join("share", package_name), ["package.xml"]), + # Include all launch files. + ( + os.path.join("share", package_name, "launch"), + glob(os.path.join("launch", "*launch.[pxy][yma]*")), + ), + ], install_requires=["setuptools"], zip_safe=True, author="Jonathan Mace", From ce4d93765e18acd66cb4a17a4dd89b50992abc3a Mon Sep 17 00:00:00 2001 From: Eric Gallimore Date: Tue, 16 Jul 2024 17:57:16 -0400 Subject: [PATCH 30/34] Moved rosapi_node and rosbridge_websocket.py into respective packages. --- rosapi/{scripts/rosapi_node => src/rosapi/rosapi_node.py} | 0 rosbridge_server/scripts/rosbridge_websocket | 1 - .../{scripts => src/rosbridge_server}/rosbridge_websocket.py | 0 3 files changed, 1 deletion(-) rename rosapi/{scripts/rosapi_node => src/rosapi/rosapi_node.py} (100%) mode change 100755 => 100644 delete mode 120000 rosbridge_server/scripts/rosbridge_websocket rename rosbridge_server/{scripts => src/rosbridge_server}/rosbridge_websocket.py (100%) mode change 100755 => 100644 diff --git a/rosapi/scripts/rosapi_node b/rosapi/src/rosapi/rosapi_node.py old mode 100755 new mode 100644 similarity index 100% rename from rosapi/scripts/rosapi_node rename to rosapi/src/rosapi/rosapi_node.py diff --git a/rosbridge_server/scripts/rosbridge_websocket b/rosbridge_server/scripts/rosbridge_websocket deleted file mode 120000 index 647069442..000000000 --- a/rosbridge_server/scripts/rosbridge_websocket +++ /dev/null @@ -1 +0,0 @@ -rosbridge_websocket.py \ No newline at end of file diff --git a/rosbridge_server/scripts/rosbridge_websocket.py b/rosbridge_server/src/rosbridge_server/rosbridge_websocket.py old mode 100755 new mode 100644 similarity index 100% rename from rosbridge_server/scripts/rosbridge_websocket.py rename to rosbridge_server/src/rosbridge_server/rosbridge_websocket.py From cc005967dbe19fcd843d10714b1b67e4aef4e276 Mon Sep 17 00:00:00 2001 From: Eric Gallimore Date: Tue, 16 Jul 2024 17:59:26 -0400 Subject: [PATCH 31/34] Add resource files. --- rosapi/resource/rosapi | 0 rosbridge_server/resource/rosbridge_server | 0 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 rosapi/resource/rosapi create mode 100644 rosbridge_server/resource/rosbridge_server diff --git a/rosapi/resource/rosapi b/rosapi/resource/rosapi new file mode 100644 index 000000000..e69de29bb diff --git a/rosbridge_server/resource/rosbridge_server b/rosbridge_server/resource/rosbridge_server new file mode 100644 index 000000000..e69de29bb From 0cc24db6a63873dbd4e432e9d575910a35aa6911 Mon Sep 17 00:00:00 2001 From: Eric Gallimore Date: Tue, 16 Jul 2024 18:11:20 -0400 Subject: [PATCH 32/34] Reorganize package to follow ROS2 python convention (and resolve issue with find_packages) --- rosapi/{src => }/rosapi/__init__.py | 0 rosapi/{src => }/rosapi/glob_helper.py | 0 rosapi/{src => }/rosapi/objectutils.py | 0 rosapi/{src => }/rosapi/params.py | 0 rosapi/{src => }/rosapi/proxy.py | 0 rosapi/{src => }/rosapi/rosapi_node.py | 0 rosapi/{src => }/rosapi/stringify_field_types.py | 0 rosbridge_server/{src => }/rosbridge_server/__init__.py | 0 rosbridge_server/{src => }/rosbridge_server/client_manager.py | 0 .../{src => }/rosbridge_server/rosbridge_websocket.py | 0 rosbridge_server/{src => }/rosbridge_server/websocket_handler.py | 0 11 files changed, 0 insertions(+), 0 deletions(-) rename rosapi/{src => }/rosapi/__init__.py (100%) rename rosapi/{src => }/rosapi/glob_helper.py (100%) rename rosapi/{src => }/rosapi/objectutils.py (100%) rename rosapi/{src => }/rosapi/params.py (100%) rename rosapi/{src => }/rosapi/proxy.py (100%) rename rosapi/{src => }/rosapi/rosapi_node.py (100%) rename rosapi/{src => }/rosapi/stringify_field_types.py (100%) rename rosbridge_server/{src => }/rosbridge_server/__init__.py (100%) rename rosbridge_server/{src => }/rosbridge_server/client_manager.py (100%) rename rosbridge_server/{src => }/rosbridge_server/rosbridge_websocket.py (100%) rename rosbridge_server/{src => }/rosbridge_server/websocket_handler.py (100%) mode change 100755 => 100644 diff --git a/rosapi/src/rosapi/__init__.py b/rosapi/rosapi/__init__.py similarity index 100% rename from rosapi/src/rosapi/__init__.py rename to rosapi/rosapi/__init__.py diff --git a/rosapi/src/rosapi/glob_helper.py b/rosapi/rosapi/glob_helper.py similarity index 100% rename from rosapi/src/rosapi/glob_helper.py rename to rosapi/rosapi/glob_helper.py diff --git a/rosapi/src/rosapi/objectutils.py b/rosapi/rosapi/objectutils.py similarity index 100% rename from rosapi/src/rosapi/objectutils.py rename to rosapi/rosapi/objectutils.py diff --git a/rosapi/src/rosapi/params.py b/rosapi/rosapi/params.py similarity index 100% rename from rosapi/src/rosapi/params.py rename to rosapi/rosapi/params.py diff --git a/rosapi/src/rosapi/proxy.py b/rosapi/rosapi/proxy.py similarity index 100% rename from rosapi/src/rosapi/proxy.py rename to rosapi/rosapi/proxy.py diff --git a/rosapi/src/rosapi/rosapi_node.py b/rosapi/rosapi/rosapi_node.py similarity index 100% rename from rosapi/src/rosapi/rosapi_node.py rename to rosapi/rosapi/rosapi_node.py diff --git a/rosapi/src/rosapi/stringify_field_types.py b/rosapi/rosapi/stringify_field_types.py similarity index 100% rename from rosapi/src/rosapi/stringify_field_types.py rename to rosapi/rosapi/stringify_field_types.py diff --git a/rosbridge_server/src/rosbridge_server/__init__.py b/rosbridge_server/rosbridge_server/__init__.py similarity index 100% rename from rosbridge_server/src/rosbridge_server/__init__.py rename to rosbridge_server/rosbridge_server/__init__.py diff --git a/rosbridge_server/src/rosbridge_server/client_manager.py b/rosbridge_server/rosbridge_server/client_manager.py similarity index 100% rename from rosbridge_server/src/rosbridge_server/client_manager.py rename to rosbridge_server/rosbridge_server/client_manager.py diff --git a/rosbridge_server/src/rosbridge_server/rosbridge_websocket.py b/rosbridge_server/rosbridge_server/rosbridge_websocket.py similarity index 100% rename from rosbridge_server/src/rosbridge_server/rosbridge_websocket.py rename to rosbridge_server/rosbridge_server/rosbridge_websocket.py diff --git a/rosbridge_server/src/rosbridge_server/websocket_handler.py b/rosbridge_server/rosbridge_server/websocket_handler.py old mode 100755 new mode 100644 similarity index 100% rename from rosbridge_server/src/rosbridge_server/websocket_handler.py rename to rosbridge_server/rosbridge_server/websocket_handler.py From f017bd7e25f1c7ddba358a1dc07bb3b66a81bee2 Mon Sep 17 00:00:00 2001 From: Eric Gallimore Date: Tue, 16 Jul 2024 18:14:55 -0400 Subject: [PATCH 33/34] Run pre-commit and fix linting errors. --- rosapi/setup.py | 1 + rosbridge_server/setup.py | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/rosapi/setup.py b/rosapi/setup.py index d7b8752a7..d86d5febe 100644 --- a/rosapi/setup.py +++ b/rosapi/setup.py @@ -1,4 +1,5 @@ import os + from setuptools import find_packages, setup package_name = "rosapi" diff --git a/rosbridge_server/setup.py b/rosbridge_server/setup.py index 70c0516cd..3f98a8e28 100644 --- a/rosbridge_server/setup.py +++ b/rosbridge_server/setup.py @@ -1,5 +1,6 @@ -from glob import glob import os +from glob import glob + from setuptools import find_packages, setup package_name = "rosbridge_server" From 8a72cc64128668391f2dabc43b168b87857004ee Mon Sep 17 00:00:00 2001 From: Eric Gallimore Date: Thu, 15 Aug 2024 13:11:15 -0400 Subject: [PATCH 34/34] Fixed executable bit on scripts. --- rosapi/rosapi/rosapi_node.py | 0 rosbridge_server/rosbridge_server/rosbridge_websocket.py | 0 rosbridge_server/rosbridge_server/websocket_handler.py | 0 3 files changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 rosapi/rosapi/rosapi_node.py mode change 100644 => 100755 rosbridge_server/rosbridge_server/rosbridge_websocket.py mode change 100644 => 100755 rosbridge_server/rosbridge_server/websocket_handler.py diff --git a/rosapi/rosapi/rosapi_node.py b/rosapi/rosapi/rosapi_node.py old mode 100644 new mode 100755 diff --git a/rosbridge_server/rosbridge_server/rosbridge_websocket.py b/rosbridge_server/rosbridge_server/rosbridge_websocket.py old mode 100644 new mode 100755 diff --git a/rosbridge_server/rosbridge_server/websocket_handler.py b/rosbridge_server/rosbridge_server/websocket_handler.py old mode 100644 new mode 100755