Skip to content

Commit f0b6b7a

Browse files
committed
code clean up for LGTM
1 parent 138f478 commit f0b6b7a

File tree

8 files changed

+20
-21
lines changed

8 files changed

+20
-21
lines changed

AerialNavigation/drone_3d_trajectory_following/drone_3d_trajectory_following.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ def quad_sim(x_c, y_c, z_c):
7373
# des_x_pos = calculate_position(x_c[i], t)
7474
# des_y_pos = calculate_position(y_c[i], t)
7575
des_z_pos = calculate_position(z_c[i], t)
76-
des_x_vel = calculate_velocity(x_c[i], t)
77-
des_y_vel = calculate_velocity(y_c[i], t)
76+
# des_x_vel = calculate_velocity(x_c[i], t)
77+
# des_y_vel = calculate_velocity(y_c[i], t)
7878
des_z_vel = calculate_velocity(z_c[i], t)
7979
des_x_acc = calculate_acceleration(x_c[i], t)
8080
des_y_acc = calculate_acceleration(y_c[i], t)

AerialNavigation/rocket_powered_landing/rocket_powered_landing.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,7 @@ def plot_animation(X, U): # pragma: no cover
576576
axis3d_equal(X[2, :], X[3, :], X[1, :], ax)
577577

578578
rx, ry, rz = X[1:4, k]
579-
vx, vy, vz = X[4:7, k]
579+
# vx, vy, vz = X[4:7, k]
580580
qw, qx, qy, qz = X[7:11, k]
581581

582582
CBI = np.array([
@@ -618,8 +618,6 @@ def main():
618618
integrator = Integrator(m, K)
619619
problem = SCProblem(m, K)
620620

621-
last_linear_cost = None
622-
623621
converged = False
624622
w_delta = W_DELTA
625623
for it in range(iterations):
@@ -633,7 +631,7 @@ def main():
633631
X_last=X, U_last=U, sigma_last=sigma,
634632
weight_sigma=W_SIGMA, weight_nu=W_NU,
635633
weight_delta=w_delta, weight_delta_sigma=W_DELTA_SIGMA)
636-
info = problem.solve()
634+
problem.solve()
637635

638636
X = problem.get_variable('X')
639637
U = problem.get_variable('U')

ArmNavigation/arm_obstacle_navigation/arm_obstacle_navigation_2.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def animate(grid, arm, route):
5353
theta2 = 2 * pi * node[1] / M - pi
5454
arm.update_joints([theta1, theta2])
5555
plt.subplot(1, 2, 2)
56-
arm.plot(plt, obstacles=obstacles)
56+
arm.plot_arm(plt, obstacles=obstacles)
5757
plt.xlim(-2.0, 2.0)
5858
plt.ylim(-3.0, 3.0)
5959
plt.show()
@@ -272,7 +272,7 @@ def update_points(self):
272272

273273
self.end_effector = np.array(self.points[self.n_links]).T
274274

275-
def plot(self, myplt, obstacles=[]): # pragma: no cover
275+
def plot_arm(self, myplt, obstacles=[]): # pragma: no cover
276276
myplt.cla()
277277

278278
for obstacle in obstacles:

PathPlanning/ClosedLoopRRTStar/pure_pursuit.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,6 @@ def extend_path(cx, cy, cyaw):
222222

223223
def main():
224224
# target course
225-
import numpy as np
226225
cx = np.arange(0, 50, 0.1)
227226
cy = [math.sin(ix / 5.0) * ix / 2.0 for ix in cx]
228227

PathPlanning/LQRPlanner/LQRplanner.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ def solve_DARE(A, B, Q, R):
7373
Xn = A.T * X * A - A.T * X * B * \
7474
la.inv(R + B.T * X * B) * B.T * X * A + Q
7575
if (abs(Xn - X)).max() < eps:
76-
X = Xn
7776
break
7877
X = Xn
7978

PathPlanning/PotentialFieldPlanning/potential_field_planning.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ def main():
157157
plt.axis("equal")
158158

159159
# path generation
160-
rx, ry = potential_field_planning(
160+
_, _ = potential_field_planning(
161161
sx, sy, gx, gy, ox, oy, grid_size, robot_radius)
162162

163163
if show_animation:

PathTracking/lqr_steer_control/lqr_steer_control.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,18 @@
55
author Atsushi Sakai (@Atsushi_twi)
66
77
"""
8-
8+
import scipy.linalg as la
9+
import matplotlib.pyplot as plt
10+
import math
11+
import numpy as np
912
import sys
1013
sys.path.append("../../PathPlanning/CubicSpline/")
1114

12-
import numpy as np
13-
import math
14-
import matplotlib.pyplot as plt
15-
import scipy.linalg as la
16-
import cubic_spline_planner
15+
try:
16+
import cubic_spline_planner
17+
except:
18+
raise
19+
1720

1821
Kp = 1.0 # speed proportional gain
1922

@@ -76,7 +79,6 @@ def solve_DARE(A, B, Q, R):
7679
Xn = A.T @ X @ A - A.T @ X @ B @ \
7780
la.inv(R + B.T @ X @ B) @ B.T @ X @ A + Q
7881
if (abs(Xn - X)).max() < eps:
79-
X = Xn
8082
break
8183
X = Xn
8284

@@ -206,8 +208,8 @@ def closed_loop_prediction(cx, cy, cyaw, ck, speed_profile, goal):
206208
plt.plot(cx[target_ind], cy[target_ind], "xg", label="target")
207209
plt.axis("equal")
208210
plt.grid(True)
209-
plt.title("speed[km/h]:" + str(round(state.v * 3.6, 2)) +
210-
",target index:" + str(target_ind))
211+
plt.title("speed[km/h]:" + str(round(state.v * 3.6, 2))
212+
+ ",target index:" + str(target_ind))
211213
plt.pause(0.0001)
212214

213215
return t, x, y, yaw, v

PathTracking/pure_pursuit/pure_pursuit.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ def main():
140140
assert lastIndex >= target_ind, "Cannot goal"
141141

142142
if show_animation:
143+
plt.cla()
143144
plt.plot(cx, cy, ".r", label="course")
144145
plt.plot(x, y, "-b", label="trajectory")
145146
plt.legend()
@@ -148,7 +149,7 @@ def main():
148149
plt.axis("equal")
149150
plt.grid(True)
150151

151-
flg, ax = plt.subplots(1)
152+
plt.subplots(1)
152153
plt.plot(t, [iv * 3.6 for iv in v], "-r")
153154
plt.xlabel("Time[s]")
154155
plt.ylabel("Speed[km/h]")

0 commit comments

Comments
 (0)