Skip to content

Commit e01b6dd

Browse files
committed
tidying up
1 parent 3f43b32 commit e01b6dd

File tree

7 files changed

+14
-16
lines changed

7 files changed

+14
-16
lines changed

docs/examples/05_backends_pybullet/files/02_foward_kinematics.py renamed to docs/examples/05_backends_pybullet/files/02_forward_kinematics.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import compas_fab
2-
32
from compas_fab.backends import PyBulletClient
43
from compas_fab.robots import Configuration
54

src/compas_fab/backends/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@
5656
:nosignatures:
5757
5858
BackendError
59+
CollisionError
60+
InverseKinematicsError
5961
RosError
6062
RosValidationError
6163
VrepError
@@ -75,7 +77,8 @@
7577
from .vrep.planner import * # noqa: F401,F403
7678

7779
if not compas.is_ironpython():
78-
from .pybullet.planner import * # noqa: F401,F403
7980
from .pybullet.client import * # noqa: F401,F403
81+
from .pybullet.exceptions import * # noqa: F401,F403
82+
from .pybullet.planner import * # noqa: F401,F403
8083

8184
__all__ = [name for name in dir() if not name.startswith('_')]

src/compas_fab/backends/pybullet/backend_features/pybullet_forward_kinematics.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def forward_kinematics(self, configuration, group=None, options=None):
3030
- ``"link"``: (:obj:`str`, optional) The name of the link to
3131
calculate the forward kinematics for. Defaults to the end effector.
3232
- ``"check_collision"``: (:obj:`str`, optional) When ``True``,
33-
:meth:`compas.pybullet.PyBulletClient.check_collisions` will be called.
33+
:meth:`compas_fab.backends.PyBulletClient.check_collisions` will be called.
3434
Defaults to ``False``.
3535
3636
Returns
@@ -39,11 +39,6 @@ def forward_kinematics(self, configuration, group=None, options=None):
3939
The frame in the world's coordinate system (WCF).
4040
"""
4141
robot = options['robot']
42-
# Joint names, but not link names, are recoverable from the pybullet server.
43-
# My intention is that a user doesn't have to care about pybullet's internal id system,
44-
# except for maybe the robot's uid. I would put just the robot uid in the options
45-
# (rather than the full robot)
46-
# if it were possible to recover the links, but it's not.
4742
link_name = options.get('link') or robot.get_end_effector_link_name(group)
4843
link_id = self.client._get_link_id_by_name(link_name, robot)
4944
self.client.set_robot_configuration(robot, configuration, group)

src/compas_fab/backends/pybullet/backend_features/pybullet_inverse_kinematics.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def inverse_kinematics(self, frame_WCF, start_configuration=None, group=None, op
4242
options: dict, optional
4343
Dictionary containing the following key-value pairs:
4444
45-
-``"robot"``: (:class:`compas_fab.robots.Robot) Robot for which to compute
45+
- ``"robot"``: (:class:`compas_fab.robots.Robot`) Robot for which to compute
4646
the inverse kinematics.
4747
- ``"link_name"``: (:obj:`str`, optional ) Name of the link for which
4848
to compute the inverse kinematics. Defaults to the given robot's end
@@ -57,11 +57,11 @@ def inverse_kinematics(self, frame_WCF, start_configuration=None, group=None, op
5757
Returns
5858
-------
5959
:class:`compas_fab.robots.Configuration`
60-
The planning group's configuration.
60+
The robot's full configuration.
6161
6262
Raises
6363
------
64-
:class:`compas_fab.backends.pybullet.InverseKinematicsError`
64+
:class:`compas_fab.backends.InverseKinematicsError`
6565
"""
6666
robot = options['robot']
6767
link_name = options.get('link_name') or robot.get_end_effector_link_name(group)

src/compas_fab/backends/pybullet/client.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ def __exit__(self, *args):
151151

152152
def step_simulation(self):
153153
"""By default, the physics server will not step the simulation,
154-
unless you explicitly send a ``step_simulation``command. This
154+
unless you explicitly send a ``step_simulation`` command. This
155155
method will perform all the actions in a single forward dynamics
156156
simulation step such as collision detection, constraint solving
157157
and integration. The timestep is 1/240 second.
@@ -309,7 +309,7 @@ def check_collision_objects_for_collision(self):
309309
310310
Raises
311311
-------
312-
:class:`compas_fab.backends.pybullet.CollisionError`
312+
:class:`compas_fab.backends.CollisionError`
313313
"""
314314
names = self.collision_objects.keys()
315315
for name_1, name_2 in combinations(names, 2):
@@ -384,7 +384,7 @@ def _set_joint_positions(self, joint_ids, values, body_id):
384384
for joint_id, value in zip(joint_ids, values):
385385
self._set_joint_position(joint_id, value, body_id)
386386

387-
def set_robot_configuration(self, robot, configuration, group):
387+
def set_robot_configuration(self, robot, configuration, group=None):
388388
"""Sets the robot's pose to the given configuration. Should be followed by
389389
`step_simulation` for visualization purposes.
390390

src/compas_fab/backends/pybullet/exceptions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def __init__(self, message):
1212

1313

1414
class CollisionError(PyBulletError):
15-
"""Exception raised when two objects have been found to be in collision."""
15+
"""Exception raised when two objects have been found to be in collision in PyBullet."""
1616
def __init__(self, name1, name2):
1717
message = "Collision between '{}' and '{}'".format(name1, name2)
1818
super(CollisionError, self).__init__(message)
@@ -21,7 +21,7 @@ def __init__(self, name1, name2):
2121

2222

2323
class InverseKinematicsError(PyBulletError):
24-
"""Exception raised when no IK solution can be found."""
24+
"""Exception raised when no IK solution can be found in PyBullet."""
2525
def __init__(self):
2626
message = "No inverse kinematics solution found."
2727
super(InverseKinematicsError, self).__init__(message)

src/compas_fab/backends/pybullet/planner.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515

1616
class PyBulletPlanner(PlannerInterface):
17+
"""Implement the planner backend interface for PyBullet."""
1718
def __init__(self, client):
1819
super(PyBulletPlanner, self).__init__(client)
1920

0 commit comments

Comments
 (0)