Skip to content

Commit cff1cf8

Browse files
committed
Fix plenty of whitespace linter errors
1 parent 1159dc2 commit cff1cf8

File tree

11 files changed

+96
-52
lines changed

11 files changed

+96
-52
lines changed

src/compas_fab/backends/ros/messages/actionlib_msgs.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,22 @@
44
from .std_msgs import Header
55
from .std_msgs import Time
66

7+
78
class GoalID(ROSmsg):
89
"""http://docs.ros.org/api/actionlib_msgs/html/msg/GoalID.html
910
"""
11+
1012
def __init__(self, stamp=Time(), id=""):
1113
self.stamp = stamp
1214
self.id = id
13-
15+
1416
@classmethod
1517
def from_msg(cls, msg):
1618
stamp = Time.from_msg(msg['stamp'])
1719
id = msg['id']
1820
return cls(stamp, id)
1921

22+
2023
class GoalStatus(ROSmsg):
2124
"""http://docs.ros.org/api/actionlib_msgs/html/msg/GoalStatus.html
2225
"""
@@ -36,7 +39,7 @@ def __init__(self, goal_id=GoalID(), status=0, text=''):
3639
self.goal_id = goal_id
3740
self.status = status
3841
self.text = text
39-
42+
4043
@classmethod
4144
def from_msg(cls, msg):
4245
goal_id = GoalID.from_msg(msg['goal_id'])
@@ -52,18 +55,21 @@ def human_readable(self):
5255
return k
5356
return ''
5457

58+
5559
class GoalStatusArray(ROSmsg):
5660
"""http://docs.ros.org/api/actionlib_msgs/html/msg/GoalStatusArray.html
5761
"""
62+
5863
def __init__(self, header=Header(), status_list=[]):
5964
self.header = header
6065
self.status_list = status_list
6166

