Skip to content

Commit 005e268

Browse files
authored
Merge pull request #439 from compas-dev/planner_type_arg
Change planner type arg
2 parents c6ef2c0 + 3c1933d commit 005e268

File tree

3 files changed

+8
-10
lines changed

3 files changed

+8
-10
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3232
* 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.
3333
* Changed GH Component `ConstraintsFromPlane` to `FrameTargetFromPlane`.
3434
* Changed GH Component `ConstraintsFromTargetConfiguration` to `ConfigurationTarget`.
35+
* 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`.
3536

3637
### Removed
3738

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
numpy >= 1.15.4, < 2
12
compas >= 2.0.4, < 3
23
compas_robots >= 0.3, < 1
34
roslibpy >= 1.1.0

src/compas_fab/backends/ros/client.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@
3333
"RosClient",
3434
]
3535

36-
PLANNER_BACKENDS = {"moveit": MoveItPlanner}
37-
3836

3937
class CancellableRosActionResult(CancellableFutureResult):
4038
def __init__(self, goal):
@@ -116,10 +114,10 @@ class RosClient(Ros, ClientInterface):
116114
Port of the ROS Bridge. Defaults to ``9090``.
117115
is_secure : :obj:`bool`
118116
``True`` to indicate it should use a secure web socket, otherwise ``False``.
119-
planner_backend: str
120-
Name of the planner backend plugin to use. The plugin must be a sub-class of
121-
:class:`compas_fab.backends.PlannerInterface`. Defaults to ``"moveit"``,
122-
making use of :class:`compas_fab.backends.MoveItPlanner`.
117+
planner_type: type
118+
Type the planner backend to use. The backend must be a sub-class of
119+
:class:`compas_fab.backends.PlannerInterface`.
120+
Defaults to :class:`~compas_fab.backends.MoveItPlanner`.
123121
124122
Examples
125123
--------
@@ -132,11 +130,9 @@ class RosClient(Ros, ClientInterface):
132130
For more examples, check out the :ref:`ROS examples page <ros_examples>`.
133131
"""
134132

135-
def __init__(self, host="localhost", port=9090, is_secure=False, planner_backend="moveit"):
133+
def __init__(self, host="localhost", port=9090, is_secure=False, planner_type=MoveItPlanner):
136134
super(RosClient, self).__init__(host, port, is_secure)
137-
138-
planner_backend_type = PLANNER_BACKENDS[planner_backend]
139-
self.planner = planner_backend_type(self)
135+
self.planner = planner_type(self)
140136
self._ros_distro = None
141137

142138
def __enter__(self):

0 commit comments

Comments
 (0)