From ba8305ffc6f8a81a0b3a421154fc4e69861ff189 Mon Sep 17 00:00:00 2001 From: Jackack Date: Sat, 3 Feb 2024 13:44:41 -0500 Subject: [PATCH] more pylint fixes --- rb_ws/src/buggy/scripts/auton/autonsystem.py | 9 ++++----- rb_ws/src/buggy/scripts/auton/controller.py | 2 -- rb_ws/src/buggy/scripts/auton/path_planner.py | 3 --- rb_ws/src/buggy/scripts/auton/path_projection.py | 10 ++++++---- rb_ws/src/buggy/scripts/auton/stanley_controller.py | 2 -- rb_ws/src/buggy/scripts/auton/trajectory.py | 3 ++- 6 files changed, 12 insertions(+), 17 deletions(-) diff --git a/rb_ws/src/buggy/scripts/auton/autonsystem.py b/rb_ws/src/buggy/scripts/auton/autonsystem.py index 93813e66..ede3ddab 100755 --- a/rb_ws/src/buggy/scripts/auton/autonsystem.py +++ b/rb_ws/src/buggy/scripts/auton/autonsystem.py @@ -1,14 +1,16 @@ #!/usr/bin/env python3 +import argparse +import cProfile +from threading import Lock + import rospy -import sys # ROS Message Imports from std_msgs.msg import Float32, Float64, Bool from nav_msgs.msg import Odometry import numpy as np -from threading import Lock from trajectory import Trajectory from world import World @@ -21,9 +23,6 @@ from path_planner import PathPlanner from pose import Pose -import argparse -import cProfile - class AutonSystem: """ Top-level class for the RoboBuggy autonomous system diff --git a/rb_ws/src/buggy/scripts/auton/controller.py b/rb_ws/src/buggy/scripts/auton/controller.py index 1a070591..cf7120f8 100755 --- a/rb_ws/src/buggy/scripts/auton/controller.py +++ b/rb_ws/src/buggy/scripts/auton/controller.py @@ -1,9 +1,7 @@ from abc import ABC, abstractmethod -import numpy as np from trajectory import Trajectory from pose import Pose -import rospy from sensor_msgs.msg import NavSatFix from world import World diff --git a/rb_ws/src/buggy/scripts/auton/path_planner.py b/rb_ws/src/buggy/scripts/auton/path_planner.py index 78480d75..62a06c6b 100755 --- a/rb_ws/src/buggy/scripts/auton/path_planner.py +++ b/rb_ws/src/buggy/scripts/auton/path_planner.py @@ -3,15 +3,12 @@ import rospy from sensor_msgs.msg import NavSatFix from std_msgs.msg import Float64 -from geometry_msgs.msg import Pose as ROSPose from pose import Pose from occupancy_grid.grid_manager import OccupancyGrid from path_projection import Projector from trajectory import Trajectory from world import World -import copy - LOOKAHEAD_TIME = 2.0 #s RESOLUTION = 30 #samples/s diff --git a/rb_ws/src/buggy/scripts/auton/path_projection.py b/rb_ws/src/buggy/scripts/auton/path_projection.py index 69e2cab8..6af9de0e 100755 --- a/rb_ws/src/buggy/scripts/auton/path_projection.py +++ b/rb_ws/src/buggy/scripts/auton/path_projection.py @@ -1,6 +1,6 @@ +import time import numpy as np from pose import Pose -import time class Projector: """ @@ -22,10 +22,12 @@ def project(self, pose: Pose, command: float, v: float, delta_t: float, resoluti resolution (int): Number of points to output per second Returns: - list: 2D List with shape ((time * resolutions), (2)), where the ith row is [utm_e, utm_n] at ith prediction + list: 2D List with shape ((time * resolutions), (2)), + where the ith row is [utm_e, utm_n] at ith prediction """ # t_0 = time.perf_counter_ns() + dtheta = v * np.tan(np.deg2rad(command)) / self.wheelbase ts = 1/resolution t = np.arange(0, delta_t, ts) @@ -45,9 +47,9 @@ def project(self, pose: Pose, command: float, v: float, delta_t: float, resoluti y = pose.y + t * v * np.sin(theta) output = np.vstack((x, y)).T - t_1 = time.perf_counter_ns() - + # t_1 = time.perf_counter_ns() # print("time per point (us):", (t_1 - t_0)/(1000 * resolution * delta_t)) + return output def project_discrete(self, pose: Pose, command: float, v: float, time: float, resolution: int, sim_rate: int) -> list: diff --git a/rb_ws/src/buggy/scripts/auton/stanley_controller.py b/rb_ws/src/buggy/scripts/auton/stanley_controller.py index 5cf95e50..73e9f76e 100644 --- a/rb_ws/src/buggy/scripts/auton/stanley_controller.py +++ b/rb_ws/src/buggy/scripts/auton/stanley_controller.py @@ -1,5 +1,3 @@ -from abc import ABC, abstractmethod - import numpy as np import rospy diff --git a/rb_ws/src/buggy/scripts/auton/trajectory.py b/rb_ws/src/buggy/scripts/auton/trajectory.py index 6e044018..5cfbc664 100755 --- a/rb_ws/src/buggy/scripts/auton/trajectory.py +++ b/rb_ws/src/buggy/scripts/auton/trajectory.py @@ -1,7 +1,8 @@ -import numpy as np import json import matplotlib.pyplot as plt import uuid +import numpy as np + from scipy.interpolate import Akima1DInterpolator, CubicSpline from world import World