Skip to content

Commit aefa899

Browse files
committed
adding # pragma: no cover
1 parent af854d6 commit aefa899

File tree

7 files changed

+16
-34
lines changed

7 files changed

+16
-34
lines changed

ArmNavigation/n_joint_arm_to_point_control/NLinkArm.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def __init__(self, link_lengths, joint_angles, goal, show_animation):
2222
self.lim = sum(link_lengths)
2323
self.goal = np.array(goal).T
2424

25-
if show_animation:
25+
if show_animation: # pragma: no cover
2626
self.fig = plt.figure()
2727
self.fig.canvas.mpl_connect('button_press_event', self.click)
2828

@@ -46,7 +46,7 @@ def update_points(self):
4646
np.sin(np.sum(self.joint_angles[:i]))
4747

4848
self.end_effector = np.array(self.points[self.n_links]).T
49-
if self.show_animation:
49+
if self.show_animation: # pragma: no cover
5050
self.plot()
5151

5252
def plot(self): # pragma: no cover

ArmNavigation/n_joint_arm_to_point_control/n_joint_arm_to_point_control.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
show_animation = True
2222

2323

24-
def main():
24+
def main(): # pragma: no cover
2525
"""
2626
Creates an arm using the NLinkArm class and uses its inverse kinematics
2727
to move it to the desired position.

ArmNavigation/two_joint_arm_to_point_control/two_joint_arm_to_point_control.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ def two_joint_arm(GOAL_TH=0.0, theta1=0.0, theta2=0.0):
3939
try:
4040
theta2_goal = np.arccos(
4141
(x**2 + y**2 - l1**2 - l2**2) / (2 * l1 * l2))
42-
theta1_goal = np.math.atan2(y, x) - np.math.atan2(l2
43-
* np.sin(theta2_goal), (l1 + l2 * np.cos(theta2_goal)))
42+
theta1_goal = np.math.atan2(y, x) - np.math.atan2(l2 *
43+
np.sin(theta2_goal), (l1 + l2 * np.cos(theta2_goal)))
4444

4545
if theta1_goal < 0:
4646
theta2_goal = -theta2_goal
@@ -94,7 +94,7 @@ def ang_diff(theta1, theta2):
9494
return (theta1 - theta2 + np.pi) % (2 * np.pi) - np.pi
9595

9696

97-
def click(event):
97+
def click(event): # pragma: no cover
9898
global x, y
9999
x = event.xdata
100100
y = event.ydata
@@ -111,7 +111,7 @@ def animation():
111111
GOAL_TH=0.01, theta1=theta1, theta2=theta2)
112112

113113

114-
def main():
114+
def main(): # pragma: no cover
115115
fig = plt.figure()
116116
fig.canvas.mpl_connect("button_press_event", click)
117117
two_joint_arm()

PathPlanning/BezierPath/bezier_path.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ def main():
163163
assert path.T[0][-1] == end_x, "path is invalid"
164164
assert path.T[1][-1] == end_y, "path is invalid"
165165

166-
if show_animation:
166+
if show_animation: # pragma: no cover
167167
fig, ax = plt.subplots()
168168
ax.plot(path.T[0], path.T[1], label="Bezier Path")
169169
ax.plot(control_points.T[0], control_points.T[1],
@@ -198,10 +198,10 @@ def main2():
198198
assert path.T[0][-1] == end_x, "path is invalid"
199199
assert path.T[1][-1] == end_y, "path is invalid"
200200

201-
if show_animation:
201+
if show_animation: # pragma: no cover
202202
plt.plot(path.T[0], path.T[1], label="Offset=" + str(offset))
203203

204-
if show_animation:
204+
if show_animation: # pragma: no cover
205205
plot_arrow(start_x, start_y, start_yaw)
206206
plot_arrow(end_x, end_y, end_yaw)
207207
plt.legend()

PathPlanning/LQRPlanner/LQRplanner.py

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def LQRplanning(sx, sy, gx, gy):
4747
break
4848

4949
# animation
50-
if show_animation:
50+
if show_animation: # pragma: no cover
5151
plt.plot(sx, sy, "or")
5252
plt.plot(gx, gy, "ob")
5353
plt.plot(rx, ry, "-r")
@@ -129,31 +129,13 @@ def main():
129129

130130
rx, ry = LQRplanning(sx, sy, gx, gy)
131131

132-
if show_animation:
132+
if show_animation: # pragma: no cover
133133
plt.plot(sx, sy, "or")
134134
plt.plot(gx, gy, "ob")
135135
plt.plot(rx, ry, "-r")
136136
plt.axis("equal")
137137
plt.pause(1.0)
138138

139139

140-
def main1():
141-
print(__file__ + " start!!")
142-
143-
sx = 6.0
144-
sy = 6.0
145-
gx = 10.0
146-
gy = 10.0
147-
148-
rx, ry = LQRplanning(sx, sy, gx, gy)
149-
150-
if show_animation:
151-
plt.plot(sx, sy, "or")
152-
plt.plot(gx, gy, "ob")
153-
plt.plot(rx, ry, "-r")
154-
plt.axis("equal")
155-
plt.show()
156-
157-
158140
if __name__ == '__main__':
159141
main()

PathPlanning/RRTDubins/rrt_dubins.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ def gen_final_course(self, goalind):
167167
def calc_dist_to_goal(self, x, y):
168168
return np.linalg.norm([x - self.end.x, y - self.end.y])
169169

170-
def DrawGraph(self, rnd=None):
170+
def DrawGraph(self, rnd=None): # pragma: no cover
171171
plt.clf()
172172
if rnd is not None:
173173
plt.plot(rnd[0], rnd[1], "^k")
@@ -244,7 +244,7 @@ def main():
244244
path = rrt.Planning(animation=show_animation)
245245

246246
# Draw final path
247-
if show_animation:
247+
if show_animation: # pragma: no cover
248248
rrt.DrawGraph()
249249
plt.plot([x for (x, y) in path], [y for (x, y) in path], '-r')
250250
plt.grid(True)

PathPlanning/RRTStarDubins/rrt_star_dubins.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ def rewire(self, newNode, nearinds):
202202
# print("rewire")
203203
self.nodeList[i] = tNode
204204

205-
def DrawGraph(self, rnd=None):
205+
def DrawGraph(self, rnd=None): # pragma: no cover
206206
"""
207207
Draw Graph
208208
"""
@@ -288,7 +288,7 @@ def main():
288288
path = rrt.Planning(animation=show_animation)
289289

290290
# Draw final path
291-
if show_animation:
291+
if show_animation: # pragma: no cover
292292
rrt.DrawGraph()
293293
plt.plot([x for (x, y) in path], [y for (x, y) in path], '-r')
294294
plt.grid(True)

0 commit comments

Comments
 (0)