67+
6268
"""
6369
rostopic info /follow_joint_trajectory/cancel
6470
Type: actionlib_msgs/GoalID
6571
6672
rostopic info /follow_joint_trajectory/status
6773
Type: actionlib_msgs/GoalStatusArray
6874
69-
"""
75+
"""

src/compas_fab/backends/ros/messages/direct_ur.py

Lines changed: 28 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
class URmsg(object):
55
"""
66
"""
7+
78
def __init__(self, **kwargs):
89
for k, v in kwargs.items():
910
setattr(self, k, v)
@@ -14,39 +15,42 @@ def __str__(self):
1415
if value:
1516
result += "%s, " % value
1617
return result[:-2]
17-
18+
1819
def __repr__(self):
1920
return self.__str__
2021

2122

2223
class Point(URmsg):
2324
"""
2425
"""
26+
2527
def __init__(self, x, y, z):
26-
self.x = x # [m]
27-
self.y = y # [m]
28-
self.z = z # [m]
28+
self.x = x # [m]
29+
self.y = y # [m]
30+
self.z = z # [m]
2931

3032
def __str__(self):
31-
return '%.6f, %.6f, %.6f' % (self.x ,self.y, self.z)
33+
return '%.6f, %.6f, %.6f' % (self.x, self.y, self.z)
3234

3335

3436
class AxisAngle(URmsg):
3537
"""
3638
"""
39+
3740
def __init__(self, x, y, z):
3841
self.x = x
3942
self.y = y
4043
self.z = z
41-
44+
4245
def __str__(self):
43-
return '%.6f, %.6f, %.6f' % (self.x ,self.y, self.z)
46+
return '%.6f, %.6f, %.6f' % (self.x, self.y, self.z)
4447

4548

4649
class URPose(URmsg):
4750
"""
4851
"""
49-
def __init__(self, position=Point(0,0,0), orientation=AxisAngle(0,0,0)):
52+
53+
def __init__(self, position=Point(0, 0, 0), orientation=AxisAngle(0, 0, 0)):
5054
self.position = position
5155
self.orientation = orientation
5256

@@ -55,21 +59,22 @@ def from_frame(cls, frame):
5559
point = frame.point
5660
ax, ay, az = frame.axis_angle_vector
5761
return cls(Point(*list(point)), AxisAngle(ax, ay, az))
58-
62+
5963
def __str__(self):
6064
return "p[%s, %s]" % (self.position, self.orientation)
6165

6266

6367
class URPoseTrajectoryPoint(URmsg):
6468
"""
6569
"""
70+
6671
def __init__(self, pose=URPose(), acceleration=None, velocity=None, time=None, radius=None):
6772
self.pose = pose
68-
self.acceleration = acceleration # [m/s^2]
69-
self.velocity = velocity # [m/s]
70-
self.time = time # [s]
71-
self.radius = radius # [m]
72-
73+
self.acceleration = acceleration # [m/s^2]
74+
self.velocity = velocity # [m/s]
75+
self.time = time # [s]
76+
self.radius = radius # [m]
77+
7378
def __str__(self):
7479
result = "%s" % self.pose
7580
if self.acceleration:
@@ -86,6 +91,7 @@ def __str__(self):
8691
class URMovej(URmsg):
8792
"""
8893
"""
94+
8995
def __init__(self, pose_trajectory_point=URPoseTrajectoryPoint()):
9096
self.pose_trajectory_point = pose_trajectory_point
9197

@@ -96,6 +102,7 @@ def __str__(self):
96102
class URMovel(URmsg):
97103
"""
98104
"""
105+
99106
def __init__(self, pose_trajectory_point=URPoseTrajectoryPoint()):
100107
self.pose_trajectory_point = pose_trajectory_point
101108

@@ -106,11 +113,12 @@ def __str__(self):
106113
class URGoal(URmsg):
107114
"""
108115
"""
116+
109117
def __init__(self, script_lines=[]):
110118
self.script = "def prog():\n\t"
111-
self.script += "\n\t".join([str(line) for line in script_lines])
119+
self.script += "\n\t".join([str(line) for line in script_lines])
112120
self.script += "\nend\nprog()\n\n"
113-
121+
114122
@property
115123
def msg(self):
116124
return {"script": self.script}
@@ -129,11 +137,11 @@ def msg(self):
129137
velocity = 0.17
130138
time = 5.
131139
script_lines = []
132-
133-
for frame in frames:
134-
ptp = URPoseTrajectoryPoint(URPose.from_frame(frame), acceleration, velocity, time, None)
140+
141+
for frame in frames:
142+
ptp = URPoseTrajectoryPoint(URPose.from_frame(
143+
frame), acceleration, velocity, time, None)
135144
move = URMovej(ptp)
136-
#move = Movel(ptp)
137145
script_lines.append(move)
138146

139147
urgoal = URGoal(script_lines)

src/compas_fab/backends/ros/messages/geometry_msgs.py

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22

33
from .std_msgs import ROSmsg
44
from .std_msgs import Header
5-
from .std_msgs import Time
65

76
from compas.geometry import Frame
87

98

109
class Point(ROSmsg):
1110
"""http://docs.ros.org/kinetic/api/geometry_msgs/html/msg/Point.html
1211
"""
12+
1313
def __init__(self, x, y, z):
1414
self.x = x
1515
self.y = y
@@ -20,10 +20,12 @@ def from_msg(cls, msg):
2020
x, y, z = msg['x'], msg['y'], msg['z']
2121
return cls(x, y, z)
2222

23+
2324
class Quaternion(ROSmsg):
2425
"""http://docs.ros.org/kinetic/api/geometry_msgs/html/msg/Quaternion.html
2526
"""
26-
def __init__(self, x=0. ,y=0., z=0., w=1.):
27+
28+
def __init__(self, x=0., y=0., z=0., w=1.):
2729
self.x = x
2830
self.y = y
2931
self.z = z
@@ -34,12 +36,15 @@ def from_frame(cls, frame):
3436
qw, qx, qy, qz = frame.quaternion
3537
return cls(qx, qy, qz, qw)
3638

39+
3740
class Pose(ROSmsg):
3841
"""http://docs.ros.org/kinetic/api/geometry_msgs/html/msg/Pose.html
3942
"""
43+
4044
def __init__(self, position=None, orientation=None):
41-
self.position = position if position else Point(0,0,0)
42-
self.orientation = orientation if orientation else Quaternion(0,0,0,1)
45+
self.position = position if position else Point(0, 0, 0)
46+
self.orientation = orientation if orientation else Quaternion(
47+
0, 0, 0, 1)
4348

4449
@classmethod
4550
def from_frame(cls, frame):
@@ -50,7 +55,8 @@ def from_frame(cls, frame):
5055
@property
5156
def frame(self):
5257
point = [self.position.x, self.position.y, self.position.z]
53-
quaternion = [self.orientation.w, self.orientation.x, self.orientation.y, self.orientation.z]
58+
quaternion = [self.orientation.w, self.orientation.x,
59+
self.orientation.y, self.orientation.z]
5460
return Frame.from_quaternion(quaternion, point=point)
5561

5662
@classmethod
@@ -59,9 +65,11 @@ def from_msg(cls, msg):
5965
orientation = Quaternion.from_msg(msg['orientation'])
6066
return cls(position, orientation)
6167

68+
6269
class PoseStamped(ROSmsg):
6370
"""http://docs.ros.org/melodic/api/geometry_msgs/html/msg/PoseStamped.html
6471
"""
72+
6573
def __init__(self, header=Header(), pose=Pose()):
6674
self.header = header
6775
self.pose = pose
@@ -72,24 +80,30 @@ def from_msg(cls, msg):
7280
pose = Pose.from_msg(msg['pose'])
7381
return cls(header, pose)
7482

83+
7584
class Vector3(ROSmsg):
7685
"""http://docs.ros.org/api/geometry_msgs/html/msg/Vector3.html
7786
"""
87+
7888
def __init__(self, x=0., y=0., z=0.):
7989
self.x = x
8090
self.y = y
8191
self.z = z
8292

93+
8394
class Transform(ROSmsg):
8495
"""http://docs.ros.org/api/geometry_msgs/html/msg/Transform.html
8596
"""
97+
8698
def __init__(self, translation=Vector3(), rotation=Quaternion()):
8799
self.translation = translation
88100
self.rotation = rotation
89101

102+
90103
class Twist(ROSmsg):
91104
"""http://docs.ros.org/api/geometry_msgs/html/msg/Twist.html
92105
"""
106+
93107
def __init__(self, linear=Vector3(), angular=Vector3()):
94108
self.linear = linear
95109
self.angular = angular

src/compas_fab/backends/ros/messages/octomap_msgs.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
from .std_msgs import ROSmsg
66
from .std_msgs import Header
7-
from .std_msgs import Time
87

98
from .geometry_msgs import Pose
109

src/compas_fab/backends/ros/messages/sensor_msgs.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from .std_msgs import ROSmsg
44
from .std_msgs import Header
5-
from .std_msgs import Time
5+
66

77
class JointState(ROSmsg):
88
"""http://docs.ros.org/kinetic/api/sensor_msgs/html/msg/JointState.html
@@ -19,11 +19,11 @@ def __init__(self, header=None, name=None, position=None, velocity=None,
1919
@classmethod
2020
def from_name_and_position(cls, name, position):
2121
return cls(Header(), name, position, [], [])
22-
22+
2323
@classmethod
2424
def from_configuration(cls):
2525
pass
26-
26+
2727
@property
2828
def configuration(self):
2929
pass

src/compas_fab/backends/ros/messages/shape_msgs.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ class Mesh(ROSmsg):
7777
"""http://docs.ros.org/kinetic/api/shape_msgs/html/msg/Mesh.html
7878
"""
7979
def __init__(self, triangles=None, vertices=None):
80-
self.triangles = triangles if triangles else [] # shape_msgs/MeshTriangle[]
81-
self.vertices = vertices if vertices else [] # geometry_msgs/Point[]
80+
self.triangles = triangles or [] # shape_msgs/MeshTriangle[]
81+
self.vertices = vertices or [] # geometry_msgs/Point[]
8282

8383
@classmethod
8484
def from_mesh(cls, compas_mesh):
@@ -110,7 +110,7 @@ class MeshTriangle(ROSmsg):
110110
def __init__(self, vertex_indices=None):
111111
if len(vertex_indices) != 3:
112112
raise ValueError("Please specify 3 indices for face, %d given." % len(vertex_indices))
113-
self.vertex_indices = vertex_indices if vertex_indices else [] # uint32[3]
113+
self.vertex_indices = vertex_indices or [] # uint32[3]
114114

115115
@classmethod
116116
def from_msg(cls, msg):

src/compas_fab/backends/ros/messages/std_msgs.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def from_msg(cls, msg):
3030

3131
def __str__(self):
3232
return str(self.msg)
33-
33+
3434
def __repr__(self):
3535
return self.__str__
3636

@@ -55,6 +55,7 @@ def __init__(self, seq=0, stamp=Time(), frame_id='/world'):
5555
self.stamp = stamp
5656
self.frame_id = frame_id
5757

58+
5859
class String(ROSmsg):
5960
"""http://docs.ros.org/api/std_msgs/html/msg/String.html
6061
"""

0 commit comments

Comments
 (0)