From 59107e69aa2f6ab0a21969bda180473a248c6c65 Mon Sep 17 00:00:00 2001 From: Gonzalo Casas Date: Thu, 20 Jun 2024 21:45:26 +0200 Subject: [PATCH 1/3] Change planner type arg --- CHANGELOG.md | 1 + src/compas_fab/backends/ros/client.py | 14 +++++--------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 67bca16a7..5daf8823f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * Changed the behavior of Duration class when accepting both seconds (float) and nanoseconds (int) where the decimal point of seconds and the nanoseconds add up to more than 1 second. * Changed GH Component `ConstraintsFromPlane` to `FrameTargetFromPlane`. * Changed GH Component `ConstraintsFromTargetConfiguration` to `ConfigurationTarget`. +* Changed `RosClient` constructor to take a type for planner backend instead of a string. This also changes the name of the argument from `planner_backend` to `planner_backend_type`. ### Removed diff --git a/src/compas_fab/backends/ros/client.py b/src/compas_fab/backends/ros/client.py index fe98a4305..7a7d85a30 100644 --- a/src/compas_fab/backends/ros/client.py +++ b/src/compas_fab/backends/ros/client.py @@ -33,8 +33,6 @@ "RosClient", ] -PLANNER_BACKENDS = {"moveit": MoveItPlanner} - class CancellableRosActionResult(CancellableFutureResult): def __init__(self, goal): @@ -116,10 +114,10 @@ class RosClient(Ros, ClientInterface): Port of the ROS Bridge. Defaults to ``9090``. is_secure : :obj:`bool` ``True`` to indicate it should use a secure web socket, otherwise ``False``. - planner_backend: str - Name of the planner backend plugin to use. The plugin must be a sub-class of - :class:`compas_fab.backends.PlannerInterface`. Defaults to ``"moveit"``, - making use of :class:`compas_fab.backends.MoveItPlanner`. + planner_backend_type: type + Type the planner backend plugin to use. The plugin must be a sub-class of + :class:`compas_fab.backends.PlannerInterface`. + Defaults to :class:`~compas_fab.backends.MoveItPlanner`. Examples -------- @@ -132,10 +130,8 @@ class RosClient(Ros, ClientInterface): For more examples, check out the :ref:`ROS examples page `. """ - def __init__(self, host="localhost", port=9090, is_secure=False, planner_backend="moveit"): + def __init__(self, host="localhost", port=9090, is_secure=False, planner_backend_type=MoveItPlanner): super(RosClient, self).__init__(host, port, is_secure) - - planner_backend_type = PLANNER_BACKENDS[planner_backend] self.planner = planner_backend_type(self) self._ros_distro = None From 40832df2b695c913b24570f507ba64405375e22e Mon Sep 17 00:00:00 2001 From: Gonzalo Casas Date: Thu, 20 Jun 2024 22:39:10 +0200 Subject: [PATCH 2/3] Temporarily limit numpy to less than 2.x --- requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements.txt b/requirements.txt index 632a4af65..b8d3b27dd 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ +numpy >= 1.15.4, < 2 compas >= 2.0.4, < 3 compas_robots >= 0.3, < 1 roslibpy >= 1.1.0 From 3c1933d3014191c3795e3d96813f63b026362073 Mon Sep 17 00:00:00 2001 From: Gonzalo Casas Date: Thu, 20 Jun 2024 23:59:46 +0200 Subject: [PATCH 3/3] Rename --- CHANGELOG.md | 2 +- src/compas_fab/backends/ros/client.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5daf8823f..63e20b912 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,7 +32,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * Changed the behavior of Duration class when accepting both seconds (float) and nanoseconds (int) where the decimal point of seconds and the nanoseconds add up to more than 1 second. * Changed GH Component `ConstraintsFromPlane` to `FrameTargetFromPlane`. * Changed GH Component `ConstraintsFromTargetConfiguration` to `ConfigurationTarget`. -* Changed `RosClient` constructor to take a type for planner backend instead of a string. This also changes the name of the argument from `planner_backend` to `planner_backend_type`. +* Changed `RosClient` constructor to take a type for planner backend instead of a string. This also changes the name of the argument from `planner_backend` to `planner_type`. ### Removed diff --git a/src/compas_fab/backends/ros/client.py b/src/compas_fab/backends/ros/client.py index 7a7d85a30..ba7bbe594 100644 --- a/src/compas_fab/backends/ros/client.py +++ b/src/compas_fab/backends/ros/client.py @@ -114,8 +114,8 @@ class RosClient(Ros, ClientInterface): Port of the ROS Bridge. Defaults to ``9090``. is_secure : :obj:`bool` ``True`` to indicate it should use a secure web socket, otherwise ``False``. - planner_backend_type: type - Type the planner backend plugin to use. The plugin must be a sub-class of + planner_type: type + Type the planner backend to use. The backend must be a sub-class of :class:`compas_fab.backends.PlannerInterface`. Defaults to :class:`~compas_fab.backends.MoveItPlanner`. @@ -130,9 +130,9 @@ class RosClient(Ros, ClientInterface): For more examples, check out the :ref:`ROS examples page `. """ - def __init__(self, host="localhost", port=9090, is_secure=False, planner_backend_type=MoveItPlanner): + def __init__(self, host="localhost", port=9090, is_secure=False, planner_type=MoveItPlanner): super(RosClient, self).__init__(host, port, is_secure) - self.planner = planner_backend_type(self) + self.planner = planner_type(self) self._ros_distro = None def __enter__(self):