Skip to content

Commit 508956e

Browse files
committed
Clean up long lines
1 parent cff1cf8 commit 508956e

File tree

5 files changed

+26
-36
lines changed

5 files changed

+26
-36
lines changed

src/compas_fab/backends/vrep/client.py

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
11
from __future__ import print_function
22

33
import logging
4-
import math
54
import socket
65
from timeit import default_timer as timer
76

8-
from compas.datastructures import Mesh
97
from compas.geometry import Frame
108
from compas.geometry import matrix_from_frame
119

1210
from compas_fab.backends.exceptions import BackendError
1311
from compas_fab.backends.vrep.remote_api import vrep
1412
from compas_fab.robots import Configuration
15-
from compas_fab.robots import Robot
1613

1714
DEFAULT_SCALE = 1.
1815
DEFAULT_OP_MODE = vrep.simx_opmode_blocking
@@ -61,9 +58,9 @@ class VrepClient(object):
6158
For more examples, check out the :ref:`V-REP examples page <examples_vrep>`.
6259
"""
6360
SUPPORTED_PLANNERS = ('bitrrt', 'bkpiece1', 'est', 'kpiece1',
64-
'lazyprmstar', 'lbkpiece1', 'lbtrrt', 'pdst',
65-
'prm', 'prrt', 'rrt', 'rrtconnect', 'rrtstar',
66-
'sbl', 'stride', 'trrt')
61+
'lazyprmstar', 'lbkpiece1', 'lbtrrt', 'pdst',
62+
'prm', 'prrt', 'rrt', 'rrtconnect', 'rrtstar',
63+
'sbl', 'stride', 'trrt')
6764

6865
def __init__(self, host='127.0.0.1', port=19997, scale=DEFAULT_SCALE, lua_script='RFL', debug=False):
6966
super(VrepClient, self).__init__()
@@ -176,7 +173,7 @@ def set_robot_metric(self, robot, metric_values):
176173
effectively removes one degree of freedom (DOF).
177174
178175
Args:
179-
robot (:class:`Robot`): Robot instance.
176+
robot (:class:`compas_fab.robots.Robot`): Robot instance.
180177
metric_values (:obj:`list` of :obj:`float`): List containing one value
181178
per configurable joint. Each value ranges from 0 to 1.
182179
"""
@@ -192,7 +189,7 @@ def set_robot_pose(self, robot, frame):
192189
"""Moves the robot to a given pose, specified as a frame.
193190
194191
Args:
195-
robot (:class:`Robot`): Robot instance to move.
192+
robot (:class:`compas_fab.robots.Robot`): Robot instance to move.
196193
frame (:class:`Frame`): Target or goal frame.
197194
198195
Returns:
@@ -215,7 +212,7 @@ def set_robot_config(self, robot, config):
215212
"""Moves the robot to the specified configuration.
216213
217214
Args:
218-
robot (:class:`Robot`): Robot instance to move.
215+
robot (:class:`compas_fab.robots.Robot`): Robot instance to move.
219216
config (:class:`Configuration` instance): Describes the position of the
220217
robot as an instance of :class:`Configuration`.
221218
@@ -243,7 +240,7 @@ def get_robot_config(self, robot):
243240
"""Gets the current configuration of the specified robot.
244241
245242
Args:
246-
robot (:class:`Robot`): Robot instance.
243+
robot (:class:`compas_fab.robots.Robot`): Robot instance.
247244
248245
Examples:
249246
@@ -265,7 +262,7 @@ def forward_kinematics(self, robot):
265262
"""Calculates forward kinematics to get the current end-effector pose.
266263
267264
Args:
268-
robot (:class:`Robot`): Robot instance.
265+
robot (:class:`compas_fab.robots.Robot`): Robot instance.
269266
270267
Examples:
271268
@@ -279,15 +276,15 @@ def forward_kinematics(self, robot):
279276
assert_robot(robot)
280277

281278
_res, _, pose, _, _ = self.run_child_script('getIkTipPose',
282-
[robot.model.attr['index']],
283-
[], [])
279+
[robot.model.attr['index']],
280+
[], [])
284281
return vrep_pose_to_frame(pose, self.scale)
285282

286283
def inverse_kinematics(self, robot, goal_frame, metric_values=None, gantry_joint_limits=None, arm_joint_limits=None, max_trials=None, max_results=1):
287284
"""Calculates inverse kinematics to find valid robot configurations for the specified goal frame.
288285
289286
Args:
290-
robot (:class:`Robot`): Robot instance.
287+
robot (:class:`compas_fab.robots.Robot`): Robot instance.
291288
goal_frame (:class:`Frame`): Target or goal frame.
292289
metric_values (:obj:`list` of :obj:`float`): List containing one value
293290
per configurable joint. Each value ranges from 0 to 1,
@@ -357,7 +354,7 @@ def pick_building_member(self, robot, building_member_mesh, pickup_frame, metric
357354
"""Picks up a building member and attaches it to the robot.
358355
359356
Args:
360-
robot (:class:`Robot`): Robot instance to use for pick up.
357+
robot (:class:`compas_fab.robots.Robot`): Robot instance to use for pick up.
361358
building_member_mesh (:class:`compas.datastructures.Mesh`): Mesh
362359
of the building member that will be attached to the robot.
363360
pickup_pose (:class:`Frame`): Pickup frame.
@@ -455,7 +452,7 @@ def plan_motion_to_config(self, robot, goal_configs, metric_values=None, collisi
455452
specific goal configuration.
456453
457454
Args:
458-
robot (:class:`Robot`): Robot instance to move.
455+
robot (:class:`compas_fab.robots.Robot`): Robot instance to move.
459456
goal_configs (:obj:`list` of :class:`Configuration`): List of target or goal configurations.
460457
metric_values (:obj:`list` of :obj:`float`): List containing one value
461458
per configurable joint. Each value ranges from 0 to 1,
@@ -493,7 +490,7 @@ def plan_motion(self, robot, goal_frame, metric_values=None, collision_meshes=No
493490
"""Find a path plan to move the selected robot from its current position to the `goal_frame`.
494491
495492
Args:
496-
robot (:class:`Robot`): Robot instance to move.
493+
robot (:class:`compas_fab.robots.Robot`): Robot instance to move.
497494
goal_frame (:class:`Frame`): Target or goal frame.
498495
metric_values (:obj:`list` of :obj:`float`): List containing one value
499496
per configurable joint. Each value ranges from 0 to 1,
@@ -529,7 +526,7 @@ def add_building_member(self, robot, building_member_mesh):
529526
"""Adds a building member to the 3D scene and attaches it to the robot.
530527
531528
Args:
532-
robot (:class:`Robot`): Robot instance to attach the building member to.
529+
robot (:class:`compas_fab.robots.Robot`): Robot instance to attach the building member to.
533530
building_member_mesh (:class:`compas.datastructures.Mesh`): Mesh
534531
of the building member that will be attached to the robot.
535532

src/compas_fab/blender/artists.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
from __future__ import division
33
from __future__ import print_function
44

5-
import time
6-
7-
import compas
85
from compas_blender import draw_mesh
96

107
from compas_fab.artists import BaseRobotArtist

src/compas_fab/rhino/artists.py

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
import compas
88
from compas.utilities import rgb_to_rgb
9-
import compas_rhino
109

1110
from compas_fab.artists import BaseRobotArtist
1211

@@ -29,7 +28,7 @@ class RobotArtist(BaseRobotArtist):
2928
"""Visualizer for robots inside a Rhino environment."""
3029

3130
# TODO: Add layer (e.g. __init__(self, robot, layer=None))
32-
def __init__(self, robot): #, layer=None):
31+
def __init__(self, robot):
3332
super(RobotArtist, self).__init__(robot)
3433

3534
def transform(self, native_mesh, transformation):
@@ -89,16 +88,6 @@ def redraw(self, timeout=None):
8988
rs.EnableRedraw(True)
9089
rs.Redraw()
9190

92-
# def clear_layer(self):
93-
# """Clear the main layer of the artist."""
94-
# if self.layer:
95-
# compas_rhino.clear_layer(self.layer)
96-
# else:
97-
# compas_rhino.clear_current_layer()
98-
99-
# def clear(self):
100-
# """Clear the robot."""
101-
# self.clear_robot()
10291

10392
# TODO: Move to compas_rhino.geometry
10493
def xform_from_transformation(transformation):

src/compas_fab/robots/robot.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -792,7 +792,8 @@ def constraints_from_frame(self, frame_WCF, tolerance_position, tolerances_axes,
792792
>>> tolerances_axes = [math.radians(1)]
793793
>>> group = robot.main_group_name
794794
>>> robot.constraints_from_frame(frame, tolerance_position, tolerances_axes, group)
795-
[PositionConstraint('ee_link', BoundingVolume(2, Sphere(Point(0.400, 0.300, 0.400), 0.001)), 1.0), OrientationConstraint('ee_link', [0.5, 0.5, 0.5, 0.5], [0.017453292519943295, 0.017453292519943295, 0.017453292519943295], 1.0)]
795+
[PositionConstraint('ee_link', BoundingVolume(2, Sphere(Point(0.400, 0.300, 0.400), 0.001)), 1.0), \
796+
OrientationConstraint('ee_link', [0.5, 0.5, 0.5, 0.5], [0.017453292519943295, 0.017453292519943295, 0.017453292519943295], 1.0)]
796797
797798
Notes
798799
-----
@@ -826,7 +827,12 @@ def constraints_from_configuration(self, configuration, tolerances, group=None):
826827
>>> tolerances = [math.radians(5)] * 6
827828
>>> group = robot.main_group_name
828829
>>> robot.constraints_from_configuration(configuration, tolerances, group)
829-
[JointConstraint('shoulder_pan_joint', -0.042, 0.08726646259971647, 1.0), JointConstraint('shoulder_lift_joint', 4.295, 0.08726646259971647, 1.0), JointConstraint('elbow_joint', -4.11, 0.08726646259971647, 1.0), JointConstraint('wrist_1_joint', -3.327, 0.08726646259971647, 1.0), JointConstraint('wrist_2_joint', 4.755, 0.08726646259971647, 1.0), JointConstraint('wrist_3_joint', 0.0, 0.08726646259971647, 1.0)]
830+
[JointConstraint('shoulder_pan_joint', -0.042, 0.08726646259971647, 1.0), \
831+
JointConstraint('shoulder_lift_joint', 4.295, 0.08726646259971647, 1.0), \
832+
JointConstraint('elbow_joint', -4.11, 0.08726646259971647, 1.0), \
833+
JointConstraint('wrist_1_joint', -3.327, 0.08726646259971647, 1.0), \
834+
JointConstraint('wrist_2_joint', 4.755, 0.08726646259971647, 1.0), \
835+
JointConstraint('wrist_3_joint', 0.0, 0.08726646259971647, 1.0)]
830836
831837
Raises
832838
------

src/compas_fab/utilities/filesystem.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ def list_files_in_directory(directory, fullpath=False, extensions=[]):
3939

4040
if __name__ == "__main__":
4141

42-
path = os.path.join(os.path.dirname(__file__), "..", "robots", "ur", "ur10", "model")
42+
path = os.path.join(os.path.dirname(__file__), "..",
43+
"robots", "ur", "ur10", "model")
4344
os.listdir(path)
4445
print(list_files_in_directory(path, fullpath=True, extensions=["obj"]))

0 commit comments

Comments
 (0)